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, Sep 13, 2018 09:04-0400 for FHIR v3.5.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 Identifier parseIdentifier(JsonObject json) throws IOException, FHIRFormatError {
743    Identifier res = new Identifier();
744    parseIdentifierProperties(json, res);
745    return res;
746  }
747
748  protected void parseIdentifierProperties(JsonObject json, Identifier res) throws IOException, FHIRFormatError {
749    parseTypeProperties(json, res);
750    if (json.has("use"))
751      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Identifier.IdentifierUse.NULL, new Identifier.IdentifierUseEnumFactory()));
752    if (json.has("_use"))
753      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
754    if (json.has("type"))
755      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
756    if (json.has("system"))
757      res.setSystemElement(parseUri(json.get("system").getAsString()));
758    if (json.has("_system"))
759      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
760    if (json.has("value"))
761      res.setValueElement(parseString(json.get("value").getAsString()));
762    if (json.has("_value"))
763      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
764    if (json.has("period"))
765      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
766    if (json.has("assigner"))
767      res.setAssigner(parseReference(json.getAsJsonObject("assigner")));
768  }
769
770  protected Coding parseCoding(JsonObject json) throws IOException, FHIRFormatError {
771    Coding res = new Coding();
772    parseCodingProperties(json, res);
773    return res;
774  }
775
776  protected void parseCodingProperties(JsonObject json, Coding res) throws IOException, FHIRFormatError {
777    parseTypeProperties(json, res);
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("version"))
783      res.setVersionElement(parseString(json.get("version").getAsString()));
784    if (json.has("_version"))
785      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
786    if (json.has("code"))
787      res.setCodeElement(parseCode(json.get("code").getAsString()));
788    if (json.has("_code"))
789      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
790    if (json.has("display"))
791      res.setDisplayElement(parseString(json.get("display").getAsString()));
792    if (json.has("_display"))
793      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
794    if (json.has("userSelected"))
795      res.setUserSelectedElement(parseBoolean(json.get("userSelected").getAsBoolean()));
796    if (json.has("_userSelected"))
797      parseElementProperties(json.getAsJsonObject("_userSelected"), res.getUserSelectedElement());
798  }
799
800  protected SampledData parseSampledData(JsonObject json) throws IOException, FHIRFormatError {
801    SampledData res = new SampledData();
802    parseSampledDataProperties(json, res);
803    return res;
804  }
805
806  protected void parseSampledDataProperties(JsonObject json, SampledData res) throws IOException, FHIRFormatError {
807    parseTypeProperties(json, res);
808    if (json.has("origin"))
809      res.setOrigin(parseQuantity(json.getAsJsonObject("origin")));
810    if (json.has("period"))
811      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
812    if (json.has("_period"))
813      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
814    if (json.has("factor"))
815      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
816    if (json.has("_factor"))
817      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
818    if (json.has("lowerLimit"))
819      res.setLowerLimitElement(parseDecimal(json.get("lowerLimit").getAsBigDecimal()));
820    if (json.has("_lowerLimit"))
821      parseElementProperties(json.getAsJsonObject("_lowerLimit"), res.getLowerLimitElement());
822    if (json.has("upperLimit"))
823      res.setUpperLimitElement(parseDecimal(json.get("upperLimit").getAsBigDecimal()));
824    if (json.has("_upperLimit"))
825      parseElementProperties(json.getAsJsonObject("_upperLimit"), res.getUpperLimitElement());
826    if (json.has("dimensions"))
827      res.setDimensionsElement(parsePositiveInt(json.get("dimensions").getAsString()));
828    if (json.has("_dimensions"))
829      parseElementProperties(json.getAsJsonObject("_dimensions"), res.getDimensionsElement());
830    if (json.has("data"))
831      res.setDataElement(parseString(json.get("data").getAsString()));
832    if (json.has("_data"))
833      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
834  }
835
836  protected Ratio parseRatio(JsonObject json) throws IOException, FHIRFormatError {
837    Ratio res = new Ratio();
838    parseRatioProperties(json, res);
839    return res;
840  }
841
842  protected void parseRatioProperties(JsonObject json, Ratio res) throws IOException, FHIRFormatError {
843    parseTypeProperties(json, res);
844    if (json.has("numerator"))
845      res.setNumerator(parseQuantity(json.getAsJsonObject("numerator")));
846    if (json.has("denominator"))
847      res.setDenominator(parseQuantity(json.getAsJsonObject("denominator")));
848  }
849
850  protected Distance parseDistance(JsonObject json) throws IOException, FHIRFormatError {
851    Distance res = new Distance();
852    parseDistanceProperties(json, res);
853    return res;
854  }
855
856  protected void parseDistanceProperties(JsonObject json, Distance res) throws IOException, FHIRFormatError {
857    parseQuantityProperties(json, res);
858  }
859
860  protected Age parseAge(JsonObject json) throws IOException, FHIRFormatError {
861    Age res = new Age();
862    parseAgeProperties(json, res);
863    return res;
864  }
865
866  protected void parseAgeProperties(JsonObject json, Age res) throws IOException, FHIRFormatError {
867    parseQuantityProperties(json, res);
868  }
869
870  protected Reference parseReference(JsonObject json) throws IOException, FHIRFormatError {
871    Reference res = new Reference();
872    parseReferenceProperties(json, res);
873    return res;
874  }
875
876  protected void parseReferenceProperties(JsonObject json, Reference res) throws IOException, FHIRFormatError {
877    parseTypeProperties(json, res);
878    if (json.has("reference"))
879      res.setReferenceElement(parseString(json.get("reference").getAsString()));
880    if (json.has("_reference"))
881      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
882    if (json.has("type"))
883      res.setTypeElement(parseUri(json.get("type").getAsString()));
884    if (json.has("_type"))
885      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
886    if (json.has("identifier"))
887      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
888    if (json.has("display"))
889      res.setDisplayElement(parseString(json.get("display").getAsString()));
890    if (json.has("_display"))
891      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
892  }
893
894  protected TriggerDefinition parseTriggerDefinition(JsonObject json) throws IOException, FHIRFormatError {
895    TriggerDefinition res = new TriggerDefinition();
896    parseTriggerDefinitionProperties(json, res);
897    return res;
898  }
899
900  protected void parseTriggerDefinitionProperties(JsonObject json, TriggerDefinition res) throws IOException, FHIRFormatError {
901    parseTypeProperties(json, res);
902    if (json.has("type"))
903      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TriggerDefinition.TriggerType.NULL, new TriggerDefinition.TriggerTypeEnumFactory()));
904    if (json.has("_type"))
905      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
906    if (json.has("name"))
907      res.setNameElement(parseString(json.get("name").getAsString()));
908    if (json.has("_name"))
909      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
910    Type timing = parseType("timing", json);
911    if (timing != null)
912      res.setTiming(timing);
913    if (json.has("data"))
914      res.setData(parseDataRequirement(json.getAsJsonObject("data")));
915    if (json.has("condition"))
916      res.setCondition(parseExpression(json.getAsJsonObject("condition")));
917  }
918
919  protected Quantity parseQuantity(JsonObject json) throws IOException, FHIRFormatError {
920    Quantity res = new Quantity();
921    parseQuantityProperties(json, res);
922    return res;
923  }
924
925  protected void parseQuantityProperties(JsonObject json, Quantity res) throws IOException, FHIRFormatError {
926    parseTypeProperties(json, res);
927    if (json.has("value"))
928      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
929    if (json.has("_value"))
930      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
931    if (json.has("comparator"))
932      res.setComparatorElement(parseEnumeration(json.get("comparator").getAsString(), Quantity.QuantityComparator.NULL, new Quantity.QuantityComparatorEnumFactory()));
933    if (json.has("_comparator"))
934      parseElementProperties(json.getAsJsonObject("_comparator"), res.getComparatorElement());
935    if (json.has("unit"))
936      res.setUnitElement(parseString(json.get("unit").getAsString()));
937    if (json.has("_unit"))
938      parseElementProperties(json.getAsJsonObject("_unit"), res.getUnitElement());
939    if (json.has("system"))
940      res.setSystemElement(parseUri(json.get("system").getAsString()));
941    if (json.has("_system"))
942      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
943    if (json.has("code"))
944      res.setCodeElement(parseCode(json.get("code").getAsString()));
945    if (json.has("_code"))
946      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
947  }
948
949  protected Period parsePeriod(JsonObject json) throws IOException, FHIRFormatError {
950    Period res = new Period();
951    parsePeriodProperties(json, res);
952    return res;
953  }
954
955  protected void parsePeriodProperties(JsonObject json, Period res) throws IOException, FHIRFormatError {
956    parseTypeProperties(json, res);
957    if (json.has("start"))
958      res.setStartElement(parseDateTime(json.get("start").getAsString()));
959    if (json.has("_start"))
960      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
961    if (json.has("end"))
962      res.setEndElement(parseDateTime(json.get("end").getAsString()));
963    if (json.has("_end"))
964      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
965  }
966
967  protected Duration parseDuration(JsonObject json) throws IOException, FHIRFormatError {
968    Duration res = new Duration();
969    parseDurationProperties(json, res);
970    return res;
971  }
972
973  protected void parseDurationProperties(JsonObject json, Duration res) throws IOException, FHIRFormatError {
974    parseQuantityProperties(json, res);
975  }
976
977  protected Range parseRange(JsonObject json) throws IOException, FHIRFormatError {
978    Range res = new Range();
979    parseRangeProperties(json, res);
980    return res;
981  }
982
983  protected void parseRangeProperties(JsonObject json, Range res) throws IOException, FHIRFormatError {
984    parseTypeProperties(json, res);
985    if (json.has("low"))
986      res.setLow(parseQuantity(json.getAsJsonObject("low")));
987    if (json.has("high"))
988      res.setHigh(parseQuantity(json.getAsJsonObject("high")));
989  }
990
991  protected RelatedArtifact parseRelatedArtifact(JsonObject json) throws IOException, FHIRFormatError {
992    RelatedArtifact res = new RelatedArtifact();
993    parseRelatedArtifactProperties(json, res);
994    return res;
995  }
996
997  protected void parseRelatedArtifactProperties(JsonObject json, RelatedArtifact res) throws IOException, FHIRFormatError {
998    parseTypeProperties(json, res);
999    if (json.has("type"))
1000      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), RelatedArtifact.RelatedArtifactType.NULL, new RelatedArtifact.RelatedArtifactTypeEnumFactory()));
1001    if (json.has("_type"))
1002      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1003    if (json.has("display"))
1004      res.setDisplayElement(parseString(json.get("display").getAsString()));
1005    if (json.has("_display"))
1006      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
1007    if (json.has("citation"))
1008      res.setCitationElement(parseString(json.get("citation").getAsString()));
1009    if (json.has("_citation"))
1010      parseElementProperties(json.getAsJsonObject("_citation"), res.getCitationElement());
1011    if (json.has("url"))
1012      res.setUrlElement(parseUrl(json.get("url").getAsString()));
1013    if (json.has("_url"))
1014      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
1015    if (json.has("document"))
1016      res.setDocument(parseAttachment(json.getAsJsonObject("document")));
1017    if (json.has("resource"))
1018      res.setResourceElement(parseCanonical(json.get("resource").getAsString()));
1019    if (json.has("_resource"))
1020      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
1021  }
1022
1023  protected Annotation parseAnnotation(JsonObject json) throws IOException, FHIRFormatError {
1024    Annotation res = new Annotation();
1025    parseAnnotationProperties(json, res);
1026    return res;
1027  }
1028
1029  protected void parseAnnotationProperties(JsonObject json, Annotation res) throws IOException, FHIRFormatError {
1030    parseTypeProperties(json, res);
1031    Type author = parseType("author", json);
1032    if (author != null)
1033      res.setAuthor(author);
1034    if (json.has("time"))
1035      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
1036    if (json.has("_time"))
1037      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
1038    if (json.has("text"))
1039      res.setTextElement(parseMarkdown(json.get("text").getAsString()));
1040    if (json.has("_text"))
1041      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1042  }
1043
1044  protected ContactDetail parseContactDetail(JsonObject json) throws IOException, FHIRFormatError {
1045    ContactDetail res = new ContactDetail();
1046    parseContactDetailProperties(json, res);
1047    return res;
1048  }
1049
1050  protected void parseContactDetailProperties(JsonObject json, ContactDetail res) throws IOException, FHIRFormatError {
1051    parseTypeProperties(json, res);
1052    if (json.has("name"))
1053      res.setNameElement(parseString(json.get("name").getAsString()));
1054    if (json.has("_name"))
1055      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1056    if (json.has("telecom")) {
1057      JsonArray array = json.getAsJsonArray("telecom");
1058      for (int i = 0; i < array.size(); i++) {
1059        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
1060      }
1061    };
1062  }
1063
1064  protected UsageContext parseUsageContext(JsonObject json) throws IOException, FHIRFormatError {
1065    UsageContext res = new UsageContext();
1066    parseUsageContextProperties(json, res);
1067    return res;
1068  }
1069
1070  protected void parseUsageContextProperties(JsonObject json, UsageContext res) throws IOException, FHIRFormatError {
1071    parseTypeProperties(json, res);
1072    if (json.has("code"))
1073      res.setCode(parseCoding(json.getAsJsonObject("code")));
1074    Type value = parseType("value", json);
1075    if (value != null)
1076      res.setValue(value);
1077  }
1078
1079  protected Expression parseExpression(JsonObject json) throws IOException, FHIRFormatError {
1080    Expression res = new Expression();
1081    parseExpressionProperties(json, res);
1082    return res;
1083  }
1084
1085  protected void parseExpressionProperties(JsonObject json, Expression res) throws IOException, FHIRFormatError {
1086    parseElementProperties(json, res);
1087    if (json.has("description"))
1088      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1089    if (json.has("_description"))
1090      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1091    if (json.has("name"))
1092      res.setNameElement(parseId(json.get("name").getAsString()));
1093    if (json.has("_name"))
1094      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1095    if (json.has("language"))
1096      res.setLanguageElement(parseEnumeration(json.get("language").getAsString(), Expression.ExpressionLanguage.NULL, new Expression.ExpressionLanguageEnumFactory()));
1097    if (json.has("_language"))
1098      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1099    if (json.has("expression"))
1100      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1101    if (json.has("_expression"))
1102      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1103    if (json.has("reference"))
1104      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
1105    if (json.has("_reference"))
1106      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
1107  }
1108
1109  protected Signature parseSignature(JsonObject json) throws IOException, FHIRFormatError {
1110    Signature res = new Signature();
1111    parseSignatureProperties(json, res);
1112    return res;
1113  }
1114
1115  protected void parseSignatureProperties(JsonObject json, Signature res) throws IOException, FHIRFormatError {
1116    parseTypeProperties(json, res);
1117    if (json.has("type")) {
1118      JsonArray array = json.getAsJsonArray("type");
1119      for (int i = 0; i < array.size(); i++) {
1120        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
1121      }
1122    };
1123    if (json.has("when"))
1124      res.setWhenElement(parseInstant(json.get("when").getAsString()));
1125    if (json.has("_when"))
1126      parseElementProperties(json.getAsJsonObject("_when"), res.getWhenElement());
1127    if (json.has("who"))
1128      res.setWho(parseReference(json.getAsJsonObject("who")));
1129    if (json.has("onBehalfOf"))
1130      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
1131    if (json.has("targetFormat"))
1132      res.setTargetFormatElement(parseCode(json.get("targetFormat").getAsString()));
1133    if (json.has("_targetFormat"))
1134      parseElementProperties(json.getAsJsonObject("_targetFormat"), res.getTargetFormatElement());
1135    if (json.has("sigFormat"))
1136      res.setSigFormatElement(parseCode(json.get("sigFormat").getAsString()));
1137    if (json.has("_sigFormat"))
1138      parseElementProperties(json.getAsJsonObject("_sigFormat"), res.getSigFormatElement());
1139    if (json.has("data"))
1140      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
1141    if (json.has("_data"))
1142      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
1143  }
1144
1145  protected Timing parseTiming(JsonObject json) throws IOException, FHIRFormatError {
1146    Timing res = new Timing();
1147    parseTimingProperties(json, res);
1148    return res;
1149  }
1150
1151  protected void parseTimingProperties(JsonObject json, Timing res) throws IOException, FHIRFormatError {
1152    parseBackboneElementProperties(json, res);
1153    if (json.has("event")) {
1154      JsonArray array = json.getAsJsonArray("event");
1155      for (int i = 0; i < array.size(); i++) {
1156        res.getEvent().add(parseDateTime(array.get(i).getAsString()));
1157      }
1158    };
1159    if (json.has("_event")) {
1160      JsonArray array = json.getAsJsonArray("_event");
1161      for (int i = 0; i < array.size(); i++) {
1162        if (i == res.getEvent().size())
1163          res.getEvent().add(parseDateTime(null));
1164        if (array.get(i) instanceof JsonObject) 
1165          parseElementProperties(array.get(i).getAsJsonObject(), res.getEvent().get(i));
1166      }
1167    };
1168    if (json.has("repeat"))
1169      res.setRepeat(parseTimingTimingRepeatComponent(json.getAsJsonObject("repeat"), res));
1170    if (json.has("code"))
1171      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
1172  }
1173
1174  protected Timing.TimingRepeatComponent parseTimingTimingRepeatComponent(JsonObject json, Timing owner) throws IOException, FHIRFormatError {
1175    Timing.TimingRepeatComponent res = new Timing.TimingRepeatComponent();
1176    parseTimingTimingRepeatComponentProperties(json, owner, res);
1177    return res;
1178  }
1179
1180  protected void parseTimingTimingRepeatComponentProperties(JsonObject json, Timing owner, Timing.TimingRepeatComponent res) throws IOException, FHIRFormatError {
1181    parseTypeProperties(json, res);
1182    Type bounds = parseType("bounds", json);
1183    if (bounds != null)
1184      res.setBounds(bounds);
1185    if (json.has("count"))
1186      res.setCountElement(parsePositiveInt(json.get("count").getAsString()));
1187    if (json.has("_count"))
1188      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
1189    if (json.has("countMax"))
1190      res.setCountMaxElement(parsePositiveInt(json.get("countMax").getAsString()));
1191    if (json.has("_countMax"))
1192      parseElementProperties(json.getAsJsonObject("_countMax"), res.getCountMaxElement());
1193    if (json.has("duration"))
1194      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
1195    if (json.has("_duration"))
1196      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
1197    if (json.has("durationMax"))
1198      res.setDurationMaxElement(parseDecimal(json.get("durationMax").getAsBigDecimal()));
1199    if (json.has("_durationMax"))
1200      parseElementProperties(json.getAsJsonObject("_durationMax"), res.getDurationMaxElement());
1201    if (json.has("durationUnit"))
1202      res.setDurationUnitElement(parseEnumeration(json.get("durationUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1203    if (json.has("_durationUnit"))
1204      parseElementProperties(json.getAsJsonObject("_durationUnit"), res.getDurationUnitElement());
1205    if (json.has("frequency"))
1206      res.setFrequencyElement(parsePositiveInt(json.get("frequency").getAsString()));
1207    if (json.has("_frequency"))
1208      parseElementProperties(json.getAsJsonObject("_frequency"), res.getFrequencyElement());
1209    if (json.has("frequencyMax"))
1210      res.setFrequencyMaxElement(parsePositiveInt(json.get("frequencyMax").getAsString()));
1211    if (json.has("_frequencyMax"))
1212      parseElementProperties(json.getAsJsonObject("_frequencyMax"), res.getFrequencyMaxElement());
1213    if (json.has("period"))
1214      res.setPeriodElement(parseDecimal(json.get("period").getAsBigDecimal()));
1215    if (json.has("_period"))
1216      parseElementProperties(json.getAsJsonObject("_period"), res.getPeriodElement());
1217    if (json.has("periodMax"))
1218      res.setPeriodMaxElement(parseDecimal(json.get("periodMax").getAsBigDecimal()));
1219    if (json.has("_periodMax"))
1220      parseElementProperties(json.getAsJsonObject("_periodMax"), res.getPeriodMaxElement());
1221    if (json.has("periodUnit"))
1222      res.setPeriodUnitElement(parseEnumeration(json.get("periodUnit").getAsString(), Timing.UnitsOfTime.NULL, new Timing.UnitsOfTimeEnumFactory()));
1223    if (json.has("_periodUnit"))
1224      parseElementProperties(json.getAsJsonObject("_periodUnit"), res.getPeriodUnitElement());
1225    if (json.has("dayOfWeek")) {
1226      JsonArray array = json.getAsJsonArray("dayOfWeek");
1227      for (int i = 0; i < array.size(); i++) {
1228        res.getDayOfWeek().add(parseEnumeration(array.get(i).getAsString(), Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1229      }
1230    };
1231    if (json.has("_dayOfWeek")) {
1232      JsonArray array = json.getAsJsonArray("_dayOfWeek");
1233      for (int i = 0; i < array.size(); i++) {
1234        if (i == res.getDayOfWeek().size())
1235          res.getDayOfWeek().add(parseEnumeration(null, Timing.DayOfWeek.NULL, new Timing.DayOfWeekEnumFactory()));
1236        if (array.get(i) instanceof JsonObject) 
1237          parseElementProperties(array.get(i).getAsJsonObject(), res.getDayOfWeek().get(i));
1238      }
1239    };
1240    if (json.has("timeOfDay")) {
1241      JsonArray array = json.getAsJsonArray("timeOfDay");
1242      for (int i = 0; i < array.size(); i++) {
1243        res.getTimeOfDay().add(parseTime(array.get(i).getAsString()));
1244      }
1245    };
1246    if (json.has("_timeOfDay")) {
1247      JsonArray array = json.getAsJsonArray("_timeOfDay");
1248      for (int i = 0; i < array.size(); i++) {
1249        if (i == res.getTimeOfDay().size())
1250          res.getTimeOfDay().add(parseTime(null));
1251        if (array.get(i) instanceof JsonObject) 
1252          parseElementProperties(array.get(i).getAsJsonObject(), res.getTimeOfDay().get(i));
1253      }
1254    };
1255    if (json.has("when")) {
1256      JsonArray array = json.getAsJsonArray("when");
1257      for (int i = 0; i < array.size(); i++) {
1258        res.getWhen().add(parseEnumeration(array.get(i).getAsString(), Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1259      }
1260    };
1261    if (json.has("_when")) {
1262      JsonArray array = json.getAsJsonArray("_when");
1263      for (int i = 0; i < array.size(); i++) {
1264        if (i == res.getWhen().size())
1265          res.getWhen().add(parseEnumeration(null, Timing.EventTiming.NULL, new Timing.EventTimingEnumFactory()));
1266        if (array.get(i) instanceof JsonObject) 
1267          parseElementProperties(array.get(i).getAsJsonObject(), res.getWhen().get(i));
1268      }
1269    };
1270    if (json.has("offset"))
1271      res.setOffsetElement(parseUnsignedInt(json.get("offset").getAsString()));
1272    if (json.has("_offset"))
1273      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
1274  }
1275
1276  protected CodeableConcept parseCodeableConcept(JsonObject json) throws IOException, FHIRFormatError {
1277    CodeableConcept res = new CodeableConcept();
1278    parseCodeableConceptProperties(json, res);
1279    return res;
1280  }
1281
1282  protected void parseCodeableConceptProperties(JsonObject json, CodeableConcept res) throws IOException, FHIRFormatError {
1283    parseTypeProperties(json, res);
1284    if (json.has("coding")) {
1285      JsonArray array = json.getAsJsonArray("coding");
1286      for (int i = 0; i < array.size(); i++) {
1287        res.getCoding().add(parseCoding(array.get(i).getAsJsonObject()));
1288      }
1289    };
1290    if (json.has("text"))
1291      res.setTextElement(parseString(json.get("text").getAsString()));
1292    if (json.has("_text"))
1293      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
1294  }
1295
1296  protected ParameterDefinition parseParameterDefinition(JsonObject json) throws IOException, FHIRFormatError {
1297    ParameterDefinition res = new ParameterDefinition();
1298    parseParameterDefinitionProperties(json, res);
1299    return res;
1300  }
1301
1302  protected void parseParameterDefinitionProperties(JsonObject json, ParameterDefinition res) throws IOException, FHIRFormatError {
1303    parseTypeProperties(json, res);
1304    if (json.has("name"))
1305      res.setNameElement(parseCode(json.get("name").getAsString()));
1306    if (json.has("_name"))
1307      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1308    if (json.has("use"))
1309      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ParameterDefinition.ParameterUse.NULL, new ParameterDefinition.ParameterUseEnumFactory()));
1310    if (json.has("_use"))
1311      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
1312    if (json.has("min"))
1313      res.setMinElement(parseInteger(json.get("min").getAsLong()));
1314    if (json.has("_min"))
1315      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1316    if (json.has("max"))
1317      res.setMaxElement(parseString(json.get("max").getAsString()));
1318    if (json.has("_max"))
1319      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1320    if (json.has("documentation"))
1321      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
1322    if (json.has("_documentation"))
1323      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
1324    if (json.has("type"))
1325      res.setTypeElement(parseCode(json.get("type").getAsString()));
1326    if (json.has("_type"))
1327      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1328    if (json.has("profile"))
1329      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
1330    if (json.has("_profile"))
1331      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
1332  }
1333
1334  protected MarketingStatus parseMarketingStatus(JsonObject json) throws IOException, FHIRFormatError {
1335    MarketingStatus res = new MarketingStatus();
1336    parseMarketingStatusProperties(json, res);
1337    return res;
1338  }
1339
1340  protected void parseMarketingStatusProperties(JsonObject json, MarketingStatus res) throws IOException, FHIRFormatError {
1341    parseBackboneElementProperties(json, res);
1342    if (json.has("country"))
1343      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
1344    if (json.has("jurisdiction"))
1345      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
1346    if (json.has("status"))
1347      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
1348    if (json.has("dateRange"))
1349      res.setDateRange(parsePeriod(json.getAsJsonObject("dateRange")));
1350    if (json.has("restoreDate"))
1351      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
1352    if (json.has("_restoreDate"))
1353      parseElementProperties(json.getAsJsonObject("_restoreDate"), res.getRestoreDateElement());
1354  }
1355
1356  protected SubstanceAmount parseSubstanceAmount(JsonObject json) throws IOException, FHIRFormatError {
1357    SubstanceAmount res = new SubstanceAmount();
1358    parseSubstanceAmountProperties(json, res);
1359    return res;
1360  }
1361
1362  protected void parseSubstanceAmountProperties(JsonObject json, SubstanceAmount res) throws IOException, FHIRFormatError {
1363    parseBackboneElementProperties(json, res);
1364    Type amount = parseType("amount", json);
1365    if (amount != null)
1366      res.setAmount(amount);
1367    if (json.has("amountType"))
1368      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
1369    if (json.has("amountText"))
1370      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
1371    if (json.has("_amountText"))
1372      parseElementProperties(json.getAsJsonObject("_amountText"), res.getAmountTextElement());
1373    if (json.has("referenceRange"))
1374      res.setReferenceRange(parseSubstanceAmountSubstanceAmountReferenceRangeComponent(json.getAsJsonObject("referenceRange"), res));
1375  }
1376
1377  protected SubstanceAmount.SubstanceAmountReferenceRangeComponent parseSubstanceAmountSubstanceAmountReferenceRangeComponent(JsonObject json, SubstanceAmount owner) throws IOException, FHIRFormatError {
1378    SubstanceAmount.SubstanceAmountReferenceRangeComponent res = new SubstanceAmount.SubstanceAmountReferenceRangeComponent();
1379    parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(json, owner, res);
1380    return res;
1381  }
1382
1383  protected void parseSubstanceAmountSubstanceAmountReferenceRangeComponentProperties(JsonObject json, SubstanceAmount owner, SubstanceAmount.SubstanceAmountReferenceRangeComponent res) throws IOException, FHIRFormatError {
1384    parseTypeProperties(json, res);
1385    if (json.has("lowLimit"))
1386      res.setLowLimit(parseQuantity(json.getAsJsonObject("lowLimit")));
1387    if (json.has("highLimit"))
1388      res.setHighLimit(parseQuantity(json.getAsJsonObject("highLimit")));
1389  }
1390
1391  protected ElementDefinition parseElementDefinition(JsonObject json) throws IOException, FHIRFormatError {
1392    ElementDefinition res = new ElementDefinition();
1393    parseElementDefinitionProperties(json, res);
1394    return res;
1395  }
1396
1397  protected void parseElementDefinitionProperties(JsonObject json, ElementDefinition res) throws IOException, FHIRFormatError {
1398    parseBackboneElementProperties(json, res);
1399    if (json.has("path"))
1400      res.setPathElement(parseString(json.get("path").getAsString()));
1401    if (json.has("_path"))
1402      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1403    if (json.has("representation")) {
1404      JsonArray array = json.getAsJsonArray("representation");
1405      for (int i = 0; i < array.size(); i++) {
1406        res.getRepresentation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1407      }
1408    };
1409    if (json.has("_representation")) {
1410      JsonArray array = json.getAsJsonArray("_representation");
1411      for (int i = 0; i < array.size(); i++) {
1412        if (i == res.getRepresentation().size())
1413          res.getRepresentation().add(parseEnumeration(null, ElementDefinition.PropertyRepresentation.NULL, new ElementDefinition.PropertyRepresentationEnumFactory()));
1414        if (array.get(i) instanceof JsonObject) 
1415          parseElementProperties(array.get(i).getAsJsonObject(), res.getRepresentation().get(i));
1416      }
1417    };
1418    if (json.has("sliceName"))
1419      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
1420    if (json.has("_sliceName"))
1421      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
1422    if (json.has("sliceIsConstraining"))
1423      res.setSliceIsConstrainingElement(parseBoolean(json.get("sliceIsConstraining").getAsBoolean()));
1424    if (json.has("_sliceIsConstraining"))
1425      parseElementProperties(json.getAsJsonObject("_sliceIsConstraining"), res.getSliceIsConstrainingElement());
1426    if (json.has("label"))
1427      res.setLabelElement(parseString(json.get("label").getAsString()));
1428    if (json.has("_label"))
1429      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1430    if (json.has("code")) {
1431      JsonArray array = json.getAsJsonArray("code");
1432      for (int i = 0; i < array.size(); i++) {
1433        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
1434      }
1435    };
1436    if (json.has("slicing"))
1437      res.setSlicing(parseElementDefinitionElementDefinitionSlicingComponent(json.getAsJsonObject("slicing"), res));
1438    if (json.has("short"))
1439      res.setShortElement(parseString(json.get("short").getAsString()));
1440    if (json.has("_short"))
1441      parseElementProperties(json.getAsJsonObject("_short"), res.getShortElement());
1442    if (json.has("definition"))
1443      res.setDefinitionElement(parseMarkdown(json.get("definition").getAsString()));
1444    if (json.has("_definition"))
1445      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
1446    if (json.has("comment"))
1447      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
1448    if (json.has("_comment"))
1449      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1450    if (json.has("requirements"))
1451      res.setRequirementsElement(parseMarkdown(json.get("requirements").getAsString()));
1452    if (json.has("_requirements"))
1453      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1454    if (json.has("alias")) {
1455      JsonArray array = json.getAsJsonArray("alias");
1456      for (int i = 0; i < array.size(); i++) {
1457        res.getAlias().add(parseString(array.get(i).getAsString()));
1458      }
1459    };
1460    if (json.has("_alias")) {
1461      JsonArray array = json.getAsJsonArray("_alias");
1462      for (int i = 0; i < array.size(); i++) {
1463        if (i == res.getAlias().size())
1464          res.getAlias().add(parseString(null));
1465        if (array.get(i) instanceof JsonObject) 
1466          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
1467      }
1468    };
1469    if (json.has("min"))
1470      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1471    if (json.has("_min"))
1472      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1473    if (json.has("max"))
1474      res.setMaxElement(parseString(json.get("max").getAsString()));
1475    if (json.has("_max"))
1476      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1477    if (json.has("base"))
1478      res.setBase(parseElementDefinitionElementDefinitionBaseComponent(json.getAsJsonObject("base"), res));
1479    if (json.has("contentReference"))
1480      res.setContentReferenceElement(parseUri(json.get("contentReference").getAsString()));
1481    if (json.has("_contentReference"))
1482      parseElementProperties(json.getAsJsonObject("_contentReference"), res.getContentReferenceElement());
1483    if (json.has("type")) {
1484      JsonArray array = json.getAsJsonArray("type");
1485      for (int i = 0; i < array.size(); i++) {
1486        res.getType().add(parseElementDefinitionTypeRefComponent(array.get(i).getAsJsonObject(), res));
1487      }
1488    };
1489    Type defaultValue = parseType("defaultValue", json);
1490    if (defaultValue != null)
1491      res.setDefaultValue(defaultValue);
1492    if (json.has("meaningWhenMissing"))
1493      res.setMeaningWhenMissingElement(parseMarkdown(json.get("meaningWhenMissing").getAsString()));
1494    if (json.has("_meaningWhenMissing"))
1495      parseElementProperties(json.getAsJsonObject("_meaningWhenMissing"), res.getMeaningWhenMissingElement());
1496    if (json.has("orderMeaning"))
1497      res.setOrderMeaningElement(parseString(json.get("orderMeaning").getAsString()));
1498    if (json.has("_orderMeaning"))
1499      parseElementProperties(json.getAsJsonObject("_orderMeaning"), res.getOrderMeaningElement());
1500    Type fixed = parseType("fixed", json);
1501    if (fixed != null)
1502      res.setFixed(fixed);
1503    Type pattern = parseType("pattern", json);
1504    if (pattern != null)
1505      res.setPattern(pattern);
1506    if (json.has("example")) {
1507      JsonArray array = json.getAsJsonArray("example");
1508      for (int i = 0; i < array.size(); i++) {
1509        res.getExample().add(parseElementDefinitionElementDefinitionExampleComponent(array.get(i).getAsJsonObject(), res));
1510      }
1511    };
1512    Type minValue = parseType("minValue", json);
1513    if (minValue != null)
1514      res.setMinValue(minValue);
1515    Type maxValue = parseType("maxValue", json);
1516    if (maxValue != null)
1517      res.setMaxValue(maxValue);
1518    if (json.has("maxLength"))
1519      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
1520    if (json.has("_maxLength"))
1521      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
1522    if (json.has("condition")) {
1523      JsonArray array = json.getAsJsonArray("condition");
1524      for (int i = 0; i < array.size(); i++) {
1525        res.getCondition().add(parseId(array.get(i).getAsString()));
1526      }
1527    };
1528    if (json.has("_condition")) {
1529      JsonArray array = json.getAsJsonArray("_condition");
1530      for (int i = 0; i < array.size(); i++) {
1531        if (i == res.getCondition().size())
1532          res.getCondition().add(parseId(null));
1533        if (array.get(i) instanceof JsonObject) 
1534          parseElementProperties(array.get(i).getAsJsonObject(), res.getCondition().get(i));
1535      }
1536    };
1537    if (json.has("constraint")) {
1538      JsonArray array = json.getAsJsonArray("constraint");
1539      for (int i = 0; i < array.size(); i++) {
1540        res.getConstraint().add(parseElementDefinitionElementDefinitionConstraintComponent(array.get(i).getAsJsonObject(), res));
1541      }
1542    };
1543    if (json.has("mustSupport"))
1544      res.setMustSupportElement(parseBoolean(json.get("mustSupport").getAsBoolean()));
1545    if (json.has("_mustSupport"))
1546      parseElementProperties(json.getAsJsonObject("_mustSupport"), res.getMustSupportElement());
1547    if (json.has("isModifier"))
1548      res.setIsModifierElement(parseBoolean(json.get("isModifier").getAsBoolean()));
1549    if (json.has("_isModifier"))
1550      parseElementProperties(json.getAsJsonObject("_isModifier"), res.getIsModifierElement());
1551    if (json.has("isModifierReason"))
1552      res.setIsModifierReasonElement(parseString(json.get("isModifierReason").getAsString()));
1553    if (json.has("_isModifierReason"))
1554      parseElementProperties(json.getAsJsonObject("_isModifierReason"), res.getIsModifierReasonElement());
1555    if (json.has("isSummary"))
1556      res.setIsSummaryElement(parseBoolean(json.get("isSummary").getAsBoolean()));
1557    if (json.has("_isSummary"))
1558      parseElementProperties(json.getAsJsonObject("_isSummary"), res.getIsSummaryElement());
1559    if (json.has("binding"))
1560      res.setBinding(parseElementDefinitionElementDefinitionBindingComponent(json.getAsJsonObject("binding"), res));
1561    if (json.has("mapping")) {
1562      JsonArray array = json.getAsJsonArray("mapping");
1563      for (int i = 0; i < array.size(); i++) {
1564        res.getMapping().add(parseElementDefinitionElementDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
1565      }
1566    };
1567  }
1568
1569  protected ElementDefinition.ElementDefinitionSlicingComponent parseElementDefinitionElementDefinitionSlicingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1570    ElementDefinition.ElementDefinitionSlicingComponent res = new ElementDefinition.ElementDefinitionSlicingComponent();
1571    parseElementDefinitionElementDefinitionSlicingComponentProperties(json, owner, res);
1572    return res;
1573  }
1574
1575  protected void parseElementDefinitionElementDefinitionSlicingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingComponent res) throws IOException, FHIRFormatError {
1576    parseTypeProperties(json, res);
1577    if (json.has("discriminator")) {
1578      JsonArray array = json.getAsJsonArray("discriminator");
1579      for (int i = 0; i < array.size(); i++) {
1580        res.getDiscriminator().add(parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(array.get(i).getAsJsonObject(), owner));
1581      }
1582    };
1583    if (json.has("description"))
1584      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1585    if (json.has("_description"))
1586      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1587    if (json.has("ordered"))
1588      res.setOrderedElement(parseBoolean(json.get("ordered").getAsBoolean()));
1589    if (json.has("_ordered"))
1590      parseElementProperties(json.getAsJsonObject("_ordered"), res.getOrderedElement());
1591    if (json.has("rules"))
1592      res.setRulesElement(parseEnumeration(json.get("rules").getAsString(), ElementDefinition.SlicingRules.NULL, new ElementDefinition.SlicingRulesEnumFactory()));
1593    if (json.has("_rules"))
1594      parseElementProperties(json.getAsJsonObject("_rules"), res.getRulesElement());
1595  }
1596
1597  protected ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent parseElementDefinitionElementDefinitionSlicingDiscriminatorComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1598    ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res = new ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent();
1599    parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(json, owner, res);
1600    return res;
1601  }
1602
1603  protected void parseElementDefinitionElementDefinitionSlicingDiscriminatorComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent res) throws IOException, FHIRFormatError {
1604    parseTypeProperties(json, res);
1605    if (json.has("type"))
1606      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ElementDefinition.DiscriminatorType.NULL, new ElementDefinition.DiscriminatorTypeEnumFactory()));
1607    if (json.has("_type"))
1608      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
1609    if (json.has("path"))
1610      res.setPathElement(parseString(json.get("path").getAsString()));
1611    if (json.has("_path"))
1612      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1613  }
1614
1615  protected ElementDefinition.ElementDefinitionBaseComponent parseElementDefinitionElementDefinitionBaseComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1616    ElementDefinition.ElementDefinitionBaseComponent res = new ElementDefinition.ElementDefinitionBaseComponent();
1617    parseElementDefinitionElementDefinitionBaseComponentProperties(json, owner, res);
1618    return res;
1619  }
1620
1621  protected void parseElementDefinitionElementDefinitionBaseComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBaseComponent res) throws IOException, FHIRFormatError {
1622    parseTypeProperties(json, res);
1623    if (json.has("path"))
1624      res.setPathElement(parseString(json.get("path").getAsString()));
1625    if (json.has("_path"))
1626      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
1627    if (json.has("min"))
1628      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
1629    if (json.has("_min"))
1630      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
1631    if (json.has("max"))
1632      res.setMaxElement(parseString(json.get("max").getAsString()));
1633    if (json.has("_max"))
1634      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
1635  }
1636
1637  protected ElementDefinition.TypeRefComponent parseElementDefinitionTypeRefComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1638    ElementDefinition.TypeRefComponent res = new ElementDefinition.TypeRefComponent();
1639    parseElementDefinitionTypeRefComponentProperties(json, owner, res);
1640    return res;
1641  }
1642
1643  protected void parseElementDefinitionTypeRefComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.TypeRefComponent res) throws IOException, FHIRFormatError {
1644    parseTypeProperties(json, res);
1645    if (json.has("code"))
1646      res.setCodeElement(parseUri(json.get("code").getAsString()));
1647    if (json.has("_code"))
1648      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
1649    if (json.has("profile")) {
1650      JsonArray array = json.getAsJsonArray("profile");
1651      for (int i = 0; i < array.size(); i++) {
1652        res.getProfile().add(parseCanonical(array.get(i).getAsString()));
1653      }
1654    };
1655    if (json.has("_profile")) {
1656      JsonArray array = json.getAsJsonArray("_profile");
1657      for (int i = 0; i < array.size(); i++) {
1658        if (i == res.getProfile().size())
1659          res.getProfile().add(parseCanonical(null));
1660        if (array.get(i) instanceof JsonObject) 
1661          parseElementProperties(array.get(i).getAsJsonObject(), res.getProfile().get(i));
1662      }
1663    };
1664    if (json.has("targetProfile")) {
1665      JsonArray array = json.getAsJsonArray("targetProfile");
1666      for (int i = 0; i < array.size(); i++) {
1667        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
1668      }
1669    };
1670    if (json.has("_targetProfile")) {
1671      JsonArray array = json.getAsJsonArray("_targetProfile");
1672      for (int i = 0; i < array.size(); i++) {
1673        if (i == res.getTargetProfile().size())
1674          res.getTargetProfile().add(parseCanonical(null));
1675        if (array.get(i) instanceof JsonObject) 
1676          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
1677      }
1678    };
1679    if (json.has("aggregation")) {
1680      JsonArray array = json.getAsJsonArray("aggregation");
1681      for (int i = 0; i < array.size(); i++) {
1682        res.getAggregation().add(parseEnumeration(array.get(i).getAsString(), ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1683      }
1684    };
1685    if (json.has("_aggregation")) {
1686      JsonArray array = json.getAsJsonArray("_aggregation");
1687      for (int i = 0; i < array.size(); i++) {
1688        if (i == res.getAggregation().size())
1689          res.getAggregation().add(parseEnumeration(null, ElementDefinition.AggregationMode.NULL, new ElementDefinition.AggregationModeEnumFactory()));
1690        if (array.get(i) instanceof JsonObject) 
1691          parseElementProperties(array.get(i).getAsJsonObject(), res.getAggregation().get(i));
1692      }
1693    };
1694    if (json.has("versioning"))
1695      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), ElementDefinition.ReferenceVersionRules.NULL, new ElementDefinition.ReferenceVersionRulesEnumFactory()));
1696    if (json.has("_versioning"))
1697      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
1698  }
1699
1700  protected ElementDefinition.ElementDefinitionExampleComponent parseElementDefinitionElementDefinitionExampleComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1701    ElementDefinition.ElementDefinitionExampleComponent res = new ElementDefinition.ElementDefinitionExampleComponent();
1702    parseElementDefinitionElementDefinitionExampleComponentProperties(json, owner, res);
1703    return res;
1704  }
1705
1706  protected void parseElementDefinitionElementDefinitionExampleComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionExampleComponent res) throws IOException, FHIRFormatError {
1707    parseTypeProperties(json, res);
1708    if (json.has("label"))
1709      res.setLabelElement(parseString(json.get("label").getAsString()));
1710    if (json.has("_label"))
1711      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
1712    Type value = parseType("value", json);
1713    if (value != null)
1714      res.setValue(value);
1715  }
1716
1717  protected ElementDefinition.ElementDefinitionConstraintComponent parseElementDefinitionElementDefinitionConstraintComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1718    ElementDefinition.ElementDefinitionConstraintComponent res = new ElementDefinition.ElementDefinitionConstraintComponent();
1719    parseElementDefinitionElementDefinitionConstraintComponentProperties(json, owner, res);
1720    return res;
1721  }
1722
1723  protected void parseElementDefinitionElementDefinitionConstraintComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionConstraintComponent res) throws IOException, FHIRFormatError {
1724    parseTypeProperties(json, res);
1725    if (json.has("key"))
1726      res.setKeyElement(parseId(json.get("key").getAsString()));
1727    if (json.has("_key"))
1728      parseElementProperties(json.getAsJsonObject("_key"), res.getKeyElement());
1729    if (json.has("requirements"))
1730      res.setRequirementsElement(parseString(json.get("requirements").getAsString()));
1731    if (json.has("_requirements"))
1732      parseElementProperties(json.getAsJsonObject("_requirements"), res.getRequirementsElement());
1733    if (json.has("severity"))
1734      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), ElementDefinition.ConstraintSeverity.NULL, new ElementDefinition.ConstraintSeverityEnumFactory()));
1735    if (json.has("_severity"))
1736      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
1737    if (json.has("human"))
1738      res.setHumanElement(parseString(json.get("human").getAsString()));
1739    if (json.has("_human"))
1740      parseElementProperties(json.getAsJsonObject("_human"), res.getHumanElement());
1741    if (json.has("expression"))
1742      res.setExpressionElement(parseString(json.get("expression").getAsString()));
1743    if (json.has("_expression"))
1744      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
1745    if (json.has("xpath"))
1746      res.setXpathElement(parseString(json.get("xpath").getAsString()));
1747    if (json.has("_xpath"))
1748      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
1749    if (json.has("source"))
1750      res.setSourceElement(parseCanonical(json.get("source").getAsString()));
1751    if (json.has("_source"))
1752      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
1753  }
1754
1755  protected ElementDefinition.ElementDefinitionBindingComponent parseElementDefinitionElementDefinitionBindingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1756    ElementDefinition.ElementDefinitionBindingComponent res = new ElementDefinition.ElementDefinitionBindingComponent();
1757    parseElementDefinitionElementDefinitionBindingComponentProperties(json, owner, res);
1758    return res;
1759  }
1760
1761  protected void parseElementDefinitionElementDefinitionBindingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionBindingComponent res) throws IOException, FHIRFormatError {
1762    parseTypeProperties(json, res);
1763    if (json.has("strength"))
1764      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
1765    if (json.has("_strength"))
1766      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
1767    if (json.has("description"))
1768      res.setDescriptionElement(parseString(json.get("description").getAsString()));
1769    if (json.has("_description"))
1770      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
1771    if (json.has("valueSet"))
1772      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
1773    if (json.has("_valueSet"))
1774      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
1775  }
1776
1777  protected ElementDefinition.ElementDefinitionMappingComponent parseElementDefinitionElementDefinitionMappingComponent(JsonObject json, ElementDefinition owner) throws IOException, FHIRFormatError {
1778    ElementDefinition.ElementDefinitionMappingComponent res = new ElementDefinition.ElementDefinitionMappingComponent();
1779    parseElementDefinitionElementDefinitionMappingComponentProperties(json, owner, res);
1780    return res;
1781  }
1782
1783  protected void parseElementDefinitionElementDefinitionMappingComponentProperties(JsonObject json, ElementDefinition owner, ElementDefinition.ElementDefinitionMappingComponent res) throws IOException, FHIRFormatError {
1784    parseTypeProperties(json, res);
1785    if (json.has("identity"))
1786      res.setIdentityElement(parseId(json.get("identity").getAsString()));
1787    if (json.has("_identity"))
1788      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
1789    if (json.has("language"))
1790      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1791    if (json.has("_language"))
1792      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1793    if (json.has("map"))
1794      res.setMapElement(parseString(json.get("map").getAsString()));
1795    if (json.has("_map"))
1796      parseElementProperties(json.getAsJsonObject("_map"), res.getMapElement());
1797    if (json.has("comment"))
1798      res.setCommentElement(parseString(json.get("comment").getAsString()));
1799    if (json.has("_comment"))
1800      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
1801  }
1802
1803  protected SubstanceMoiety parseSubstanceMoiety(JsonObject json) throws IOException, FHIRFormatError {
1804    SubstanceMoiety res = new SubstanceMoiety();
1805    parseSubstanceMoietyProperties(json, res);
1806    return res;
1807  }
1808
1809  protected void parseSubstanceMoietyProperties(JsonObject json, SubstanceMoiety res) throws IOException, FHIRFormatError {
1810    parseBackboneElementProperties(json, res);
1811    if (json.has("role"))
1812      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
1813    if (json.has("identifier"))
1814      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1815    if (json.has("name"))
1816      res.setNameElement(parseString(json.get("name").getAsString()));
1817    if (json.has("_name"))
1818      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1819    if (json.has("stereochemistry"))
1820      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
1821    if (json.has("opticalActivity"))
1822      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
1823    if (json.has("molecularFormula"))
1824      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
1825    if (json.has("_molecularFormula"))
1826      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
1827    if (json.has("amount"))
1828      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
1829  }
1830
1831  protected ProductShelfLife parseProductShelfLife(JsonObject json) throws IOException, FHIRFormatError {
1832    ProductShelfLife res = new ProductShelfLife();
1833    parseProductShelfLifeProperties(json, res);
1834    return res;
1835  }
1836
1837  protected void parseProductShelfLifeProperties(JsonObject json, ProductShelfLife res) throws IOException, FHIRFormatError {
1838    parseBackboneElementProperties(json, res);
1839    if (json.has("identifier"))
1840      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
1841    if (json.has("type"))
1842      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
1843    if (json.has("period"))
1844      res.setPeriod(parseQuantity(json.getAsJsonObject("period")));
1845    if (json.has("specialPrecautionsForStorage")) {
1846      JsonArray array = json.getAsJsonArray("specialPrecautionsForStorage");
1847      for (int i = 0; i < array.size(); i++) {
1848        res.getSpecialPrecautionsForStorage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
1849      }
1850    };
1851  }
1852
1853  protected ProdCharacteristic parseProdCharacteristic(JsonObject json) throws IOException, FHIRFormatError {
1854    ProdCharacteristic res = new ProdCharacteristic();
1855    parseProdCharacteristicProperties(json, res);
1856    return res;
1857  }
1858
1859  protected void parseProdCharacteristicProperties(JsonObject json, ProdCharacteristic res) throws IOException, FHIRFormatError {
1860    parseBackboneElementProperties(json, res);
1861    if (json.has("height"))
1862      res.setHeight(parseQuantity(json.getAsJsonObject("height")));
1863    if (json.has("width"))
1864      res.setWidth(parseQuantity(json.getAsJsonObject("width")));
1865    if (json.has("depth"))
1866      res.setDepth(parseQuantity(json.getAsJsonObject("depth")));
1867    if (json.has("weight"))
1868      res.setWeight(parseQuantity(json.getAsJsonObject("weight")));
1869    if (json.has("nominalVolume"))
1870      res.setNominalVolume(parseQuantity(json.getAsJsonObject("nominalVolume")));
1871    if (json.has("externalDiameter"))
1872      res.setExternalDiameter(parseQuantity(json.getAsJsonObject("externalDiameter")));
1873    if (json.has("shape"))
1874      res.setShapeElement(parseString(json.get("shape").getAsString()));
1875    if (json.has("_shape"))
1876      parseElementProperties(json.getAsJsonObject("_shape"), res.getShapeElement());
1877    if (json.has("color")) {
1878      JsonArray array = json.getAsJsonArray("color");
1879      for (int i = 0; i < array.size(); i++) {
1880        res.getColor().add(parseString(array.get(i).getAsString()));
1881      }
1882    };
1883    if (json.has("_color")) {
1884      JsonArray array = json.getAsJsonArray("_color");
1885      for (int i = 0; i < array.size(); i++) {
1886        if (i == res.getColor().size())
1887          res.getColor().add(parseString(null));
1888        if (array.get(i) instanceof JsonObject) 
1889          parseElementProperties(array.get(i).getAsJsonObject(), res.getColor().get(i));
1890      }
1891    };
1892    if (json.has("imprint")) {
1893      JsonArray array = json.getAsJsonArray("imprint");
1894      for (int i = 0; i < array.size(); i++) {
1895        res.getImprint().add(parseString(array.get(i).getAsString()));
1896      }
1897    };
1898    if (json.has("_imprint")) {
1899      JsonArray array = json.getAsJsonArray("_imprint");
1900      for (int i = 0; i < array.size(); i++) {
1901        if (i == res.getImprint().size())
1902          res.getImprint().add(parseString(null));
1903        if (array.get(i) instanceof JsonObject) 
1904          parseElementProperties(array.get(i).getAsJsonObject(), res.getImprint().get(i));
1905      }
1906    };
1907    if (json.has("image")) {
1908      JsonArray array = json.getAsJsonArray("image");
1909      for (int i = 0; i < array.size(); i++) {
1910        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
1911      }
1912    };
1913    if (json.has("scoring"))
1914      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
1915  }
1916
1917  protected void parseDomainResourceProperties(JsonObject json, DomainResource res) throws IOException, FHIRFormatError {
1918    parseResourceProperties(json, res);
1919    if (json.has("text"))
1920      res.setText(parseNarrative(json.getAsJsonObject("text")));
1921    if (json.has("contained")) {
1922      JsonArray array = json.getAsJsonArray("contained");
1923      for (int i = 0; i < array.size(); i++) {
1924        res.getContained().add(parseResource(array.get(i).getAsJsonObject()));
1925      }
1926    };
1927    if (json.has("extension")) {
1928      JsonArray array = json.getAsJsonArray("extension");
1929      for (int i = 0; i < array.size(); i++) {
1930        res.getExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1931      }
1932    };
1933    if (json.has("modifierExtension")) {
1934      JsonArray array = json.getAsJsonArray("modifierExtension");
1935      for (int i = 0; i < array.size(); i++) {
1936        res.getModifierExtension().add(parseExtension(array.get(i).getAsJsonObject()));
1937      }
1938    };
1939  }
1940
1941  protected Parameters parseParameters(JsonObject json) throws IOException, FHIRFormatError {
1942    Parameters res = new Parameters();
1943    parseParametersProperties(json, res);
1944    return res;
1945  }
1946
1947  protected void parseParametersProperties(JsonObject json, Parameters res) throws IOException, FHIRFormatError {
1948    parseResourceProperties(json, res);
1949    if (json.has("parameter")) {
1950      JsonArray array = json.getAsJsonArray("parameter");
1951      for (int i = 0; i < array.size(); i++) {
1952        res.getParameter().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), res));
1953      }
1954    };
1955  }
1956
1957  protected Parameters.ParametersParameterComponent parseParametersParametersParameterComponent(JsonObject json, Parameters owner) throws IOException, FHIRFormatError {
1958    Parameters.ParametersParameterComponent res = new Parameters.ParametersParameterComponent();
1959    parseParametersParametersParameterComponentProperties(json, owner, res);
1960    return res;
1961  }
1962
1963  protected void parseParametersParametersParameterComponentProperties(JsonObject json, Parameters owner, Parameters.ParametersParameterComponent res) throws IOException, FHIRFormatError {
1964    parseBackboneElementProperties(json, res);
1965    if (json.has("name"))
1966      res.setNameElement(parseString(json.get("name").getAsString()));
1967    if (json.has("_name"))
1968      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
1969    Type value = parseType("value", json);
1970    if (value != null)
1971      res.setValue(value);
1972    if (json.has("resource"))
1973      res.setResource(parseResource(json.getAsJsonObject("resource")));
1974    if (json.has("part")) {
1975      JsonArray array = json.getAsJsonArray("part");
1976      for (int i = 0; i < array.size(); i++) {
1977        res.getPart().add(parseParametersParametersParameterComponent(array.get(i).getAsJsonObject(), owner));
1978      }
1979    };
1980  }
1981
1982  protected void parseResourceProperties(JsonObject json, Resource res) throws IOException, FHIRFormatError {
1983    if (json.has("id"))
1984      res.setIdElement(parseId(json.get("id").getAsString()));
1985    if (json.has("_id"))
1986      parseElementProperties(json.getAsJsonObject("_id"), res.getIdElement());
1987    if (json.has("meta"))
1988      res.setMeta(parseMeta(json.getAsJsonObject("meta")));
1989    if (json.has("implicitRules"))
1990      res.setImplicitRulesElement(parseUri(json.get("implicitRules").getAsString()));
1991    if (json.has("_implicitRules"))
1992      parseElementProperties(json.getAsJsonObject("_implicitRules"), res.getImplicitRulesElement());
1993    if (json.has("language"))
1994      res.setLanguageElement(parseCode(json.get("language").getAsString()));
1995    if (json.has("_language"))
1996      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
1997  }
1998
1999  protected Account parseAccount(JsonObject json) throws IOException, FHIRFormatError {
2000    Account res = new Account();
2001    parseAccountProperties(json, res);
2002    return res;
2003  }
2004
2005  protected void parseAccountProperties(JsonObject json, Account res) throws IOException, FHIRFormatError {
2006    parseDomainResourceProperties(json, res);
2007    if (json.has("identifier")) {
2008      JsonArray array = json.getAsJsonArray("identifier");
2009      for (int i = 0; i < array.size(); i++) {
2010        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2011      }
2012    };
2013    if (json.has("status"))
2014      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Account.AccountStatus.NULL, new Account.AccountStatusEnumFactory()));
2015    if (json.has("_status"))
2016      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2017    if (json.has("type"))
2018      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2019    if (json.has("name"))
2020      res.setNameElement(parseString(json.get("name").getAsString()));
2021    if (json.has("_name"))
2022      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2023    if (json.has("subject")) {
2024      JsonArray array = json.getAsJsonArray("subject");
2025      for (int i = 0; i < array.size(); i++) {
2026        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
2027      }
2028    };
2029    if (json.has("servicePeriod"))
2030      res.setServicePeriod(parsePeriod(json.getAsJsonObject("servicePeriod")));
2031    if (json.has("coverage")) {
2032      JsonArray array = json.getAsJsonArray("coverage");
2033      for (int i = 0; i < array.size(); i++) {
2034        res.getCoverage().add(parseAccountCoverageComponent(array.get(i).getAsJsonObject(), res));
2035      }
2036    };
2037    if (json.has("owner"))
2038      res.setOwner(parseReference(json.getAsJsonObject("owner")));
2039    if (json.has("description"))
2040      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2041    if (json.has("_description"))
2042      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2043    if (json.has("guarantor")) {
2044      JsonArray array = json.getAsJsonArray("guarantor");
2045      for (int i = 0; i < array.size(); i++) {
2046        res.getGuarantor().add(parseAccountGuarantorComponent(array.get(i).getAsJsonObject(), res));
2047      }
2048    };
2049    if (json.has("partOf"))
2050      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
2051  }
2052
2053  protected Account.CoverageComponent parseAccountCoverageComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2054    Account.CoverageComponent res = new Account.CoverageComponent();
2055    parseAccountCoverageComponentProperties(json, owner, res);
2056    return res;
2057  }
2058
2059  protected void parseAccountCoverageComponentProperties(JsonObject json, Account owner, Account.CoverageComponent res) throws IOException, FHIRFormatError {
2060    parseBackboneElementProperties(json, res);
2061    if (json.has("coverage"))
2062      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
2063    if (json.has("priority"))
2064      res.setPriorityElement(parsePositiveInt(json.get("priority").getAsString()));
2065    if (json.has("_priority"))
2066      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2067  }
2068
2069  protected Account.GuarantorComponent parseAccountGuarantorComponent(JsonObject json, Account owner) throws IOException, FHIRFormatError {
2070    Account.GuarantorComponent res = new Account.GuarantorComponent();
2071    parseAccountGuarantorComponentProperties(json, owner, res);
2072    return res;
2073  }
2074
2075  protected void parseAccountGuarantorComponentProperties(JsonObject json, Account owner, Account.GuarantorComponent res) throws IOException, FHIRFormatError {
2076    parseBackboneElementProperties(json, res);
2077    if (json.has("party"))
2078      res.setParty(parseReference(json.getAsJsonObject("party")));
2079    if (json.has("onHold"))
2080      res.setOnHoldElement(parseBoolean(json.get("onHold").getAsBoolean()));
2081    if (json.has("_onHold"))
2082      parseElementProperties(json.getAsJsonObject("_onHold"), res.getOnHoldElement());
2083    if (json.has("period"))
2084      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2085  }
2086
2087  protected ActivityDefinition parseActivityDefinition(JsonObject json) throws IOException, FHIRFormatError {
2088    ActivityDefinition res = new ActivityDefinition();
2089    parseActivityDefinitionProperties(json, res);
2090    return res;
2091  }
2092
2093  protected void parseActivityDefinitionProperties(JsonObject json, ActivityDefinition res) throws IOException, FHIRFormatError {
2094    parseDomainResourceProperties(json, res);
2095    if (json.has("url"))
2096      res.setUrlElement(parseUri(json.get("url").getAsString()));
2097    if (json.has("_url"))
2098      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
2099    if (json.has("identifier")) {
2100      JsonArray array = json.getAsJsonArray("identifier");
2101      for (int i = 0; i < array.size(); i++) {
2102        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2103      }
2104    };
2105    if (json.has("version"))
2106      res.setVersionElement(parseString(json.get("version").getAsString()));
2107    if (json.has("_version"))
2108      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
2109    if (json.has("name"))
2110      res.setNameElement(parseString(json.get("name").getAsString()));
2111    if (json.has("_name"))
2112      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2113    if (json.has("title"))
2114      res.setTitleElement(parseString(json.get("title").getAsString()));
2115    if (json.has("_title"))
2116      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
2117    if (json.has("subtitle"))
2118      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
2119    if (json.has("_subtitle"))
2120      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
2121    if (json.has("status"))
2122      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
2123    if (json.has("_status"))
2124      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2125    if (json.has("experimental"))
2126      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
2127    if (json.has("_experimental"))
2128      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
2129    Type subject = parseType("subject", json);
2130    if (subject != null)
2131      res.setSubject(subject);
2132    if (json.has("date"))
2133      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2134    if (json.has("_date"))
2135      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2136    if (json.has("publisher"))
2137      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
2138    if (json.has("_publisher"))
2139      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
2140    if (json.has("contact")) {
2141      JsonArray array = json.getAsJsonArray("contact");
2142      for (int i = 0; i < array.size(); i++) {
2143        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
2144      }
2145    };
2146    if (json.has("description"))
2147      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
2148    if (json.has("_description"))
2149      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2150    if (json.has("useContext")) {
2151      JsonArray array = json.getAsJsonArray("useContext");
2152      for (int i = 0; i < array.size(); i++) {
2153        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
2154      }
2155    };
2156    if (json.has("jurisdiction")) {
2157      JsonArray array = json.getAsJsonArray("jurisdiction");
2158      for (int i = 0; i < array.size(); i++) {
2159        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2160      }
2161    };
2162    if (json.has("purpose"))
2163      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
2164    if (json.has("_purpose"))
2165      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
2166    if (json.has("usage"))
2167      res.setUsageElement(parseString(json.get("usage").getAsString()));
2168    if (json.has("_usage"))
2169      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
2170    if (json.has("copyright"))
2171      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
2172    if (json.has("_copyright"))
2173      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
2174    if (json.has("approvalDate"))
2175      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
2176    if (json.has("_approvalDate"))
2177      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
2178    if (json.has("lastReviewDate"))
2179      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
2180    if (json.has("_lastReviewDate"))
2181      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
2182    if (json.has("effectivePeriod"))
2183      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
2184    if (json.has("topic")) {
2185      JsonArray array = json.getAsJsonArray("topic");
2186      for (int i = 0; i < array.size(); i++) {
2187        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2188      }
2189    };
2190    if (json.has("author")) {
2191      JsonArray array = json.getAsJsonArray("author");
2192      for (int i = 0; i < array.size(); i++) {
2193        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2194      }
2195    };
2196    if (json.has("editor")) {
2197      JsonArray array = json.getAsJsonArray("editor");
2198      for (int i = 0; i < array.size(); i++) {
2199        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
2200      }
2201    };
2202    if (json.has("reviewer")) {
2203      JsonArray array = json.getAsJsonArray("reviewer");
2204      for (int i = 0; i < array.size(); i++) {
2205        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
2206      }
2207    };
2208    if (json.has("endorser")) {
2209      JsonArray array = json.getAsJsonArray("endorser");
2210      for (int i = 0; i < array.size(); i++) {
2211        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
2212      }
2213    };
2214    if (json.has("relatedArtifact")) {
2215      JsonArray array = json.getAsJsonArray("relatedArtifact");
2216      for (int i = 0; i < array.size(); i++) {
2217        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
2218      }
2219    };
2220    if (json.has("library")) {
2221      JsonArray array = json.getAsJsonArray("library");
2222      for (int i = 0; i < array.size(); i++) {
2223        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
2224      }
2225    };
2226    if (json.has("_library")) {
2227      JsonArray array = json.getAsJsonArray("_library");
2228      for (int i = 0; i < array.size(); i++) {
2229        if (i == res.getLibrary().size())
2230          res.getLibrary().add(parseCanonical(null));
2231        if (array.get(i) instanceof JsonObject) 
2232          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
2233      }
2234    };
2235    if (json.has("kind"))
2236      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), ActivityDefinition.ActivityDefinitionKind.NULL, new ActivityDefinition.ActivityDefinitionKindEnumFactory()));
2237    if (json.has("_kind"))
2238      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
2239    if (json.has("profile"))
2240      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
2241    if (json.has("_profile"))
2242      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
2243    if (json.has("code"))
2244      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2245    if (json.has("intent"))
2246      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ActivityDefinition.RequestIntent.NULL, new ActivityDefinition.RequestIntentEnumFactory()));
2247    if (json.has("_intent"))
2248      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
2249    if (json.has("priority"))
2250      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ActivityDefinition.RequestPriority.NULL, new ActivityDefinition.RequestPriorityEnumFactory()));
2251    if (json.has("_priority"))
2252      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2253    if (json.has("doNotPerform"))
2254      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
2255    if (json.has("_doNotPerform"))
2256      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
2257    Type timing = parseType("timing", json);
2258    if (timing != null)
2259      res.setTiming(timing);
2260    if (json.has("location"))
2261      res.setLocation(parseReference(json.getAsJsonObject("location")));
2262    if (json.has("participant")) {
2263      JsonArray array = json.getAsJsonArray("participant");
2264      for (int i = 0; i < array.size(); i++) {
2265        res.getParticipant().add(parseActivityDefinitionActivityDefinitionParticipantComponent(array.get(i).getAsJsonObject(), res));
2266      }
2267    };
2268    Type product = parseType("product", json);
2269    if (product != null)
2270      res.setProduct(product);
2271    if (json.has("quantity"))
2272      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
2273    if (json.has("dosage")) {
2274      JsonArray array = json.getAsJsonArray("dosage");
2275      for (int i = 0; i < array.size(); i++) {
2276        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
2277      }
2278    };
2279    if (json.has("bodySite")) {
2280      JsonArray array = json.getAsJsonArray("bodySite");
2281      for (int i = 0; i < array.size(); i++) {
2282        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2283      }
2284    };
2285    if (json.has("specimenRequirement")) {
2286      JsonArray array = json.getAsJsonArray("specimenRequirement");
2287      for (int i = 0; i < array.size(); i++) {
2288        res.getSpecimenRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2289      }
2290    };
2291    if (json.has("observationRequirement")) {
2292      JsonArray array = json.getAsJsonArray("observationRequirement");
2293      for (int i = 0; i < array.size(); i++) {
2294        res.getObservationRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2295      }
2296    };
2297    if (json.has("observationResultRequirement")) {
2298      JsonArray array = json.getAsJsonArray("observationResultRequirement");
2299      for (int i = 0; i < array.size(); i++) {
2300        res.getObservationResultRequirement().add(parseReference(array.get(i).getAsJsonObject()));
2301      }
2302    };
2303    if (json.has("transform"))
2304      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
2305    if (json.has("_transform"))
2306      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
2307    if (json.has("dynamicValue")) {
2308      JsonArray array = json.getAsJsonArray("dynamicValue");
2309      for (int i = 0; i < array.size(); i++) {
2310        res.getDynamicValue().add(parseActivityDefinitionActivityDefinitionDynamicValueComponent(array.get(i).getAsJsonObject(), res));
2311      }
2312    };
2313  }
2314
2315  protected ActivityDefinition.ActivityDefinitionParticipantComponent parseActivityDefinitionActivityDefinitionParticipantComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2316    ActivityDefinition.ActivityDefinitionParticipantComponent res = new ActivityDefinition.ActivityDefinitionParticipantComponent();
2317    parseActivityDefinitionActivityDefinitionParticipantComponentProperties(json, owner, res);
2318    return res;
2319  }
2320
2321  protected void parseActivityDefinitionActivityDefinitionParticipantComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionParticipantComponent res) throws IOException, FHIRFormatError {
2322    parseBackboneElementProperties(json, res);
2323    if (json.has("type"))
2324      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ActivityDefinition.ActivityParticipantType.NULL, new ActivityDefinition.ActivityParticipantTypeEnumFactory()));
2325    if (json.has("_type"))
2326      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2327    if (json.has("role"))
2328      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
2329  }
2330
2331  protected ActivityDefinition.ActivityDefinitionDynamicValueComponent parseActivityDefinitionActivityDefinitionDynamicValueComponent(JsonObject json, ActivityDefinition owner) throws IOException, FHIRFormatError {
2332    ActivityDefinition.ActivityDefinitionDynamicValueComponent res = new ActivityDefinition.ActivityDefinitionDynamicValueComponent();
2333    parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(json, owner, res);
2334    return res;
2335  }
2336
2337  protected void parseActivityDefinitionActivityDefinitionDynamicValueComponentProperties(JsonObject json, ActivityDefinition owner, ActivityDefinition.ActivityDefinitionDynamicValueComponent res) throws IOException, FHIRFormatError {
2338    parseBackboneElementProperties(json, res);
2339    if (json.has("path"))
2340      res.setPathElement(parseString(json.get("path").getAsString()));
2341    if (json.has("_path"))
2342      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
2343    if (json.has("expression"))
2344      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
2345  }
2346
2347  protected AdverseEvent parseAdverseEvent(JsonObject json) throws IOException, FHIRFormatError {
2348    AdverseEvent res = new AdverseEvent();
2349    parseAdverseEventProperties(json, res);
2350    return res;
2351  }
2352
2353  protected void parseAdverseEventProperties(JsonObject json, AdverseEvent res) throws IOException, FHIRFormatError {
2354    parseDomainResourceProperties(json, res);
2355    if (json.has("identifier"))
2356      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
2357    if (json.has("actuality"))
2358      res.setActualityElement(parseEnumeration(json.get("actuality").getAsString(), AdverseEvent.AdverseEventActuality.NULL, new AdverseEvent.AdverseEventActualityEnumFactory()));
2359    if (json.has("_actuality"))
2360      parseElementProperties(json.getAsJsonObject("_actuality"), res.getActualityElement());
2361    if (json.has("category")) {
2362      JsonArray array = json.getAsJsonArray("category");
2363      for (int i = 0; i < array.size(); i++) {
2364        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2365      }
2366    };
2367    if (json.has("event"))
2368      res.setEvent(parseCodeableConcept(json.getAsJsonObject("event")));
2369    if (json.has("subject"))
2370      res.setSubject(parseReference(json.getAsJsonObject("subject")));
2371    if (json.has("context"))
2372      res.setContext(parseReference(json.getAsJsonObject("context")));
2373    if (json.has("date"))
2374      res.setDateElement(parseDateTime(json.get("date").getAsString()));
2375    if (json.has("_date"))
2376      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
2377    if (json.has("detected"))
2378      res.setDetectedElement(parseDateTime(json.get("detected").getAsString()));
2379    if (json.has("_detected"))
2380      parseElementProperties(json.getAsJsonObject("_detected"), res.getDetectedElement());
2381    if (json.has("recordedDate"))
2382      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2383    if (json.has("_recordedDate"))
2384      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
2385    if (json.has("resultingCondition")) {
2386      JsonArray array = json.getAsJsonArray("resultingCondition");
2387      for (int i = 0; i < array.size(); i++) {
2388        res.getResultingCondition().add(parseReference(array.get(i).getAsJsonObject()));
2389      }
2390    };
2391    if (json.has("location"))
2392      res.setLocation(parseReference(json.getAsJsonObject("location")));
2393    if (json.has("seriousness"))
2394      res.setSeriousness(parseCodeableConcept(json.getAsJsonObject("seriousness")));
2395    if (json.has("severity"))
2396      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
2397    if (json.has("outcome"))
2398      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
2399    if (json.has("recorder"))
2400      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2401    if (json.has("contributor")) {
2402      JsonArray array = json.getAsJsonArray("contributor");
2403      for (int i = 0; i < array.size(); i++) {
2404        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
2405      }
2406    };
2407    if (json.has("suspectEntity")) {
2408      JsonArray array = json.getAsJsonArray("suspectEntity");
2409      for (int i = 0; i < array.size(); i++) {
2410        res.getSuspectEntity().add(parseAdverseEventAdverseEventSuspectEntityComponent(array.get(i).getAsJsonObject(), res));
2411      }
2412    };
2413    if (json.has("subjectMedicalHistory")) {
2414      JsonArray array = json.getAsJsonArray("subjectMedicalHistory");
2415      for (int i = 0; i < array.size(); i++) {
2416        res.getSubjectMedicalHistory().add(parseReference(array.get(i).getAsJsonObject()));
2417      }
2418    };
2419    if (json.has("referenceDocument")) {
2420      JsonArray array = json.getAsJsonArray("referenceDocument");
2421      for (int i = 0; i < array.size(); i++) {
2422        res.getReferenceDocument().add(parseReference(array.get(i).getAsJsonObject()));
2423      }
2424    };
2425    if (json.has("study")) {
2426      JsonArray array = json.getAsJsonArray("study");
2427      for (int i = 0; i < array.size(); i++) {
2428        res.getStudy().add(parseReference(array.get(i).getAsJsonObject()));
2429      }
2430    };
2431  }
2432
2433  protected AdverseEvent.AdverseEventSuspectEntityComponent parseAdverseEventAdverseEventSuspectEntityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2434    AdverseEvent.AdverseEventSuspectEntityComponent res = new AdverseEvent.AdverseEventSuspectEntityComponent();
2435    parseAdverseEventAdverseEventSuspectEntityComponentProperties(json, owner, res);
2436    return res;
2437  }
2438
2439  protected void parseAdverseEventAdverseEventSuspectEntityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityComponent res) throws IOException, FHIRFormatError {
2440    parseBackboneElementProperties(json, res);
2441    if (json.has("instance"))
2442      res.setInstance(parseReference(json.getAsJsonObject("instance")));
2443    if (json.has("causality")) {
2444      JsonArray array = json.getAsJsonArray("causality");
2445      for (int i = 0; i < array.size(); i++) {
2446        res.getCausality().add(parseAdverseEventAdverseEventSuspectEntityCausalityComponent(array.get(i).getAsJsonObject(), owner));
2447      }
2448    };
2449  }
2450
2451  protected AdverseEvent.AdverseEventSuspectEntityCausalityComponent parseAdverseEventAdverseEventSuspectEntityCausalityComponent(JsonObject json, AdverseEvent owner) throws IOException, FHIRFormatError {
2452    AdverseEvent.AdverseEventSuspectEntityCausalityComponent res = new AdverseEvent.AdverseEventSuspectEntityCausalityComponent();
2453    parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(json, owner, res);
2454    return res;
2455  }
2456
2457  protected void parseAdverseEventAdverseEventSuspectEntityCausalityComponentProperties(JsonObject json, AdverseEvent owner, AdverseEvent.AdverseEventSuspectEntityCausalityComponent res) throws IOException, FHIRFormatError {
2458    parseBackboneElementProperties(json, res);
2459    if (json.has("assessment"))
2460      res.setAssessment(parseCodeableConcept(json.getAsJsonObject("assessment")));
2461    if (json.has("productRelatedness"))
2462      res.setProductRelatednessElement(parseString(json.get("productRelatedness").getAsString()));
2463    if (json.has("_productRelatedness"))
2464      parseElementProperties(json.getAsJsonObject("_productRelatedness"), res.getProductRelatednessElement());
2465    if (json.has("author"))
2466      res.setAuthor(parseReference(json.getAsJsonObject("author")));
2467    if (json.has("method"))
2468      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
2469  }
2470
2471  protected AllergyIntolerance parseAllergyIntolerance(JsonObject json) throws IOException, FHIRFormatError {
2472    AllergyIntolerance res = new AllergyIntolerance();
2473    parseAllergyIntoleranceProperties(json, res);
2474    return res;
2475  }
2476
2477  protected void parseAllergyIntoleranceProperties(JsonObject json, AllergyIntolerance res) throws IOException, FHIRFormatError {
2478    parseDomainResourceProperties(json, res);
2479    if (json.has("identifier")) {
2480      JsonArray array = json.getAsJsonArray("identifier");
2481      for (int i = 0; i < array.size(); i++) {
2482        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2483      }
2484    };
2485    if (json.has("clinicalStatus"))
2486      res.setClinicalStatusElement(parseEnumeration(json.get("clinicalStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceClinicalStatus.NULL, new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory()));
2487    if (json.has("_clinicalStatus"))
2488      parseElementProperties(json.getAsJsonObject("_clinicalStatus"), res.getClinicalStatusElement());
2489    if (json.has("verificationStatus"))
2490      res.setVerificationStatusElement(parseEnumeration(json.get("verificationStatus").getAsString(), AllergyIntolerance.AllergyIntoleranceVerificationStatus.NULL, new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory()));
2491    if (json.has("_verificationStatus"))
2492      parseElementProperties(json.getAsJsonObject("_verificationStatus"), res.getVerificationStatusElement());
2493    if (json.has("type"))
2494      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AllergyIntolerance.AllergyIntoleranceType.NULL, new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory()));
2495    if (json.has("_type"))
2496      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2497    if (json.has("category")) {
2498      JsonArray array = json.getAsJsonArray("category");
2499      for (int i = 0; i < array.size(); i++) {
2500        res.getCategory().add(parseEnumeration(array.get(i).getAsString(), AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2501      }
2502    };
2503    if (json.has("_category")) {
2504      JsonArray array = json.getAsJsonArray("_category");
2505      for (int i = 0; i < array.size(); i++) {
2506        if (i == res.getCategory().size())
2507          res.getCategory().add(parseEnumeration(null, AllergyIntolerance.AllergyIntoleranceCategory.NULL, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory()));
2508        if (array.get(i) instanceof JsonObject) 
2509          parseElementProperties(array.get(i).getAsJsonObject(), res.getCategory().get(i));
2510      }
2511    };
2512    if (json.has("criticality"))
2513      res.setCriticalityElement(parseEnumeration(json.get("criticality").getAsString(), AllergyIntolerance.AllergyIntoleranceCriticality.NULL, new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory()));
2514    if (json.has("_criticality"))
2515      parseElementProperties(json.getAsJsonObject("_criticality"), res.getCriticalityElement());
2516    if (json.has("code"))
2517      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
2518    if (json.has("patient"))
2519      res.setPatient(parseReference(json.getAsJsonObject("patient")));
2520    if (json.has("encounter"))
2521      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
2522    Type onset = parseType("onset", json);
2523    if (onset != null)
2524      res.setOnset(onset);
2525    if (json.has("recordedDate"))
2526      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
2527    if (json.has("_recordedDate"))
2528      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
2529    if (json.has("recorder"))
2530      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
2531    if (json.has("asserter"))
2532      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
2533    if (json.has("lastOccurrence"))
2534      res.setLastOccurrenceElement(parseDateTime(json.get("lastOccurrence").getAsString()));
2535    if (json.has("_lastOccurrence"))
2536      parseElementProperties(json.getAsJsonObject("_lastOccurrence"), res.getLastOccurrenceElement());
2537    if (json.has("note")) {
2538      JsonArray array = json.getAsJsonArray("note");
2539      for (int i = 0; i < array.size(); i++) {
2540        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2541      }
2542    };
2543    if (json.has("reaction")) {
2544      JsonArray array = json.getAsJsonArray("reaction");
2545      for (int i = 0; i < array.size(); i++) {
2546        res.getReaction().add(parseAllergyIntoleranceAllergyIntoleranceReactionComponent(array.get(i).getAsJsonObject(), res));
2547      }
2548    };
2549  }
2550
2551  protected AllergyIntolerance.AllergyIntoleranceReactionComponent parseAllergyIntoleranceAllergyIntoleranceReactionComponent(JsonObject json, AllergyIntolerance owner) throws IOException, FHIRFormatError {
2552    AllergyIntolerance.AllergyIntoleranceReactionComponent res = new AllergyIntolerance.AllergyIntoleranceReactionComponent();
2553    parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(json, owner, res);
2554    return res;
2555  }
2556
2557  protected void parseAllergyIntoleranceAllergyIntoleranceReactionComponentProperties(JsonObject json, AllergyIntolerance owner, AllergyIntolerance.AllergyIntoleranceReactionComponent res) throws IOException, FHIRFormatError {
2558    parseBackboneElementProperties(json, res);
2559    if (json.has("substance"))
2560      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
2561    if (json.has("manifestation")) {
2562      JsonArray array = json.getAsJsonArray("manifestation");
2563      for (int i = 0; i < array.size(); i++) {
2564        res.getManifestation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2565      }
2566    };
2567    if (json.has("description"))
2568      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2569    if (json.has("_description"))
2570      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2571    if (json.has("onset"))
2572      res.setOnsetElement(parseDateTime(json.get("onset").getAsString()));
2573    if (json.has("_onset"))
2574      parseElementProperties(json.getAsJsonObject("_onset"), res.getOnsetElement());
2575    if (json.has("severity"))
2576      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), AllergyIntolerance.AllergyIntoleranceSeverity.NULL, new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory()));
2577    if (json.has("_severity"))
2578      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
2579    if (json.has("exposureRoute"))
2580      res.setExposureRoute(parseCodeableConcept(json.getAsJsonObject("exposureRoute")));
2581    if (json.has("note")) {
2582      JsonArray array = json.getAsJsonArray("note");
2583      for (int i = 0; i < array.size(); i++) {
2584        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
2585      }
2586    };
2587  }
2588
2589  protected Appointment parseAppointment(JsonObject json) throws IOException, FHIRFormatError {
2590    Appointment res = new Appointment();
2591    parseAppointmentProperties(json, res);
2592    return res;
2593  }
2594
2595  protected void parseAppointmentProperties(JsonObject json, Appointment res) throws IOException, FHIRFormatError {
2596    parseDomainResourceProperties(json, res);
2597    if (json.has("identifier")) {
2598      JsonArray array = json.getAsJsonArray("identifier");
2599      for (int i = 0; i < array.size(); i++) {
2600        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2601      }
2602    };
2603    if (json.has("status"))
2604      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.AppointmentStatus.NULL, new Appointment.AppointmentStatusEnumFactory()));
2605    if (json.has("_status"))
2606      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2607    if (json.has("serviceCategory")) {
2608      JsonArray array = json.getAsJsonArray("serviceCategory");
2609      for (int i = 0; i < array.size(); i++) {
2610        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2611      }
2612    };
2613    if (json.has("serviceType")) {
2614      JsonArray array = json.getAsJsonArray("serviceType");
2615      for (int i = 0; i < array.size(); i++) {
2616        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2617      }
2618    };
2619    if (json.has("specialty")) {
2620      JsonArray array = json.getAsJsonArray("specialty");
2621      for (int i = 0; i < array.size(); i++) {
2622        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2623      }
2624    };
2625    if (json.has("appointmentType"))
2626      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
2627    if (json.has("reason")) {
2628      JsonArray array = json.getAsJsonArray("reason");
2629      for (int i = 0; i < array.size(); i++) {
2630        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2631      }
2632    };
2633    if (json.has("indication")) {
2634      JsonArray array = json.getAsJsonArray("indication");
2635      for (int i = 0; i < array.size(); i++) {
2636        res.getIndication().add(parseReference(array.get(i).getAsJsonObject()));
2637      }
2638    };
2639    if (json.has("priority"))
2640      res.setPriorityElement(parseUnsignedInt(json.get("priority").getAsString()));
2641    if (json.has("_priority"))
2642      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
2643    if (json.has("description"))
2644      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2645    if (json.has("_description"))
2646      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2647    if (json.has("supportingInformation")) {
2648      JsonArray array = json.getAsJsonArray("supportingInformation");
2649      for (int i = 0; i < array.size(); i++) {
2650        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
2651      }
2652    };
2653    if (json.has("start"))
2654      res.setStartElement(parseInstant(json.get("start").getAsString()));
2655    if (json.has("_start"))
2656      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2657    if (json.has("end"))
2658      res.setEndElement(parseInstant(json.get("end").getAsString()));
2659    if (json.has("_end"))
2660      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2661    if (json.has("minutesDuration"))
2662      res.setMinutesDurationElement(parsePositiveInt(json.get("minutesDuration").getAsString()));
2663    if (json.has("_minutesDuration"))
2664      parseElementProperties(json.getAsJsonObject("_minutesDuration"), res.getMinutesDurationElement());
2665    if (json.has("slot")) {
2666      JsonArray array = json.getAsJsonArray("slot");
2667      for (int i = 0; i < array.size(); i++) {
2668        res.getSlot().add(parseReference(array.get(i).getAsJsonObject()));
2669      }
2670    };
2671    if (json.has("created"))
2672      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
2673    if (json.has("_created"))
2674      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
2675    if (json.has("comment"))
2676      res.setCommentElement(parseString(json.get("comment").getAsString()));
2677    if (json.has("_comment"))
2678      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2679    if (json.has("patientInstruction"))
2680      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
2681    if (json.has("_patientInstruction"))
2682      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
2683    if (json.has("basedOn")) {
2684      JsonArray array = json.getAsJsonArray("basedOn");
2685      for (int i = 0; i < array.size(); i++) {
2686        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
2687      }
2688    };
2689    if (json.has("participant")) {
2690      JsonArray array = json.getAsJsonArray("participant");
2691      for (int i = 0; i < array.size(); i++) {
2692        res.getParticipant().add(parseAppointmentAppointmentParticipantComponent(array.get(i).getAsJsonObject(), res));
2693      }
2694    };
2695    if (json.has("requestedPeriod")) {
2696      JsonArray array = json.getAsJsonArray("requestedPeriod");
2697      for (int i = 0; i < array.size(); i++) {
2698        res.getRequestedPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
2699      }
2700    };
2701  }
2702
2703  protected Appointment.AppointmentParticipantComponent parseAppointmentAppointmentParticipantComponent(JsonObject json, Appointment owner) throws IOException, FHIRFormatError {
2704    Appointment.AppointmentParticipantComponent res = new Appointment.AppointmentParticipantComponent();
2705    parseAppointmentAppointmentParticipantComponentProperties(json, owner, res);
2706    return res;
2707  }
2708
2709  protected void parseAppointmentAppointmentParticipantComponentProperties(JsonObject json, Appointment owner, Appointment.AppointmentParticipantComponent res) throws IOException, FHIRFormatError {
2710    parseBackboneElementProperties(json, res);
2711    if (json.has("type")) {
2712      JsonArray array = json.getAsJsonArray("type");
2713      for (int i = 0; i < array.size(); i++) {
2714        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2715      }
2716    };
2717    if (json.has("actor"))
2718      res.setActor(parseReference(json.getAsJsonObject("actor")));
2719    if (json.has("required"))
2720      res.setRequiredElement(parseEnumeration(json.get("required").getAsString(), Appointment.ParticipantRequired.NULL, new Appointment.ParticipantRequiredEnumFactory()));
2721    if (json.has("_required"))
2722      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
2723    if (json.has("status"))
2724      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Appointment.ParticipationStatus.NULL, new Appointment.ParticipationStatusEnumFactory()));
2725    if (json.has("_status"))
2726      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
2727    if (json.has("period"))
2728      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2729  }
2730
2731  protected AppointmentResponse parseAppointmentResponse(JsonObject json) throws IOException, FHIRFormatError {
2732    AppointmentResponse res = new AppointmentResponse();
2733    parseAppointmentResponseProperties(json, res);
2734    return res;
2735  }
2736
2737  protected void parseAppointmentResponseProperties(JsonObject json, AppointmentResponse res) throws IOException, FHIRFormatError {
2738    parseDomainResourceProperties(json, res);
2739    if (json.has("identifier")) {
2740      JsonArray array = json.getAsJsonArray("identifier");
2741      for (int i = 0; i < array.size(); i++) {
2742        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2743      }
2744    };
2745    if (json.has("appointment"))
2746      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
2747    if (json.has("start"))
2748      res.setStartElement(parseInstant(json.get("start").getAsString()));
2749    if (json.has("_start"))
2750      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
2751    if (json.has("end"))
2752      res.setEndElement(parseInstant(json.get("end").getAsString()));
2753    if (json.has("_end"))
2754      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
2755    if (json.has("participantType")) {
2756      JsonArray array = json.getAsJsonArray("participantType");
2757      for (int i = 0; i < array.size(); i++) {
2758        res.getParticipantType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2759      }
2760    };
2761    if (json.has("actor"))
2762      res.setActor(parseReference(json.getAsJsonObject("actor")));
2763    if (json.has("participantStatus"))
2764      res.setParticipantStatusElement(parseEnumeration(json.get("participantStatus").getAsString(), AppointmentResponse.ParticipantStatus.NULL, new AppointmentResponse.ParticipantStatusEnumFactory()));
2765    if (json.has("_participantStatus"))
2766      parseElementProperties(json.getAsJsonObject("_participantStatus"), res.getParticipantStatusElement());
2767    if (json.has("comment"))
2768      res.setCommentElement(parseString(json.get("comment").getAsString()));
2769    if (json.has("_comment"))
2770      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
2771  }
2772
2773  protected AuditEvent parseAuditEvent(JsonObject json) throws IOException, FHIRFormatError {
2774    AuditEvent res = new AuditEvent();
2775    parseAuditEventProperties(json, res);
2776    return res;
2777  }
2778
2779  protected void parseAuditEventProperties(JsonObject json, AuditEvent res) throws IOException, FHIRFormatError {
2780    parseDomainResourceProperties(json, res);
2781    if (json.has("type"))
2782      res.setType(parseCoding(json.getAsJsonObject("type")));
2783    if (json.has("subtype")) {
2784      JsonArray array = json.getAsJsonArray("subtype");
2785      for (int i = 0; i < array.size(); i++) {
2786        res.getSubtype().add(parseCoding(array.get(i).getAsJsonObject()));
2787      }
2788    };
2789    if (json.has("action"))
2790      res.setActionElement(parseEnumeration(json.get("action").getAsString(), AuditEvent.AuditEventAction.NULL, new AuditEvent.AuditEventActionEnumFactory()));
2791    if (json.has("_action"))
2792      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
2793    if (json.has("period"))
2794      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
2795    if (json.has("recorded"))
2796      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
2797    if (json.has("_recorded"))
2798      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
2799    if (json.has("outcome"))
2800      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), AuditEvent.AuditEventOutcome.NULL, new AuditEvent.AuditEventOutcomeEnumFactory()));
2801    if (json.has("_outcome"))
2802      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
2803    if (json.has("outcomeDesc"))
2804      res.setOutcomeDescElement(parseString(json.get("outcomeDesc").getAsString()));
2805    if (json.has("_outcomeDesc"))
2806      parseElementProperties(json.getAsJsonObject("_outcomeDesc"), res.getOutcomeDescElement());
2807    if (json.has("purposeOfEvent")) {
2808      JsonArray array = json.getAsJsonArray("purposeOfEvent");
2809      for (int i = 0; i < array.size(); i++) {
2810        res.getPurposeOfEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2811      }
2812    };
2813    if (json.has("agent")) {
2814      JsonArray array = json.getAsJsonArray("agent");
2815      for (int i = 0; i < array.size(); i++) {
2816        res.getAgent().add(parseAuditEventAuditEventAgentComponent(array.get(i).getAsJsonObject(), res));
2817      }
2818    };
2819    if (json.has("source"))
2820      res.setSource(parseAuditEventAuditEventSourceComponent(json.getAsJsonObject("source"), res));
2821    if (json.has("entity")) {
2822      JsonArray array = json.getAsJsonArray("entity");
2823      for (int i = 0; i < array.size(); i++) {
2824        res.getEntity().add(parseAuditEventAuditEventEntityComponent(array.get(i).getAsJsonObject(), res));
2825      }
2826    };
2827  }
2828
2829  protected AuditEvent.AuditEventAgentComponent parseAuditEventAuditEventAgentComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2830    AuditEvent.AuditEventAgentComponent res = new AuditEvent.AuditEventAgentComponent();
2831    parseAuditEventAuditEventAgentComponentProperties(json, owner, res);
2832    return res;
2833  }
2834
2835  protected void parseAuditEventAuditEventAgentComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentComponent res) throws IOException, FHIRFormatError {
2836    parseBackboneElementProperties(json, res);
2837    if (json.has("type"))
2838      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
2839    if (json.has("role")) {
2840      JsonArray array = json.getAsJsonArray("role");
2841      for (int i = 0; i < array.size(); i++) {
2842        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2843      }
2844    };
2845    if (json.has("who"))
2846      res.setWho(parseReference(json.getAsJsonObject("who")));
2847    if (json.has("altId"))
2848      res.setAltIdElement(parseString(json.get("altId").getAsString()));
2849    if (json.has("_altId"))
2850      parseElementProperties(json.getAsJsonObject("_altId"), res.getAltIdElement());
2851    if (json.has("name"))
2852      res.setNameElement(parseString(json.get("name").getAsString()));
2853    if (json.has("_name"))
2854      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2855    if (json.has("requestor"))
2856      res.setRequestorElement(parseBoolean(json.get("requestor").getAsBoolean()));
2857    if (json.has("_requestor"))
2858      parseElementProperties(json.getAsJsonObject("_requestor"), res.getRequestorElement());
2859    if (json.has("location"))
2860      res.setLocation(parseReference(json.getAsJsonObject("location")));
2861    if (json.has("policy")) {
2862      JsonArray array = json.getAsJsonArray("policy");
2863      for (int i = 0; i < array.size(); i++) {
2864        res.getPolicy().add(parseUri(array.get(i).getAsString()));
2865      }
2866    };
2867    if (json.has("_policy")) {
2868      JsonArray array = json.getAsJsonArray("_policy");
2869      for (int i = 0; i < array.size(); i++) {
2870        if (i == res.getPolicy().size())
2871          res.getPolicy().add(parseUri(null));
2872        if (array.get(i) instanceof JsonObject) 
2873          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
2874      }
2875    };
2876    if (json.has("media"))
2877      res.setMedia(parseCoding(json.getAsJsonObject("media")));
2878    if (json.has("network"))
2879      res.setNetwork(parseAuditEventAuditEventAgentNetworkComponent(json.getAsJsonObject("network"), owner));
2880    if (json.has("purposeOfUse")) {
2881      JsonArray array = json.getAsJsonArray("purposeOfUse");
2882      for (int i = 0; i < array.size(); i++) {
2883        res.getPurposeOfUse().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
2884      }
2885    };
2886  }
2887
2888  protected AuditEvent.AuditEventAgentNetworkComponent parseAuditEventAuditEventAgentNetworkComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2889    AuditEvent.AuditEventAgentNetworkComponent res = new AuditEvent.AuditEventAgentNetworkComponent();
2890    parseAuditEventAuditEventAgentNetworkComponentProperties(json, owner, res);
2891    return res;
2892  }
2893
2894  protected void parseAuditEventAuditEventAgentNetworkComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventAgentNetworkComponent res) throws IOException, FHIRFormatError {
2895    parseBackboneElementProperties(json, res);
2896    if (json.has("address"))
2897      res.setAddressElement(parseString(json.get("address").getAsString()));
2898    if (json.has("_address"))
2899      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
2900    if (json.has("type"))
2901      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), AuditEvent.AuditEventAgentNetworkType.NULL, new AuditEvent.AuditEventAgentNetworkTypeEnumFactory()));
2902    if (json.has("_type"))
2903      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2904  }
2905
2906  protected AuditEvent.AuditEventSourceComponent parseAuditEventAuditEventSourceComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2907    AuditEvent.AuditEventSourceComponent res = new AuditEvent.AuditEventSourceComponent();
2908    parseAuditEventAuditEventSourceComponentProperties(json, owner, res);
2909    return res;
2910  }
2911
2912  protected void parseAuditEventAuditEventSourceComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventSourceComponent res) throws IOException, FHIRFormatError {
2913    parseBackboneElementProperties(json, res);
2914    if (json.has("site"))
2915      res.setSiteElement(parseString(json.get("site").getAsString()));
2916    if (json.has("_site"))
2917      parseElementProperties(json.getAsJsonObject("_site"), res.getSiteElement());
2918    if (json.has("observer"))
2919      res.setObserver(parseReference(json.getAsJsonObject("observer")));
2920    if (json.has("type")) {
2921      JsonArray array = json.getAsJsonArray("type");
2922      for (int i = 0; i < array.size(); i++) {
2923        res.getType().add(parseCoding(array.get(i).getAsJsonObject()));
2924      }
2925    };
2926  }
2927
2928  protected AuditEvent.AuditEventEntityComponent parseAuditEventAuditEventEntityComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2929    AuditEvent.AuditEventEntityComponent res = new AuditEvent.AuditEventEntityComponent();
2930    parseAuditEventAuditEventEntityComponentProperties(json, owner, res);
2931    return res;
2932  }
2933
2934  protected void parseAuditEventAuditEventEntityComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityComponent res) throws IOException, FHIRFormatError {
2935    parseBackboneElementProperties(json, res);
2936    if (json.has("what"))
2937      res.setWhat(parseReference(json.getAsJsonObject("what")));
2938    if (json.has("type"))
2939      res.setType(parseCoding(json.getAsJsonObject("type")));
2940    if (json.has("role"))
2941      res.setRole(parseCoding(json.getAsJsonObject("role")));
2942    if (json.has("lifecycle"))
2943      res.setLifecycle(parseCoding(json.getAsJsonObject("lifecycle")));
2944    if (json.has("securityLabel")) {
2945      JsonArray array = json.getAsJsonArray("securityLabel");
2946      for (int i = 0; i < array.size(); i++) {
2947        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
2948      }
2949    };
2950    if (json.has("name"))
2951      res.setNameElement(parseString(json.get("name").getAsString()));
2952    if (json.has("_name"))
2953      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
2954    if (json.has("description"))
2955      res.setDescriptionElement(parseString(json.get("description").getAsString()));
2956    if (json.has("_description"))
2957      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
2958    if (json.has("query"))
2959      res.setQueryElement(parseBase64Binary(json.get("query").getAsString()));
2960    if (json.has("_query"))
2961      parseElementProperties(json.getAsJsonObject("_query"), res.getQueryElement());
2962    if (json.has("detail")) {
2963      JsonArray array = json.getAsJsonArray("detail");
2964      for (int i = 0; i < array.size(); i++) {
2965        res.getDetail().add(parseAuditEventAuditEventEntityDetailComponent(array.get(i).getAsJsonObject(), owner));
2966      }
2967    };
2968  }
2969
2970  protected AuditEvent.AuditEventEntityDetailComponent parseAuditEventAuditEventEntityDetailComponent(JsonObject json, AuditEvent owner) throws IOException, FHIRFormatError {
2971    AuditEvent.AuditEventEntityDetailComponent res = new AuditEvent.AuditEventEntityDetailComponent();
2972    parseAuditEventAuditEventEntityDetailComponentProperties(json, owner, res);
2973    return res;
2974  }
2975
2976  protected void parseAuditEventAuditEventEntityDetailComponentProperties(JsonObject json, AuditEvent owner, AuditEvent.AuditEventEntityDetailComponent res) throws IOException, FHIRFormatError {
2977    parseBackboneElementProperties(json, res);
2978    if (json.has("type"))
2979      res.setTypeElement(parseString(json.get("type").getAsString()));
2980    if (json.has("_type"))
2981      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
2982    Type value = parseType("value", json);
2983    if (value != null)
2984      res.setValue(value);
2985  }
2986
2987  protected Basic parseBasic(JsonObject json) throws IOException, FHIRFormatError {
2988    Basic res = new Basic();
2989    parseBasicProperties(json, res);
2990    return res;
2991  }
2992
2993  protected void parseBasicProperties(JsonObject json, Basic res) throws IOException, FHIRFormatError {
2994    parseDomainResourceProperties(json, res);
2995    if (json.has("identifier")) {
2996      JsonArray array = json.getAsJsonArray("identifier");
2997      for (int i = 0; i < array.size(); i++) {
2998        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
2999      }
3000    };
3001    if (json.has("code"))
3002      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
3003    if (json.has("subject"))
3004      res.setSubject(parseReference(json.getAsJsonObject("subject")));
3005    if (json.has("created"))
3006      res.setCreatedElement(parseDate(json.get("created").getAsString()));
3007    if (json.has("_created"))
3008      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
3009    if (json.has("author"))
3010      res.setAuthor(parseReference(json.getAsJsonObject("author")));
3011  }
3012
3013  protected Binary parseBinary(JsonObject json) throws IOException, FHIRFormatError {
3014    Binary res = new Binary();
3015    parseBinaryProperties(json, res);
3016    return res;
3017  }
3018
3019  protected void parseBinaryProperties(JsonObject json, Binary res) throws IOException, FHIRFormatError {
3020    parseResourceProperties(json, res);
3021    if (json.has("contentType"))
3022      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
3023    if (json.has("_contentType"))
3024      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
3025    if (json.has("securityContext"))
3026      res.setSecurityContext(parseReference(json.getAsJsonObject("securityContext")));
3027    if (json.has("data"))
3028      res.setDataElement(parseBase64Binary(json.get("data").getAsString()));
3029    if (json.has("_data"))
3030      parseElementProperties(json.getAsJsonObject("_data"), res.getDataElement());
3031  }
3032
3033  protected BiologicallyDerivedProduct parseBiologicallyDerivedProduct(JsonObject json) throws IOException, FHIRFormatError {
3034    BiologicallyDerivedProduct res = new BiologicallyDerivedProduct();
3035    parseBiologicallyDerivedProductProperties(json, res);
3036    return res;
3037  }
3038
3039  protected void parseBiologicallyDerivedProductProperties(JsonObject json, BiologicallyDerivedProduct res) throws IOException, FHIRFormatError {
3040    parseDomainResourceProperties(json, res);
3041    if (json.has("identifier")) {
3042      JsonArray array = json.getAsJsonArray("identifier");
3043      for (int i = 0; i < array.size(); i++) {
3044        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3045      }
3046    };
3047    if (json.has("productCategory"))
3048      res.setProductCategoryElement(parseEnumeration(json.get("productCategory").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductCategory.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory()));
3049    if (json.has("_productCategory"))
3050      parseElementProperties(json.getAsJsonObject("_productCategory"), res.getProductCategoryElement());
3051    if (json.has("productCode"))
3052      res.setProductCode(parseCodeableConcept(json.getAsJsonObject("productCode")));
3053    if (json.has("status"))
3054      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStatus.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory()));
3055    if (json.has("_status"))
3056      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3057    if (json.has("request")) {
3058      JsonArray array = json.getAsJsonArray("request");
3059      for (int i = 0; i < array.size(); i++) {
3060        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
3061      }
3062    };
3063    if (json.has("quantity"))
3064      res.setQuantityElement(parseInteger(json.get("quantity").getAsLong()));
3065    if (json.has("_quantity"))
3066      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
3067    if (json.has("parent"))
3068      res.setParent(parseReference(json.getAsJsonObject("parent")));
3069    if (json.has("collection"))
3070      res.setCollection(parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(json.getAsJsonObject("collection"), res));
3071    if (json.has("processing")) {
3072      JsonArray array = json.getAsJsonArray("processing");
3073      for (int i = 0; i < array.size(); i++) {
3074        res.getProcessing().add(parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(array.get(i).getAsJsonObject(), res));
3075      }
3076    };
3077    if (json.has("manipulation"))
3078      res.setManipulation(parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(json.getAsJsonObject("manipulation"), res));
3079    if (json.has("storage")) {
3080      JsonArray array = json.getAsJsonArray("storage");
3081      for (int i = 0; i < array.size(); i++) {
3082        res.getStorage().add(parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(array.get(i).getAsJsonObject(), res));
3083      }
3084    };
3085  }
3086
3087  protected BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3088    BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent();
3089    parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(json, owner, res);
3090    return res;
3091  }
3092
3093  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent res) throws IOException, FHIRFormatError {
3094    parseBackboneElementProperties(json, res);
3095    if (json.has("collector"))
3096      res.setCollector(parseReference(json.getAsJsonObject("collector")));
3097    if (json.has("source"))
3098      res.setSource(parseReference(json.getAsJsonObject("source")));
3099    Type collected = parseType("collected", json);
3100    if (collected != null)
3101      res.setCollected(collected);
3102  }
3103
3104  protected BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3105    BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent();
3106    parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(json, owner, res);
3107    return res;
3108  }
3109
3110  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent res) throws IOException, FHIRFormatError {
3111    parseBackboneElementProperties(json, res);
3112    if (json.has("description"))
3113      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3114    if (json.has("_description"))
3115      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3116    if (json.has("procedure"))
3117      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
3118    if (json.has("additive"))
3119      res.setAdditive(parseReference(json.getAsJsonObject("additive")));
3120    Type time = parseType("time", json);
3121    if (time != null)
3122      res.setTime(time);
3123  }
3124
3125  protected BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3126    BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent();
3127    parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(json, owner, res);
3128    return res;
3129  }
3130
3131  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent res) throws IOException, FHIRFormatError {
3132    parseBackboneElementProperties(json, res);
3133    if (json.has("description"))
3134      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3135    if (json.has("_description"))
3136      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3137    Type time = parseType("time", json);
3138    if (time != null)
3139      res.setTime(time);
3140  }
3141
3142  protected BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(JsonObject json, BiologicallyDerivedProduct owner) throws IOException, FHIRFormatError {
3143    BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res = new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent();
3144    parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(json, owner, res);
3145    return res;
3146  }
3147
3148  protected void parseBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentProperties(JsonObject json, BiologicallyDerivedProduct owner, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent res) throws IOException, FHIRFormatError {
3149    parseBackboneElementProperties(json, res);
3150    if (json.has("description"))
3151      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3152    if (json.has("_description"))
3153      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3154    if (json.has("temperature"))
3155      res.setTemperatureElement(parseDecimal(json.get("temperature").getAsBigDecimal()));
3156    if (json.has("_temperature"))
3157      parseElementProperties(json.getAsJsonObject("_temperature"), res.getTemperatureElement());
3158    if (json.has("scale"))
3159      res.setScaleElement(parseEnumeration(json.get("scale").getAsString(), BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScale.NULL, new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory()));
3160    if (json.has("_scale"))
3161      parseElementProperties(json.getAsJsonObject("_scale"), res.getScaleElement());
3162    if (json.has("duration"))
3163      res.setDuration(parsePeriod(json.getAsJsonObject("duration")));
3164  }
3165
3166  protected BodyStructure parseBodyStructure(JsonObject json) throws IOException, FHIRFormatError {
3167    BodyStructure res = new BodyStructure();
3168    parseBodyStructureProperties(json, res);
3169    return res;
3170  }
3171
3172  protected void parseBodyStructureProperties(JsonObject json, BodyStructure res) throws IOException, FHIRFormatError {
3173    parseDomainResourceProperties(json, res);
3174    if (json.has("identifier")) {
3175      JsonArray array = json.getAsJsonArray("identifier");
3176      for (int i = 0; i < array.size(); i++) {
3177        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3178      }
3179    };
3180    if (json.has("active"))
3181      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
3182    if (json.has("_active"))
3183      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
3184    if (json.has("morphology"))
3185      res.setMorphology(parseCodeableConcept(json.getAsJsonObject("morphology")));
3186    if (json.has("location"))
3187      res.setLocation(parseCodeableConcept(json.getAsJsonObject("location")));
3188    if (json.has("locationQualifier")) {
3189      JsonArray array = json.getAsJsonArray("locationQualifier");
3190      for (int i = 0; i < array.size(); i++) {
3191        res.getLocationQualifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3192      }
3193    };
3194    if (json.has("description"))
3195      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3196    if (json.has("_description"))
3197      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3198    if (json.has("image")) {
3199      JsonArray array = json.getAsJsonArray("image");
3200      for (int i = 0; i < array.size(); i++) {
3201        res.getImage().add(parseAttachment(array.get(i).getAsJsonObject()));
3202      }
3203    };
3204    if (json.has("patient"))
3205      res.setPatient(parseReference(json.getAsJsonObject("patient")));
3206  }
3207
3208  protected Bundle parseBundle(JsonObject json) throws IOException, FHIRFormatError {
3209    Bundle res = new Bundle();
3210    parseBundleProperties(json, res);
3211    return res;
3212  }
3213
3214  protected void parseBundleProperties(JsonObject json, Bundle res) throws IOException, FHIRFormatError {
3215    parseResourceProperties(json, res);
3216    if (json.has("identifier"))
3217      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
3218    if (json.has("type"))
3219      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Bundle.BundleType.NULL, new Bundle.BundleTypeEnumFactory()));
3220    if (json.has("_type"))
3221      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3222    if (json.has("timestamp"))
3223      res.setTimestampElement(parseInstant(json.get("timestamp").getAsString()));
3224    if (json.has("_timestamp"))
3225      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
3226    if (json.has("total"))
3227      res.setTotalElement(parseUnsignedInt(json.get("total").getAsString()));
3228    if (json.has("_total"))
3229      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
3230    if (json.has("link")) {
3231      JsonArray array = json.getAsJsonArray("link");
3232      for (int i = 0; i < array.size(); i++) {
3233        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), res));
3234      }
3235    };
3236    if (json.has("entry")) {
3237      JsonArray array = json.getAsJsonArray("entry");
3238      for (int i = 0; i < array.size(); i++) {
3239        res.getEntry().add(parseBundleBundleEntryComponent(array.get(i).getAsJsonObject(), res));
3240      }
3241    };
3242    if (json.has("signature"))
3243      res.setSignature(parseSignature(json.getAsJsonObject("signature")));
3244  }
3245
3246  protected Bundle.BundleLinkComponent parseBundleBundleLinkComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3247    Bundle.BundleLinkComponent res = new Bundle.BundleLinkComponent();
3248    parseBundleBundleLinkComponentProperties(json, owner, res);
3249    return res;
3250  }
3251
3252  protected void parseBundleBundleLinkComponentProperties(JsonObject json, Bundle owner, Bundle.BundleLinkComponent res) throws IOException, FHIRFormatError {
3253    parseBackboneElementProperties(json, res);
3254    if (json.has("relation"))
3255      res.setRelationElement(parseString(json.get("relation").getAsString()));
3256    if (json.has("_relation"))
3257      parseElementProperties(json.getAsJsonObject("_relation"), res.getRelationElement());
3258    if (json.has("url"))
3259      res.setUrlElement(parseUri(json.get("url").getAsString()));
3260    if (json.has("_url"))
3261      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3262  }
3263
3264  protected Bundle.BundleEntryComponent parseBundleBundleEntryComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3265    Bundle.BundleEntryComponent res = new Bundle.BundleEntryComponent();
3266    parseBundleBundleEntryComponentProperties(json, owner, res);
3267    return res;
3268  }
3269
3270  protected void parseBundleBundleEntryComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryComponent res) throws IOException, FHIRFormatError {
3271    parseBackboneElementProperties(json, res);
3272    if (json.has("link")) {
3273      JsonArray array = json.getAsJsonArray("link");
3274      for (int i = 0; i < array.size(); i++) {
3275        res.getLink().add(parseBundleBundleLinkComponent(array.get(i).getAsJsonObject(), owner));
3276      }
3277    };
3278    if (json.has("fullUrl"))
3279      res.setFullUrlElement(parseUri(json.get("fullUrl").getAsString()));
3280    if (json.has("_fullUrl"))
3281      parseElementProperties(json.getAsJsonObject("_fullUrl"), res.getFullUrlElement());
3282    if (json.has("resource"))
3283      res.setResource(parseResource(json.getAsJsonObject("resource")));
3284    if (json.has("search"))
3285      res.setSearch(parseBundleBundleEntrySearchComponent(json.getAsJsonObject("search"), owner));
3286    if (json.has("request"))
3287      res.setRequest(parseBundleBundleEntryRequestComponent(json.getAsJsonObject("request"), owner));
3288    if (json.has("response"))
3289      res.setResponse(parseBundleBundleEntryResponseComponent(json.getAsJsonObject("response"), owner));
3290  }
3291
3292  protected Bundle.BundleEntrySearchComponent parseBundleBundleEntrySearchComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3293    Bundle.BundleEntrySearchComponent res = new Bundle.BundleEntrySearchComponent();
3294    parseBundleBundleEntrySearchComponentProperties(json, owner, res);
3295    return res;
3296  }
3297
3298  protected void parseBundleBundleEntrySearchComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntrySearchComponent res) throws IOException, FHIRFormatError {
3299    parseBackboneElementProperties(json, res);
3300    if (json.has("mode"))
3301      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Bundle.SearchEntryMode.NULL, new Bundle.SearchEntryModeEnumFactory()));
3302    if (json.has("_mode"))
3303      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3304    if (json.has("score"))
3305      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
3306    if (json.has("_score"))
3307      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
3308  }
3309
3310  protected Bundle.BundleEntryRequestComponent parseBundleBundleEntryRequestComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3311    Bundle.BundleEntryRequestComponent res = new Bundle.BundleEntryRequestComponent();
3312    parseBundleBundleEntryRequestComponentProperties(json, owner, res);
3313    return res;
3314  }
3315
3316  protected void parseBundleBundleEntryRequestComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryRequestComponent res) throws IOException, FHIRFormatError {
3317    parseBackboneElementProperties(json, res);
3318    if (json.has("method"))
3319      res.setMethodElement(parseEnumeration(json.get("method").getAsString(), Bundle.HTTPVerb.NULL, new Bundle.HTTPVerbEnumFactory()));
3320    if (json.has("_method"))
3321      parseElementProperties(json.getAsJsonObject("_method"), res.getMethodElement());
3322    if (json.has("url"))
3323      res.setUrlElement(parseUri(json.get("url").getAsString()));
3324    if (json.has("_url"))
3325      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3326    if (json.has("ifNoneMatch"))
3327      res.setIfNoneMatchElement(parseString(json.get("ifNoneMatch").getAsString()));
3328    if (json.has("_ifNoneMatch"))
3329      parseElementProperties(json.getAsJsonObject("_ifNoneMatch"), res.getIfNoneMatchElement());
3330    if (json.has("ifModifiedSince"))
3331      res.setIfModifiedSinceElement(parseInstant(json.get("ifModifiedSince").getAsString()));
3332    if (json.has("_ifModifiedSince"))
3333      parseElementProperties(json.getAsJsonObject("_ifModifiedSince"), res.getIfModifiedSinceElement());
3334    if (json.has("ifMatch"))
3335      res.setIfMatchElement(parseString(json.get("ifMatch").getAsString()));
3336    if (json.has("_ifMatch"))
3337      parseElementProperties(json.getAsJsonObject("_ifMatch"), res.getIfMatchElement());
3338    if (json.has("ifNoneExist"))
3339      res.setIfNoneExistElement(parseString(json.get("ifNoneExist").getAsString()));
3340    if (json.has("_ifNoneExist"))
3341      parseElementProperties(json.getAsJsonObject("_ifNoneExist"), res.getIfNoneExistElement());
3342  }
3343
3344  protected Bundle.BundleEntryResponseComponent parseBundleBundleEntryResponseComponent(JsonObject json, Bundle owner) throws IOException, FHIRFormatError {
3345    Bundle.BundleEntryResponseComponent res = new Bundle.BundleEntryResponseComponent();
3346    parseBundleBundleEntryResponseComponentProperties(json, owner, res);
3347    return res;
3348  }
3349
3350  protected void parseBundleBundleEntryResponseComponentProperties(JsonObject json, Bundle owner, Bundle.BundleEntryResponseComponent res) throws IOException, FHIRFormatError {
3351    parseBackboneElementProperties(json, res);
3352    if (json.has("status"))
3353      res.setStatusElement(parseString(json.get("status").getAsString()));
3354    if (json.has("_status"))
3355      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3356    if (json.has("location"))
3357      res.setLocationElement(parseUri(json.get("location").getAsString()));
3358    if (json.has("_location"))
3359      parseElementProperties(json.getAsJsonObject("_location"), res.getLocationElement());
3360    if (json.has("etag"))
3361      res.setEtagElement(parseString(json.get("etag").getAsString()));
3362    if (json.has("_etag"))
3363      parseElementProperties(json.getAsJsonObject("_etag"), res.getEtagElement());
3364    if (json.has("lastModified"))
3365      res.setLastModifiedElement(parseInstant(json.get("lastModified").getAsString()));
3366    if (json.has("_lastModified"))
3367      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
3368    if (json.has("outcome"))
3369      res.setOutcome(parseResource(json.getAsJsonObject("outcome")));
3370  }
3371
3372  protected CapabilityStatement parseCapabilityStatement(JsonObject json) throws IOException, FHIRFormatError {
3373    CapabilityStatement res = new CapabilityStatement();
3374    parseCapabilityStatementProperties(json, res);
3375    return res;
3376  }
3377
3378  protected void parseCapabilityStatementProperties(JsonObject json, CapabilityStatement res) throws IOException, FHIRFormatError {
3379    parseDomainResourceProperties(json, res);
3380    if (json.has("url"))
3381      res.setUrlElement(parseUri(json.get("url").getAsString()));
3382    if (json.has("_url"))
3383      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3384    if (json.has("version"))
3385      res.setVersionElement(parseString(json.get("version").getAsString()));
3386    if (json.has("_version"))
3387      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3388    if (json.has("name"))
3389      res.setNameElement(parseString(json.get("name").getAsString()));
3390    if (json.has("_name"))
3391      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3392    if (json.has("title"))
3393      res.setTitleElement(parseString(json.get("title").getAsString()));
3394    if (json.has("_title"))
3395      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
3396    if (json.has("status"))
3397      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
3398    if (json.has("_status"))
3399      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
3400    if (json.has("experimental"))
3401      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
3402    if (json.has("_experimental"))
3403      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
3404    if (json.has("date"))
3405      res.setDateElement(parseDateTime(json.get("date").getAsString()));
3406    if (json.has("_date"))
3407      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
3408    if (json.has("publisher"))
3409      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
3410    if (json.has("_publisher"))
3411      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
3412    if (json.has("contact")) {
3413      JsonArray array = json.getAsJsonArray("contact");
3414      for (int i = 0; i < array.size(); i++) {
3415        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
3416      }
3417    };
3418    if (json.has("description"))
3419      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3420    if (json.has("_description"))
3421      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3422    if (json.has("useContext")) {
3423      JsonArray array = json.getAsJsonArray("useContext");
3424      for (int i = 0; i < array.size(); i++) {
3425        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
3426      }
3427    };
3428    if (json.has("jurisdiction")) {
3429      JsonArray array = json.getAsJsonArray("jurisdiction");
3430      for (int i = 0; i < array.size(); i++) {
3431        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3432      }
3433    };
3434    if (json.has("purpose"))
3435      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
3436    if (json.has("_purpose"))
3437      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
3438    if (json.has("copyright"))
3439      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
3440    if (json.has("_copyright"))
3441      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
3442    if (json.has("kind"))
3443      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CapabilityStatement.CapabilityStatementKind.NULL, new CapabilityStatement.CapabilityStatementKindEnumFactory()));
3444    if (json.has("_kind"))
3445      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
3446    if (json.has("instantiates")) {
3447      JsonArray array = json.getAsJsonArray("instantiates");
3448      for (int i = 0; i < array.size(); i++) {
3449        res.getInstantiates().add(parseCanonical(array.get(i).getAsString()));
3450      }
3451    };
3452    if (json.has("_instantiates")) {
3453      JsonArray array = json.getAsJsonArray("_instantiates");
3454      for (int i = 0; i < array.size(); i++) {
3455        if (i == res.getInstantiates().size())
3456          res.getInstantiates().add(parseCanonical(null));
3457        if (array.get(i) instanceof JsonObject) 
3458          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
3459      }
3460    };
3461    if (json.has("imports")) {
3462      JsonArray array = json.getAsJsonArray("imports");
3463      for (int i = 0; i < array.size(); i++) {
3464        res.getImports().add(parseCanonical(array.get(i).getAsString()));
3465      }
3466    };
3467    if (json.has("_imports")) {
3468      JsonArray array = json.getAsJsonArray("_imports");
3469      for (int i = 0; i < array.size(); i++) {
3470        if (i == res.getImports().size())
3471          res.getImports().add(parseCanonical(null));
3472        if (array.get(i) instanceof JsonObject) 
3473          parseElementProperties(array.get(i).getAsJsonObject(), res.getImports().get(i));
3474      }
3475    };
3476    if (json.has("software"))
3477      res.setSoftware(parseCapabilityStatementCapabilityStatementSoftwareComponent(json.getAsJsonObject("software"), res));
3478    if (json.has("implementation"))
3479      res.setImplementation(parseCapabilityStatementCapabilityStatementImplementationComponent(json.getAsJsonObject("implementation"), res));
3480    if (json.has("fhirVersion"))
3481      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
3482    if (json.has("_fhirVersion"))
3483      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
3484    if (json.has("format")) {
3485      JsonArray array = json.getAsJsonArray("format");
3486      for (int i = 0; i < array.size(); i++) {
3487        res.getFormat().add(parseCode(array.get(i).getAsString()));
3488      }
3489    };
3490    if (json.has("_format")) {
3491      JsonArray array = json.getAsJsonArray("_format");
3492      for (int i = 0; i < array.size(); i++) {
3493        if (i == res.getFormat().size())
3494          res.getFormat().add(parseCode(null));
3495        if (array.get(i) instanceof JsonObject) 
3496          parseElementProperties(array.get(i).getAsJsonObject(), res.getFormat().get(i));
3497      }
3498    };
3499    if (json.has("patchFormat")) {
3500      JsonArray array = json.getAsJsonArray("patchFormat");
3501      for (int i = 0; i < array.size(); i++) {
3502        res.getPatchFormat().add(parseCode(array.get(i).getAsString()));
3503      }
3504    };
3505    if (json.has("_patchFormat")) {
3506      JsonArray array = json.getAsJsonArray("_patchFormat");
3507      for (int i = 0; i < array.size(); i++) {
3508        if (i == res.getPatchFormat().size())
3509          res.getPatchFormat().add(parseCode(null));
3510        if (array.get(i) instanceof JsonObject) 
3511          parseElementProperties(array.get(i).getAsJsonObject(), res.getPatchFormat().get(i));
3512      }
3513    };
3514    if (json.has("implementationGuide")) {
3515      JsonArray array = json.getAsJsonArray("implementationGuide");
3516      for (int i = 0; i < array.size(); i++) {
3517        res.getImplementationGuide().add(parseCanonical(array.get(i).getAsString()));
3518      }
3519    };
3520    if (json.has("_implementationGuide")) {
3521      JsonArray array = json.getAsJsonArray("_implementationGuide");
3522      for (int i = 0; i < array.size(); i++) {
3523        if (i == res.getImplementationGuide().size())
3524          res.getImplementationGuide().add(parseCanonical(null));
3525        if (array.get(i) instanceof JsonObject) 
3526          parseElementProperties(array.get(i).getAsJsonObject(), res.getImplementationGuide().get(i));
3527      }
3528    };
3529    if (json.has("rest")) {
3530      JsonArray array = json.getAsJsonArray("rest");
3531      for (int i = 0; i < array.size(); i++) {
3532        res.getRest().add(parseCapabilityStatementCapabilityStatementRestComponent(array.get(i).getAsJsonObject(), res));
3533      }
3534    };
3535    if (json.has("messaging")) {
3536      JsonArray array = json.getAsJsonArray("messaging");
3537      for (int i = 0; i < array.size(); i++) {
3538        res.getMessaging().add(parseCapabilityStatementCapabilityStatementMessagingComponent(array.get(i).getAsJsonObject(), res));
3539      }
3540    };
3541    if (json.has("document")) {
3542      JsonArray array = json.getAsJsonArray("document");
3543      for (int i = 0; i < array.size(); i++) {
3544        res.getDocument().add(parseCapabilityStatementCapabilityStatementDocumentComponent(array.get(i).getAsJsonObject(), res));
3545      }
3546    };
3547  }
3548
3549  protected CapabilityStatement.CapabilityStatementSoftwareComponent parseCapabilityStatementCapabilityStatementSoftwareComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3550    CapabilityStatement.CapabilityStatementSoftwareComponent res = new CapabilityStatement.CapabilityStatementSoftwareComponent();
3551    parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(json, owner, res);
3552    return res;
3553  }
3554
3555  protected void parseCapabilityStatementCapabilityStatementSoftwareComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementSoftwareComponent res) throws IOException, FHIRFormatError {
3556    parseBackboneElementProperties(json, res);
3557    if (json.has("name"))
3558      res.setNameElement(parseString(json.get("name").getAsString()));
3559    if (json.has("_name"))
3560      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3561    if (json.has("version"))
3562      res.setVersionElement(parseString(json.get("version").getAsString()));
3563    if (json.has("_version"))
3564      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
3565    if (json.has("releaseDate"))
3566      res.setReleaseDateElement(parseDateTime(json.get("releaseDate").getAsString()));
3567    if (json.has("_releaseDate"))
3568      parseElementProperties(json.getAsJsonObject("_releaseDate"), res.getReleaseDateElement());
3569  }
3570
3571  protected CapabilityStatement.CapabilityStatementImplementationComponent parseCapabilityStatementCapabilityStatementImplementationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3572    CapabilityStatement.CapabilityStatementImplementationComponent res = new CapabilityStatement.CapabilityStatementImplementationComponent();
3573    parseCapabilityStatementCapabilityStatementImplementationComponentProperties(json, owner, res);
3574    return res;
3575  }
3576
3577  protected void parseCapabilityStatementCapabilityStatementImplementationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementImplementationComponent res) throws IOException, FHIRFormatError {
3578    parseBackboneElementProperties(json, res);
3579    if (json.has("description"))
3580      res.setDescriptionElement(parseString(json.get("description").getAsString()));
3581    if (json.has("_description"))
3582      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3583    if (json.has("url"))
3584      res.setUrlElement(parseUrl(json.get("url").getAsString()));
3585    if (json.has("_url"))
3586      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
3587    if (json.has("custodian"))
3588      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
3589  }
3590
3591  protected CapabilityStatement.CapabilityStatementRestComponent parseCapabilityStatementCapabilityStatementRestComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3592    CapabilityStatement.CapabilityStatementRestComponent res = new CapabilityStatement.CapabilityStatementRestComponent();
3593    parseCapabilityStatementCapabilityStatementRestComponentProperties(json, owner, res);
3594    return res;
3595  }
3596
3597  protected void parseCapabilityStatementCapabilityStatementRestComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestComponent res) throws IOException, FHIRFormatError {
3598    parseBackboneElementProperties(json, res);
3599    if (json.has("mode"))
3600      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.RestfulCapabilityMode.NULL, new CapabilityStatement.RestfulCapabilityModeEnumFactory()));
3601    if (json.has("_mode"))
3602      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3603    if (json.has("documentation"))
3604      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3605    if (json.has("_documentation"))
3606      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3607    if (json.has("security"))
3608      res.setSecurity(parseCapabilityStatementCapabilityStatementRestSecurityComponent(json.getAsJsonObject("security"), owner));
3609    if (json.has("resource")) {
3610      JsonArray array = json.getAsJsonArray("resource");
3611      for (int i = 0; i < array.size(); i++) {
3612        res.getResource().add(parseCapabilityStatementCapabilityStatementRestResourceComponent(array.get(i).getAsJsonObject(), owner));
3613      }
3614    };
3615    if (json.has("interaction")) {
3616      JsonArray array = json.getAsJsonArray("interaction");
3617      for (int i = 0; i < array.size(); i++) {
3618        res.getInteraction().add(parseCapabilityStatementSystemInteractionComponent(array.get(i).getAsJsonObject(), owner));
3619      }
3620    };
3621    if (json.has("searchParam")) {
3622      JsonArray array = json.getAsJsonArray("searchParam");
3623      for (int i = 0; i < array.size(); i++) {
3624        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3625      }
3626    };
3627    if (json.has("operation")) {
3628      JsonArray array = json.getAsJsonArray("operation");
3629      for (int i = 0; i < array.size(); i++) {
3630        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3631      }
3632    };
3633    if (json.has("compartment")) {
3634      JsonArray array = json.getAsJsonArray("compartment");
3635      for (int i = 0; i < array.size(); i++) {
3636        res.getCompartment().add(parseCanonical(array.get(i).getAsString()));
3637      }
3638    };
3639    if (json.has("_compartment")) {
3640      JsonArray array = json.getAsJsonArray("_compartment");
3641      for (int i = 0; i < array.size(); i++) {
3642        if (i == res.getCompartment().size())
3643          res.getCompartment().add(parseCanonical(null));
3644        if (array.get(i) instanceof JsonObject) 
3645          parseElementProperties(array.get(i).getAsJsonObject(), res.getCompartment().get(i));
3646      }
3647    };
3648  }
3649
3650  protected CapabilityStatement.CapabilityStatementRestSecurityComponent parseCapabilityStatementCapabilityStatementRestSecurityComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3651    CapabilityStatement.CapabilityStatementRestSecurityComponent res = new CapabilityStatement.CapabilityStatementRestSecurityComponent();
3652    parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(json, owner, res);
3653    return res;
3654  }
3655
3656  protected void parseCapabilityStatementCapabilityStatementRestSecurityComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestSecurityComponent res) throws IOException, FHIRFormatError {
3657    parseBackboneElementProperties(json, res);
3658    if (json.has("cors"))
3659      res.setCorsElement(parseBoolean(json.get("cors").getAsBoolean()));
3660    if (json.has("_cors"))
3661      parseElementProperties(json.getAsJsonObject("_cors"), res.getCorsElement());
3662    if (json.has("service")) {
3663      JsonArray array = json.getAsJsonArray("service");
3664      for (int i = 0; i < array.size(); i++) {
3665        res.getService().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
3666      }
3667    };
3668    if (json.has("description"))
3669      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
3670    if (json.has("_description"))
3671      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
3672  }
3673
3674  protected CapabilityStatement.CapabilityStatementRestResourceComponent parseCapabilityStatementCapabilityStatementRestResourceComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3675    CapabilityStatement.CapabilityStatementRestResourceComponent res = new CapabilityStatement.CapabilityStatementRestResourceComponent();
3676    parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(json, owner, res);
3677    return res;
3678  }
3679
3680  protected void parseCapabilityStatementCapabilityStatementRestResourceComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceComponent res) throws IOException, FHIRFormatError {
3681    parseBackboneElementProperties(json, res);
3682    if (json.has("type"))
3683      res.setTypeElement(parseCode(json.get("type").getAsString()));
3684    if (json.has("_type"))
3685      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3686    if (json.has("profile"))
3687      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3688    if (json.has("_profile"))
3689      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
3690    if (json.has("supportedProfile")) {
3691      JsonArray array = json.getAsJsonArray("supportedProfile");
3692      for (int i = 0; i < array.size(); i++) {
3693        res.getSupportedProfile().add(parseCanonical(array.get(i).getAsString()));
3694      }
3695    };
3696    if (json.has("_supportedProfile")) {
3697      JsonArray array = json.getAsJsonArray("_supportedProfile");
3698      for (int i = 0; i < array.size(); i++) {
3699        if (i == res.getSupportedProfile().size())
3700          res.getSupportedProfile().add(parseCanonical(null));
3701        if (array.get(i) instanceof JsonObject) 
3702          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportedProfile().get(i));
3703      }
3704    };
3705    if (json.has("documentation"))
3706      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3707    if (json.has("_documentation"))
3708      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3709    if (json.has("interaction")) {
3710      JsonArray array = json.getAsJsonArray("interaction");
3711      for (int i = 0; i < array.size(); i++) {
3712        res.getInteraction().add(parseCapabilityStatementResourceInteractionComponent(array.get(i).getAsJsonObject(), owner));
3713      }
3714    };
3715    if (json.has("versioning"))
3716      res.setVersioningElement(parseEnumeration(json.get("versioning").getAsString(), CapabilityStatement.ResourceVersionPolicy.NULL, new CapabilityStatement.ResourceVersionPolicyEnumFactory()));
3717    if (json.has("_versioning"))
3718      parseElementProperties(json.getAsJsonObject("_versioning"), res.getVersioningElement());
3719    if (json.has("readHistory"))
3720      res.setReadHistoryElement(parseBoolean(json.get("readHistory").getAsBoolean()));
3721    if (json.has("_readHistory"))
3722      parseElementProperties(json.getAsJsonObject("_readHistory"), res.getReadHistoryElement());
3723    if (json.has("updateCreate"))
3724      res.setUpdateCreateElement(parseBoolean(json.get("updateCreate").getAsBoolean()));
3725    if (json.has("_updateCreate"))
3726      parseElementProperties(json.getAsJsonObject("_updateCreate"), res.getUpdateCreateElement());
3727    if (json.has("conditionalCreate"))
3728      res.setConditionalCreateElement(parseBoolean(json.get("conditionalCreate").getAsBoolean()));
3729    if (json.has("_conditionalCreate"))
3730      parseElementProperties(json.getAsJsonObject("_conditionalCreate"), res.getConditionalCreateElement());
3731    if (json.has("conditionalRead"))
3732      res.setConditionalReadElement(parseEnumeration(json.get("conditionalRead").getAsString(), CapabilityStatement.ConditionalReadStatus.NULL, new CapabilityStatement.ConditionalReadStatusEnumFactory()));
3733    if (json.has("_conditionalRead"))
3734      parseElementProperties(json.getAsJsonObject("_conditionalRead"), res.getConditionalReadElement());
3735    if (json.has("conditionalUpdate"))
3736      res.setConditionalUpdateElement(parseBoolean(json.get("conditionalUpdate").getAsBoolean()));
3737    if (json.has("_conditionalUpdate"))
3738      parseElementProperties(json.getAsJsonObject("_conditionalUpdate"), res.getConditionalUpdateElement());
3739    if (json.has("conditionalDelete"))
3740      res.setConditionalDeleteElement(parseEnumeration(json.get("conditionalDelete").getAsString(), CapabilityStatement.ConditionalDeleteStatus.NULL, new CapabilityStatement.ConditionalDeleteStatusEnumFactory()));
3741    if (json.has("_conditionalDelete"))
3742      parseElementProperties(json.getAsJsonObject("_conditionalDelete"), res.getConditionalDeleteElement());
3743    if (json.has("referencePolicy")) {
3744      JsonArray array = json.getAsJsonArray("referencePolicy");
3745      for (int i = 0; i < array.size(); i++) {
3746        res.getReferencePolicy().add(parseEnumeration(array.get(i).getAsString(), CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3747      }
3748    };
3749    if (json.has("_referencePolicy")) {
3750      JsonArray array = json.getAsJsonArray("_referencePolicy");
3751      for (int i = 0; i < array.size(); i++) {
3752        if (i == res.getReferencePolicy().size())
3753          res.getReferencePolicy().add(parseEnumeration(null, CapabilityStatement.ReferenceHandlingPolicy.NULL, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory()));
3754        if (array.get(i) instanceof JsonObject) 
3755          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferencePolicy().get(i));
3756      }
3757    };
3758    if (json.has("searchInclude")) {
3759      JsonArray array = json.getAsJsonArray("searchInclude");
3760      for (int i = 0; i < array.size(); i++) {
3761        res.getSearchInclude().add(parseString(array.get(i).getAsString()));
3762      }
3763    };
3764    if (json.has("_searchInclude")) {
3765      JsonArray array = json.getAsJsonArray("_searchInclude");
3766      for (int i = 0; i < array.size(); i++) {
3767        if (i == res.getSearchInclude().size())
3768          res.getSearchInclude().add(parseString(null));
3769        if (array.get(i) instanceof JsonObject) 
3770          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchInclude().get(i));
3771      }
3772    };
3773    if (json.has("searchRevInclude")) {
3774      JsonArray array = json.getAsJsonArray("searchRevInclude");
3775      for (int i = 0; i < array.size(); i++) {
3776        res.getSearchRevInclude().add(parseString(array.get(i).getAsString()));
3777      }
3778    };
3779    if (json.has("_searchRevInclude")) {
3780      JsonArray array = json.getAsJsonArray("_searchRevInclude");
3781      for (int i = 0; i < array.size(); i++) {
3782        if (i == res.getSearchRevInclude().size())
3783          res.getSearchRevInclude().add(parseString(null));
3784        if (array.get(i) instanceof JsonObject) 
3785          parseElementProperties(array.get(i).getAsJsonObject(), res.getSearchRevInclude().get(i));
3786      }
3787    };
3788    if (json.has("searchParam")) {
3789      JsonArray array = json.getAsJsonArray("searchParam");
3790      for (int i = 0; i < array.size(); i++) {
3791        res.getSearchParam().add(parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(array.get(i).getAsJsonObject(), owner));
3792      }
3793    };
3794    if (json.has("operation")) {
3795      JsonArray array = json.getAsJsonArray("operation");
3796      for (int i = 0; i < array.size(); i++) {
3797        res.getOperation().add(parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(array.get(i).getAsJsonObject(), owner));
3798      }
3799    };
3800  }
3801
3802  protected CapabilityStatement.ResourceInteractionComponent parseCapabilityStatementResourceInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3803    CapabilityStatement.ResourceInteractionComponent res = new CapabilityStatement.ResourceInteractionComponent();
3804    parseCapabilityStatementResourceInteractionComponentProperties(json, owner, res);
3805    return res;
3806  }
3807
3808  protected void parseCapabilityStatementResourceInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.ResourceInteractionComponent res) throws IOException, FHIRFormatError {
3809    parseBackboneElementProperties(json, res);
3810    if (json.has("code"))
3811      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.TypeRestfulInteraction.NULL, new CapabilityStatement.TypeRestfulInteractionEnumFactory()));
3812    if (json.has("_code"))
3813      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3814    if (json.has("documentation"))
3815      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3816    if (json.has("_documentation"))
3817      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3818  }
3819
3820  protected CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3821    CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res = new CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
3822    parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(json, owner, res);
3823    return res;
3824  }
3825
3826  protected void parseCapabilityStatementCapabilityStatementRestResourceSearchParamComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent res) throws IOException, FHIRFormatError {
3827    parseBackboneElementProperties(json, res);
3828    if (json.has("name"))
3829      res.setNameElement(parseString(json.get("name").getAsString()));
3830    if (json.has("_name"))
3831      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3832    if (json.has("definition"))
3833      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3834    if (json.has("_definition"))
3835      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3836    if (json.has("type"))
3837      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
3838    if (json.has("_type"))
3839      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
3840    if (json.has("documentation"))
3841      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3842    if (json.has("_documentation"))
3843      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3844  }
3845
3846  protected CapabilityStatement.CapabilityStatementRestResourceOperationComponent parseCapabilityStatementCapabilityStatementRestResourceOperationComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3847    CapabilityStatement.CapabilityStatementRestResourceOperationComponent res = new CapabilityStatement.CapabilityStatementRestResourceOperationComponent();
3848    parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(json, owner, res);
3849    return res;
3850  }
3851
3852  protected void parseCapabilityStatementCapabilityStatementRestResourceOperationComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementRestResourceOperationComponent res) throws IOException, FHIRFormatError {
3853    parseBackboneElementProperties(json, res);
3854    if (json.has("name"))
3855      res.setNameElement(parseString(json.get("name").getAsString()));
3856    if (json.has("_name"))
3857      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
3858    if (json.has("definition"))
3859      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3860    if (json.has("_definition"))
3861      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3862    if (json.has("documentation"))
3863      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3864    if (json.has("_documentation"))
3865      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3866  }
3867
3868  protected CapabilityStatement.SystemInteractionComponent parseCapabilityStatementSystemInteractionComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3869    CapabilityStatement.SystemInteractionComponent res = new CapabilityStatement.SystemInteractionComponent();
3870    parseCapabilityStatementSystemInteractionComponentProperties(json, owner, res);
3871    return res;
3872  }
3873
3874  protected void parseCapabilityStatementSystemInteractionComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.SystemInteractionComponent res) throws IOException, FHIRFormatError {
3875    parseBackboneElementProperties(json, res);
3876    if (json.has("code"))
3877      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CapabilityStatement.SystemRestfulInteraction.NULL, new CapabilityStatement.SystemRestfulInteractionEnumFactory()));
3878    if (json.has("_code"))
3879      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
3880    if (json.has("documentation"))
3881      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3882    if (json.has("_documentation"))
3883      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3884  }
3885
3886  protected CapabilityStatement.CapabilityStatementMessagingComponent parseCapabilityStatementCapabilityStatementMessagingComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3887    CapabilityStatement.CapabilityStatementMessagingComponent res = new CapabilityStatement.CapabilityStatementMessagingComponent();
3888    parseCapabilityStatementCapabilityStatementMessagingComponentProperties(json, owner, res);
3889    return res;
3890  }
3891
3892  protected void parseCapabilityStatementCapabilityStatementMessagingComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingComponent res) throws IOException, FHIRFormatError {
3893    parseBackboneElementProperties(json, res);
3894    if (json.has("endpoint")) {
3895      JsonArray array = json.getAsJsonArray("endpoint");
3896      for (int i = 0; i < array.size(); i++) {
3897        res.getEndpoint().add(parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(array.get(i).getAsJsonObject(), owner));
3898      }
3899    };
3900    if (json.has("reliableCache"))
3901      res.setReliableCacheElement(parseUnsignedInt(json.get("reliableCache").getAsString()));
3902    if (json.has("_reliableCache"))
3903      parseElementProperties(json.getAsJsonObject("_reliableCache"), res.getReliableCacheElement());
3904    if (json.has("documentation"))
3905      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3906    if (json.has("_documentation"))
3907      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3908    if (json.has("supportedMessage")) {
3909      JsonArray array = json.getAsJsonArray("supportedMessage");
3910      for (int i = 0; i < array.size(); i++) {
3911        res.getSupportedMessage().add(parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(array.get(i).getAsJsonObject(), owner));
3912      }
3913    };
3914  }
3915
3916  protected CapabilityStatement.CapabilityStatementMessagingEndpointComponent parseCapabilityStatementCapabilityStatementMessagingEndpointComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3917    CapabilityStatement.CapabilityStatementMessagingEndpointComponent res = new CapabilityStatement.CapabilityStatementMessagingEndpointComponent();
3918    parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(json, owner, res);
3919    return res;
3920  }
3921
3922  protected void parseCapabilityStatementCapabilityStatementMessagingEndpointComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingEndpointComponent res) throws IOException, FHIRFormatError {
3923    parseBackboneElementProperties(json, res);
3924    if (json.has("protocol"))
3925      res.setProtocol(parseCoding(json.getAsJsonObject("protocol")));
3926    if (json.has("address"))
3927      res.setAddressElement(parseUrl(json.get("address").getAsString()));
3928    if (json.has("_address"))
3929      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
3930  }
3931
3932  protected CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3933    CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res = new CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent();
3934    parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(json, owner, res);
3935    return res;
3936  }
3937
3938  protected void parseCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent res) throws IOException, FHIRFormatError {
3939    parseBackboneElementProperties(json, res);
3940    if (json.has("mode"))
3941      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.EventCapabilityMode.NULL, new CapabilityStatement.EventCapabilityModeEnumFactory()));
3942    if (json.has("_mode"))
3943      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3944    if (json.has("definition"))
3945      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
3946    if (json.has("_definition"))
3947      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
3948  }
3949
3950  protected CapabilityStatement.CapabilityStatementDocumentComponent parseCapabilityStatementCapabilityStatementDocumentComponent(JsonObject json, CapabilityStatement owner) throws IOException, FHIRFormatError {
3951    CapabilityStatement.CapabilityStatementDocumentComponent res = new CapabilityStatement.CapabilityStatementDocumentComponent();
3952    parseCapabilityStatementCapabilityStatementDocumentComponentProperties(json, owner, res);
3953    return res;
3954  }
3955
3956  protected void parseCapabilityStatementCapabilityStatementDocumentComponentProperties(JsonObject json, CapabilityStatement owner, CapabilityStatement.CapabilityStatementDocumentComponent res) throws IOException, FHIRFormatError {
3957    parseBackboneElementProperties(json, res);
3958    if (json.has("mode"))
3959      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), CapabilityStatement.DocumentMode.NULL, new CapabilityStatement.DocumentModeEnumFactory()));
3960    if (json.has("_mode"))
3961      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
3962    if (json.has("documentation"))
3963      res.setDocumentationElement(parseMarkdown(json.get("documentation").getAsString()));
3964    if (json.has("_documentation"))
3965      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
3966    if (json.has("profile"))
3967      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
3968    if (json.has("_profile"))
3969      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
3970  }
3971
3972  protected CarePlan parseCarePlan(JsonObject json) throws IOException, FHIRFormatError {
3973    CarePlan res = new CarePlan();
3974    parseCarePlanProperties(json, res);
3975    return res;
3976  }
3977
3978  protected void parseCarePlanProperties(JsonObject json, CarePlan res) throws IOException, FHIRFormatError {
3979    parseDomainResourceProperties(json, res);
3980    if (json.has("identifier")) {
3981      JsonArray array = json.getAsJsonArray("identifier");
3982      for (int i = 0; i < array.size(); i++) {
3983        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
3984      }
3985    };
3986    if (json.has("instantiatesCanonical")) {
3987      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
3988      for (int i = 0; i < array.size(); i++) {
3989        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
3990      }
3991    };
3992    if (json.has("_instantiatesCanonical")) {
3993      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
3994      for (int i = 0; i < array.size(); i++) {
3995        if (i == res.getInstantiatesCanonical().size())
3996          res.getInstantiatesCanonical().add(parseCanonical(null));
3997        if (array.get(i) instanceof JsonObject) 
3998          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
3999      }
4000    };
4001    if (json.has("instantiatesUri")) {
4002      JsonArray array = json.getAsJsonArray("instantiatesUri");
4003      for (int i = 0; i < array.size(); i++) {
4004        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4005      }
4006    };
4007    if (json.has("_instantiatesUri")) {
4008      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4009      for (int i = 0; i < array.size(); i++) {
4010        if (i == res.getInstantiatesUri().size())
4011          res.getInstantiatesUri().add(parseUri(null));
4012        if (array.get(i) instanceof JsonObject) 
4013          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4014      }
4015    };
4016    if (json.has("basedOn")) {
4017      JsonArray array = json.getAsJsonArray("basedOn");
4018      for (int i = 0; i < array.size(); i++) {
4019        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
4020      }
4021    };
4022    if (json.has("replaces")) {
4023      JsonArray array = json.getAsJsonArray("replaces");
4024      for (int i = 0; i < array.size(); i++) {
4025        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
4026      }
4027    };
4028    if (json.has("partOf")) {
4029      JsonArray array = json.getAsJsonArray("partOf");
4030      for (int i = 0; i < array.size(); i++) {
4031        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4032      }
4033    };
4034    if (json.has("status"))
4035      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanStatus.NULL, new CarePlan.CarePlanStatusEnumFactory()));
4036    if (json.has("_status"))
4037      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4038    if (json.has("intent"))
4039      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), CarePlan.CarePlanIntent.NULL, new CarePlan.CarePlanIntentEnumFactory()));
4040    if (json.has("_intent"))
4041      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
4042    if (json.has("category")) {
4043      JsonArray array = json.getAsJsonArray("category");
4044      for (int i = 0; i < array.size(); i++) {
4045        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4046      }
4047    };
4048    if (json.has("title"))
4049      res.setTitleElement(parseString(json.get("title").getAsString()));
4050    if (json.has("_title"))
4051      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4052    if (json.has("description"))
4053      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4054    if (json.has("_description"))
4055      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4056    if (json.has("subject"))
4057      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4058    if (json.has("context"))
4059      res.setContext(parseReference(json.getAsJsonObject("context")));
4060    if (json.has("period"))
4061      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4062    if (json.has("created"))
4063      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4064    if (json.has("_created"))
4065      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4066    if (json.has("author"))
4067      res.setAuthor(parseReference(json.getAsJsonObject("author")));
4068    if (json.has("contributor")) {
4069      JsonArray array = json.getAsJsonArray("contributor");
4070      for (int i = 0; i < array.size(); i++) {
4071        res.getContributor().add(parseReference(array.get(i).getAsJsonObject()));
4072      }
4073    };
4074    if (json.has("careTeam")) {
4075      JsonArray array = json.getAsJsonArray("careTeam");
4076      for (int i = 0; i < array.size(); i++) {
4077        res.getCareTeam().add(parseReference(array.get(i).getAsJsonObject()));
4078      }
4079    };
4080    if (json.has("addresses")) {
4081      JsonArray array = json.getAsJsonArray("addresses");
4082      for (int i = 0; i < array.size(); i++) {
4083        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
4084      }
4085    };
4086    if (json.has("supportingInfo")) {
4087      JsonArray array = json.getAsJsonArray("supportingInfo");
4088      for (int i = 0; i < array.size(); i++) {
4089        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
4090      }
4091    };
4092    if (json.has("goal")) {
4093      JsonArray array = json.getAsJsonArray("goal");
4094      for (int i = 0; i < array.size(); i++) {
4095        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4096      }
4097    };
4098    if (json.has("activity")) {
4099      JsonArray array = json.getAsJsonArray("activity");
4100      for (int i = 0; i < array.size(); i++) {
4101        res.getActivity().add(parseCarePlanCarePlanActivityComponent(array.get(i).getAsJsonObject(), res));
4102      }
4103    };
4104    if (json.has("note")) {
4105      JsonArray array = json.getAsJsonArray("note");
4106      for (int i = 0; i < array.size(); i++) {
4107        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4108      }
4109    };
4110  }
4111
4112  protected CarePlan.CarePlanActivityComponent parseCarePlanCarePlanActivityComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4113    CarePlan.CarePlanActivityComponent res = new CarePlan.CarePlanActivityComponent();
4114    parseCarePlanCarePlanActivityComponentProperties(json, owner, res);
4115    return res;
4116  }
4117
4118  protected void parseCarePlanCarePlanActivityComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityComponent res) throws IOException, FHIRFormatError {
4119    parseBackboneElementProperties(json, res);
4120    if (json.has("outcomeCodeableConcept")) {
4121      JsonArray array = json.getAsJsonArray("outcomeCodeableConcept");
4122      for (int i = 0; i < array.size(); i++) {
4123        res.getOutcomeCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4124      }
4125    };
4126    if (json.has("outcomeReference")) {
4127      JsonArray array = json.getAsJsonArray("outcomeReference");
4128      for (int i = 0; i < array.size(); i++) {
4129        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
4130      }
4131    };
4132    if (json.has("progress")) {
4133      JsonArray array = json.getAsJsonArray("progress");
4134      for (int i = 0; i < array.size(); i++) {
4135        res.getProgress().add(parseAnnotation(array.get(i).getAsJsonObject()));
4136      }
4137    };
4138    if (json.has("reference"))
4139      res.setReference(parseReference(json.getAsJsonObject("reference")));
4140    if (json.has("detail"))
4141      res.setDetail(parseCarePlanCarePlanActivityDetailComponent(json.getAsJsonObject("detail"), owner));
4142  }
4143
4144  protected CarePlan.CarePlanActivityDetailComponent parseCarePlanCarePlanActivityDetailComponent(JsonObject json, CarePlan owner) throws IOException, FHIRFormatError {
4145    CarePlan.CarePlanActivityDetailComponent res = new CarePlan.CarePlanActivityDetailComponent();
4146    parseCarePlanCarePlanActivityDetailComponentProperties(json, owner, res);
4147    return res;
4148  }
4149
4150  protected void parseCarePlanCarePlanActivityDetailComponentProperties(JsonObject json, CarePlan owner, CarePlan.CarePlanActivityDetailComponent res) throws IOException, FHIRFormatError {
4151    parseBackboneElementProperties(json, res);
4152    if (json.has("kind"))
4153      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), CarePlan.CarePlanActivityKind.NULL, new CarePlan.CarePlanActivityKindEnumFactory()));
4154    if (json.has("_kind"))
4155      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
4156    if (json.has("instantiatesCanonical")) {
4157      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
4158      for (int i = 0; i < array.size(); i++) {
4159        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
4160      }
4161    };
4162    if (json.has("_instantiatesCanonical")) {
4163      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
4164      for (int i = 0; i < array.size(); i++) {
4165        if (i == res.getInstantiatesCanonical().size())
4166          res.getInstantiatesCanonical().add(parseCanonical(null));
4167        if (array.get(i) instanceof JsonObject) 
4168          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
4169      }
4170    };
4171    if (json.has("instantiatesUri")) {
4172      JsonArray array = json.getAsJsonArray("instantiatesUri");
4173      for (int i = 0; i < array.size(); i++) {
4174        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
4175      }
4176    };
4177    if (json.has("_instantiatesUri")) {
4178      JsonArray array = json.getAsJsonArray("_instantiatesUri");
4179      for (int i = 0; i < array.size(); i++) {
4180        if (i == res.getInstantiatesUri().size())
4181          res.getInstantiatesUri().add(parseUri(null));
4182        if (array.get(i) instanceof JsonObject) 
4183          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
4184      }
4185    };
4186    if (json.has("code"))
4187      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4188    if (json.has("reasonCode")) {
4189      JsonArray array = json.getAsJsonArray("reasonCode");
4190      for (int i = 0; i < array.size(); i++) {
4191        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4192      }
4193    };
4194    if (json.has("reasonReference")) {
4195      JsonArray array = json.getAsJsonArray("reasonReference");
4196      for (int i = 0; i < array.size(); i++) {
4197        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4198      }
4199    };
4200    if (json.has("goal")) {
4201      JsonArray array = json.getAsJsonArray("goal");
4202      for (int i = 0; i < array.size(); i++) {
4203        res.getGoal().add(parseReference(array.get(i).getAsJsonObject()));
4204      }
4205    };
4206    if (json.has("status"))
4207      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CarePlan.CarePlanActivityStatus.NULL, new CarePlan.CarePlanActivityStatusEnumFactory()));
4208    if (json.has("_status"))
4209      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4210    if (json.has("statusReason"))
4211      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
4212    if (json.has("doNotPerform"))
4213      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
4214    if (json.has("_doNotPerform"))
4215      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
4216    Type scheduled = parseType("scheduled", json);
4217    if (scheduled != null)
4218      res.setScheduled(scheduled);
4219    if (json.has("location"))
4220      res.setLocation(parseReference(json.getAsJsonObject("location")));
4221    if (json.has("performer")) {
4222      JsonArray array = json.getAsJsonArray("performer");
4223      for (int i = 0; i < array.size(); i++) {
4224        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
4225      }
4226    };
4227    Type product = parseType("product", json);
4228    if (product != null)
4229      res.setProduct(product);
4230    if (json.has("dailyAmount"))
4231      res.setDailyAmount(parseQuantity(json.getAsJsonObject("dailyAmount")));
4232    if (json.has("quantity"))
4233      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
4234    if (json.has("description"))
4235      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4236    if (json.has("_description"))
4237      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4238  }
4239
4240  protected CareTeam parseCareTeam(JsonObject json) throws IOException, FHIRFormatError {
4241    CareTeam res = new CareTeam();
4242    parseCareTeamProperties(json, res);
4243    return res;
4244  }
4245
4246  protected void parseCareTeamProperties(JsonObject json, CareTeam res) throws IOException, FHIRFormatError {
4247    parseDomainResourceProperties(json, res);
4248    if (json.has("identifier")) {
4249      JsonArray array = json.getAsJsonArray("identifier");
4250      for (int i = 0; i < array.size(); i++) {
4251        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4252      }
4253    };
4254    if (json.has("status"))
4255      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CareTeam.CareTeamStatus.NULL, new CareTeam.CareTeamStatusEnumFactory()));
4256    if (json.has("_status"))
4257      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4258    if (json.has("category")) {
4259      JsonArray array = json.getAsJsonArray("category");
4260      for (int i = 0; i < array.size(); i++) {
4261        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4262      }
4263    };
4264    if (json.has("name"))
4265      res.setNameElement(parseString(json.get("name").getAsString()));
4266    if (json.has("_name"))
4267      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
4268    if (json.has("subject"))
4269      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4270    if (json.has("context"))
4271      res.setContext(parseReference(json.getAsJsonObject("context")));
4272    if (json.has("period"))
4273      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4274    if (json.has("participant")) {
4275      JsonArray array = json.getAsJsonArray("participant");
4276      for (int i = 0; i < array.size(); i++) {
4277        res.getParticipant().add(parseCareTeamCareTeamParticipantComponent(array.get(i).getAsJsonObject(), res));
4278      }
4279    };
4280    if (json.has("reasonCode")) {
4281      JsonArray array = json.getAsJsonArray("reasonCode");
4282      for (int i = 0; i < array.size(); i++) {
4283        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4284      }
4285    };
4286    if (json.has("reasonReference")) {
4287      JsonArray array = json.getAsJsonArray("reasonReference");
4288      for (int i = 0; i < array.size(); i++) {
4289        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
4290      }
4291    };
4292    if (json.has("managingOrganization")) {
4293      JsonArray array = json.getAsJsonArray("managingOrganization");
4294      for (int i = 0; i < array.size(); i++) {
4295        res.getManagingOrganization().add(parseReference(array.get(i).getAsJsonObject()));
4296      }
4297    };
4298    if (json.has("telecom")) {
4299      JsonArray array = json.getAsJsonArray("telecom");
4300      for (int i = 0; i < array.size(); i++) {
4301        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
4302      }
4303    };
4304    if (json.has("note")) {
4305      JsonArray array = json.getAsJsonArray("note");
4306      for (int i = 0; i < array.size(); i++) {
4307        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4308      }
4309    };
4310  }
4311
4312  protected CareTeam.CareTeamParticipantComponent parseCareTeamCareTeamParticipantComponent(JsonObject json, CareTeam owner) throws IOException, FHIRFormatError {
4313    CareTeam.CareTeamParticipantComponent res = new CareTeam.CareTeamParticipantComponent();
4314    parseCareTeamCareTeamParticipantComponentProperties(json, owner, res);
4315    return res;
4316  }
4317
4318  protected void parseCareTeamCareTeamParticipantComponentProperties(JsonObject json, CareTeam owner, CareTeam.CareTeamParticipantComponent res) throws IOException, FHIRFormatError {
4319    parseBackboneElementProperties(json, res);
4320    if (json.has("role")) {
4321      JsonArray array = json.getAsJsonArray("role");
4322      for (int i = 0; i < array.size(); i++) {
4323        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4324      }
4325    };
4326    if (json.has("member"))
4327      res.setMember(parseReference(json.getAsJsonObject("member")));
4328    if (json.has("onBehalfOf"))
4329      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
4330    if (json.has("period"))
4331      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
4332  }
4333
4334  protected CatalogEntry parseCatalogEntry(JsonObject json) throws IOException, FHIRFormatError {
4335    CatalogEntry res = new CatalogEntry();
4336    parseCatalogEntryProperties(json, res);
4337    return res;
4338  }
4339
4340  protected void parseCatalogEntryProperties(JsonObject json, CatalogEntry res) throws IOException, FHIRFormatError {
4341    parseDomainResourceProperties(json, res);
4342    if (json.has("identifier")) {
4343      JsonArray array = json.getAsJsonArray("identifier");
4344      for (int i = 0; i < array.size(); i++) {
4345        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4346      }
4347    };
4348    if (json.has("type"))
4349      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4350    if (json.has("orderable"))
4351      res.setOrderableElement(parseBoolean(json.get("orderable").getAsBoolean()));
4352    if (json.has("_orderable"))
4353      parseElementProperties(json.getAsJsonObject("_orderable"), res.getOrderableElement());
4354    if (json.has("referencedItem"))
4355      res.setReferencedItem(parseReference(json.getAsJsonObject("referencedItem")));
4356    if (json.has("additionalIdentifier")) {
4357      JsonArray array = json.getAsJsonArray("additionalIdentifier");
4358      for (int i = 0; i < array.size(); i++) {
4359        res.getAdditionalIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4360      }
4361    };
4362    if (json.has("classification")) {
4363      JsonArray array = json.getAsJsonArray("classification");
4364      for (int i = 0; i < array.size(); i++) {
4365        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4366      }
4367    };
4368    if (json.has("status"))
4369      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4370    if (json.has("_status"))
4371      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4372    if (json.has("validityPeriod"))
4373      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
4374    if (json.has("validTo"))
4375      res.setValidToElement(parseDateTime(json.get("validTo").getAsString()));
4376    if (json.has("_validTo"))
4377      parseElementProperties(json.getAsJsonObject("_validTo"), res.getValidToElement());
4378    if (json.has("lastUpdated"))
4379      res.setLastUpdatedElement(parseDateTime(json.get("lastUpdated").getAsString()));
4380    if (json.has("_lastUpdated"))
4381      parseElementProperties(json.getAsJsonObject("_lastUpdated"), res.getLastUpdatedElement());
4382    if (json.has("additionalCharacteristic")) {
4383      JsonArray array = json.getAsJsonArray("additionalCharacteristic");
4384      for (int i = 0; i < array.size(); i++) {
4385        res.getAdditionalCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4386      }
4387    };
4388    if (json.has("additionalClassification")) {
4389      JsonArray array = json.getAsJsonArray("additionalClassification");
4390      for (int i = 0; i < array.size(); i++) {
4391        res.getAdditionalClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4392      }
4393    };
4394    if (json.has("relatedEntry")) {
4395      JsonArray array = json.getAsJsonArray("relatedEntry");
4396      for (int i = 0; i < array.size(); i++) {
4397        res.getRelatedEntry().add(parseCatalogEntryCatalogEntryRelatedEntryComponent(array.get(i).getAsJsonObject(), res));
4398      }
4399    };
4400  }
4401
4402  protected CatalogEntry.CatalogEntryRelatedEntryComponent parseCatalogEntryCatalogEntryRelatedEntryComponent(JsonObject json, CatalogEntry owner) throws IOException, FHIRFormatError {
4403    CatalogEntry.CatalogEntryRelatedEntryComponent res = new CatalogEntry.CatalogEntryRelatedEntryComponent();
4404    parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(json, owner, res);
4405    return res;
4406  }
4407
4408  protected void parseCatalogEntryCatalogEntryRelatedEntryComponentProperties(JsonObject json, CatalogEntry owner, CatalogEntry.CatalogEntryRelatedEntryComponent res) throws IOException, FHIRFormatError {
4409    parseBackboneElementProperties(json, res);
4410    if (json.has("relationtype"))
4411      res.setRelationtypeElement(parseEnumeration(json.get("relationtype").getAsString(), CatalogEntry.CatalogEntryRelationType.NULL, new CatalogEntry.CatalogEntryRelationTypeEnumFactory()));
4412    if (json.has("_relationtype"))
4413      parseElementProperties(json.getAsJsonObject("_relationtype"), res.getRelationtypeElement());
4414    if (json.has("item"))
4415      res.setItem(parseReference(json.getAsJsonObject("item")));
4416  }
4417
4418  protected ChargeItem parseChargeItem(JsonObject json) throws IOException, FHIRFormatError {
4419    ChargeItem res = new ChargeItem();
4420    parseChargeItemProperties(json, res);
4421    return res;
4422  }
4423
4424  protected void parseChargeItemProperties(JsonObject json, ChargeItem res) throws IOException, FHIRFormatError {
4425    parseDomainResourceProperties(json, res);
4426    if (json.has("identifier")) {
4427      JsonArray array = json.getAsJsonArray("identifier");
4428      for (int i = 0; i < array.size(); i++) {
4429        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4430      }
4431    };
4432    if (json.has("definition")) {
4433      JsonArray array = json.getAsJsonArray("definition");
4434      for (int i = 0; i < array.size(); i++) {
4435        res.getDefinition().add(parseUri(array.get(i).getAsString()));
4436      }
4437    };
4438    if (json.has("_definition")) {
4439      JsonArray array = json.getAsJsonArray("_definition");
4440      for (int i = 0; i < array.size(); i++) {
4441        if (i == res.getDefinition().size())
4442          res.getDefinition().add(parseUri(null));
4443        if (array.get(i) instanceof JsonObject) 
4444          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
4445      }
4446    };
4447    if (json.has("status"))
4448      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ChargeItem.ChargeItemStatus.NULL, new ChargeItem.ChargeItemStatusEnumFactory()));
4449    if (json.has("_status"))
4450      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4451    if (json.has("partOf")) {
4452      JsonArray array = json.getAsJsonArray("partOf");
4453      for (int i = 0; i < array.size(); i++) {
4454        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
4455      }
4456    };
4457    if (json.has("code"))
4458      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4459    if (json.has("subject"))
4460      res.setSubject(parseReference(json.getAsJsonObject("subject")));
4461    if (json.has("context"))
4462      res.setContext(parseReference(json.getAsJsonObject("context")));
4463    Type occurrence = parseType("occurrence", json);
4464    if (occurrence != null)
4465      res.setOccurrence(occurrence);
4466    if (json.has("performer")) {
4467      JsonArray array = json.getAsJsonArray("performer");
4468      for (int i = 0; i < array.size(); i++) {
4469        res.getPerformer().add(parseChargeItemChargeItemPerformerComponent(array.get(i).getAsJsonObject(), res));
4470      }
4471    };
4472    if (json.has("performingOrganization"))
4473      res.setPerformingOrganization(parseReference(json.getAsJsonObject("performingOrganization")));
4474    if (json.has("requestingOrganization"))
4475      res.setRequestingOrganization(parseReference(json.getAsJsonObject("requestingOrganization")));
4476    if (json.has("costCenter"))
4477      res.setCostCenter(parseReference(json.getAsJsonObject("costCenter")));
4478    if (json.has("quantity"))
4479      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
4480    if (json.has("bodysite")) {
4481      JsonArray array = json.getAsJsonArray("bodysite");
4482      for (int i = 0; i < array.size(); i++) {
4483        res.getBodysite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4484      }
4485    };
4486    if (json.has("factorOverride"))
4487      res.setFactorOverrideElement(parseDecimal(json.get("factorOverride").getAsBigDecimal()));
4488    if (json.has("_factorOverride"))
4489      parseElementProperties(json.getAsJsonObject("_factorOverride"), res.getFactorOverrideElement());
4490    if (json.has("priceOverride"))
4491      res.setPriceOverride(parseMoney(json.getAsJsonObject("priceOverride")));
4492    if (json.has("overrideReason"))
4493      res.setOverrideReasonElement(parseString(json.get("overrideReason").getAsString()));
4494    if (json.has("_overrideReason"))
4495      parseElementProperties(json.getAsJsonObject("_overrideReason"), res.getOverrideReasonElement());
4496    if (json.has("enterer"))
4497      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
4498    if (json.has("enteredDate"))
4499      res.setEnteredDateElement(parseDateTime(json.get("enteredDate").getAsString()));
4500    if (json.has("_enteredDate"))
4501      parseElementProperties(json.getAsJsonObject("_enteredDate"), res.getEnteredDateElement());
4502    if (json.has("reason")) {
4503      JsonArray array = json.getAsJsonArray("reason");
4504      for (int i = 0; i < array.size(); i++) {
4505        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4506      }
4507    };
4508    if (json.has("service")) {
4509      JsonArray array = json.getAsJsonArray("service");
4510      for (int i = 0; i < array.size(); i++) {
4511        res.getService().add(parseReference(array.get(i).getAsJsonObject()));
4512      }
4513    };
4514    Type product = parseType("product", json);
4515    if (product != null)
4516      res.setProduct(product);
4517    if (json.has("account")) {
4518      JsonArray array = json.getAsJsonArray("account");
4519      for (int i = 0; i < array.size(); i++) {
4520        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
4521      }
4522    };
4523    if (json.has("note")) {
4524      JsonArray array = json.getAsJsonArray("note");
4525      for (int i = 0; i < array.size(); i++) {
4526        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
4527      }
4528    };
4529    if (json.has("supportingInformation")) {
4530      JsonArray array = json.getAsJsonArray("supportingInformation");
4531      for (int i = 0; i < array.size(); i++) {
4532        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
4533      }
4534    };
4535  }
4536
4537  protected ChargeItem.ChargeItemPerformerComponent parseChargeItemChargeItemPerformerComponent(JsonObject json, ChargeItem owner) throws IOException, FHIRFormatError {
4538    ChargeItem.ChargeItemPerformerComponent res = new ChargeItem.ChargeItemPerformerComponent();
4539    parseChargeItemChargeItemPerformerComponentProperties(json, owner, res);
4540    return res;
4541  }
4542
4543  protected void parseChargeItemChargeItemPerformerComponentProperties(JsonObject json, ChargeItem owner, ChargeItem.ChargeItemPerformerComponent res) throws IOException, FHIRFormatError {
4544    parseBackboneElementProperties(json, res);
4545    if (json.has("function"))
4546      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
4547    if (json.has("actor"))
4548      res.setActor(parseReference(json.getAsJsonObject("actor")));
4549  }
4550
4551  protected ChargeItemDefinition parseChargeItemDefinition(JsonObject json) throws IOException, FHIRFormatError {
4552    ChargeItemDefinition res = new ChargeItemDefinition();
4553    parseChargeItemDefinitionProperties(json, res);
4554    return res;
4555  }
4556
4557  protected void parseChargeItemDefinitionProperties(JsonObject json, ChargeItemDefinition res) throws IOException, FHIRFormatError {
4558    parseDomainResourceProperties(json, res);
4559    if (json.has("url"))
4560      res.setUrlElement(parseUri(json.get("url").getAsString()));
4561    if (json.has("_url"))
4562      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
4563    if (json.has("identifier")) {
4564      JsonArray array = json.getAsJsonArray("identifier");
4565      for (int i = 0; i < array.size(); i++) {
4566        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4567      }
4568    };
4569    if (json.has("version"))
4570      res.setVersionElement(parseString(json.get("version").getAsString()));
4571    if (json.has("_version"))
4572      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
4573    if (json.has("title"))
4574      res.setTitleElement(parseString(json.get("title").getAsString()));
4575    if (json.has("_title"))
4576      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
4577    if (json.has("derivedFromUri")) {
4578      JsonArray array = json.getAsJsonArray("derivedFromUri");
4579      for (int i = 0; i < array.size(); i++) {
4580        res.getDerivedFromUri().add(parseUri(array.get(i).getAsString()));
4581      }
4582    };
4583    if (json.has("_derivedFromUri")) {
4584      JsonArray array = json.getAsJsonArray("_derivedFromUri");
4585      for (int i = 0; i < array.size(); i++) {
4586        if (i == res.getDerivedFromUri().size())
4587          res.getDerivedFromUri().add(parseUri(null));
4588        if (array.get(i) instanceof JsonObject) 
4589          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFromUri().get(i));
4590      }
4591    };
4592    if (json.has("partOf")) {
4593      JsonArray array = json.getAsJsonArray("partOf");
4594      for (int i = 0; i < array.size(); i++) {
4595        res.getPartOf().add(parseCanonical(array.get(i).getAsString()));
4596      }
4597    };
4598    if (json.has("_partOf")) {
4599      JsonArray array = json.getAsJsonArray("_partOf");
4600      for (int i = 0; i < array.size(); i++) {
4601        if (i == res.getPartOf().size())
4602          res.getPartOf().add(parseCanonical(null));
4603        if (array.get(i) instanceof JsonObject) 
4604          parseElementProperties(array.get(i).getAsJsonObject(), res.getPartOf().get(i));
4605      }
4606    };
4607    if (json.has("replaces")) {
4608      JsonArray array = json.getAsJsonArray("replaces");
4609      for (int i = 0; i < array.size(); i++) {
4610        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
4611      }
4612    };
4613    if (json.has("_replaces")) {
4614      JsonArray array = json.getAsJsonArray("_replaces");
4615      for (int i = 0; i < array.size(); i++) {
4616        if (i == res.getReplaces().size())
4617          res.getReplaces().add(parseCanonical(null));
4618        if (array.get(i) instanceof JsonObject) 
4619          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
4620      }
4621    };
4622    if (json.has("status"))
4623      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
4624    if (json.has("_status"))
4625      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4626    if (json.has("experimental"))
4627      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
4628    if (json.has("_experimental"))
4629      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
4630    if (json.has("date"))
4631      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4632    if (json.has("_date"))
4633      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4634    if (json.has("publisher"))
4635      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
4636    if (json.has("_publisher"))
4637      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
4638    if (json.has("contact")) {
4639      JsonArray array = json.getAsJsonArray("contact");
4640      for (int i = 0; i < array.size(); i++) {
4641        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
4642      }
4643    };
4644    if (json.has("description"))
4645      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
4646    if (json.has("_description"))
4647      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4648    if (json.has("useContext")) {
4649      JsonArray array = json.getAsJsonArray("useContext");
4650      for (int i = 0; i < array.size(); i++) {
4651        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
4652      }
4653    };
4654    if (json.has("jurisdiction")) {
4655      JsonArray array = json.getAsJsonArray("jurisdiction");
4656      for (int i = 0; i < array.size(); i++) {
4657        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4658      }
4659    };
4660    if (json.has("copyright"))
4661      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
4662    if (json.has("_copyright"))
4663      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
4664    if (json.has("approvalDate"))
4665      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
4666    if (json.has("_approvalDate"))
4667      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
4668    if (json.has("lastReviewDate"))
4669      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
4670    if (json.has("_lastReviewDate"))
4671      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
4672    if (json.has("effectivePeriod"))
4673      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
4674    if (json.has("code"))
4675      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4676    if (json.has("instance")) {
4677      JsonArray array = json.getAsJsonArray("instance");
4678      for (int i = 0; i < array.size(); i++) {
4679        res.getInstance().add(parseReference(array.get(i).getAsJsonObject()));
4680      }
4681    };
4682    if (json.has("applicability")) {
4683      JsonArray array = json.getAsJsonArray("applicability");
4684      for (int i = 0; i < array.size(); i++) {
4685        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), res));
4686      }
4687    };
4688    if (json.has("propertyGroup")) {
4689      JsonArray array = json.getAsJsonArray("propertyGroup");
4690      for (int i = 0; i < array.size(); i++) {
4691        res.getPropertyGroup().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(array.get(i).getAsJsonObject(), res));
4692      }
4693    };
4694  }
4695
4696  protected ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4697    ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res = new ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent();
4698    parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(json, owner, res);
4699    return res;
4700  }
4701
4702  protected void parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent res) throws IOException, FHIRFormatError {
4703    parseBackboneElementProperties(json, res);
4704    if (json.has("description"))
4705      res.setDescriptionElement(parseString(json.get("description").getAsString()));
4706    if (json.has("_description"))
4707      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
4708    if (json.has("language"))
4709      res.setLanguageElement(parseString(json.get("language").getAsString()));
4710    if (json.has("_language"))
4711      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
4712    if (json.has("expression"))
4713      res.setExpressionElement(parseString(json.get("expression").getAsString()));
4714    if (json.has("_expression"))
4715      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
4716  }
4717
4718  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4719    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent();
4720    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(json, owner, res);
4721    return res;
4722  }
4723
4724  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent res) throws IOException, FHIRFormatError {
4725    parseBackboneElementProperties(json, res);
4726    if (json.has("applicability")) {
4727      JsonArray array = json.getAsJsonArray("applicability");
4728      for (int i = 0; i < array.size(); i++) {
4729        res.getApplicability().add(parseChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(array.get(i).getAsJsonObject(), owner));
4730      }
4731    };
4732    if (json.has("priceComponent")) {
4733      JsonArray array = json.getAsJsonArray("priceComponent");
4734      for (int i = 0; i < array.size(); i++) {
4735        res.getPriceComponent().add(parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
4736      }
4737    };
4738  }
4739
4740  protected ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(JsonObject json, ChargeItemDefinition owner) throws IOException, FHIRFormatError {
4741    ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res = new ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent();
4742    parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(json, owner, res);
4743    return res;
4744  }
4745
4746  protected void parseChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentProperties(JsonObject json, ChargeItemDefinition owner, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent res) throws IOException, FHIRFormatError {
4747    parseBackboneElementProperties(json, res);
4748    if (json.has("type"))
4749      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ChargeItemDefinition.ChargeItemDefinitionPriceComponentType.NULL, new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory()));
4750    if (json.has("_type"))
4751      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
4752    if (json.has("code"))
4753      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4754    if (json.has("factor"))
4755      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
4756    if (json.has("_factor"))
4757      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
4758    if (json.has("amount"))
4759      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
4760  }
4761
4762  protected Claim parseClaim(JsonObject json) throws IOException, FHIRFormatError {
4763    Claim res = new Claim();
4764    parseClaimProperties(json, res);
4765    return res;
4766  }
4767
4768  protected void parseClaimProperties(JsonObject json, Claim res) throws IOException, FHIRFormatError {
4769    parseDomainResourceProperties(json, res);
4770    if (json.has("identifier")) {
4771      JsonArray array = json.getAsJsonArray("identifier");
4772      for (int i = 0; i < array.size(); i++) {
4773        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
4774      }
4775    };
4776    if (json.has("status"))
4777      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Claim.ClaimStatus.NULL, new Claim.ClaimStatusEnumFactory()));
4778    if (json.has("_status"))
4779      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
4780    if (json.has("type"))
4781      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4782    if (json.has("subType"))
4783      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
4784    if (json.has("use"))
4785      res.setUseElement(parseEnumeration(json.get("use").getAsString(), Claim.Use.NULL, new Claim.UseEnumFactory()));
4786    if (json.has("_use"))
4787      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
4788    if (json.has("patient"))
4789      res.setPatient(parseReference(json.getAsJsonObject("patient")));
4790    if (json.has("billablePeriod"))
4791      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
4792    if (json.has("created"))
4793      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
4794    if (json.has("_created"))
4795      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
4796    if (json.has("enterer"))
4797      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
4798    if (json.has("insurer"))
4799      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
4800    if (json.has("provider"))
4801      res.setProvider(parseReference(json.getAsJsonObject("provider")));
4802    if (json.has("priority"))
4803      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
4804    if (json.has("fundsReserve"))
4805      res.setFundsReserve(parseCodeableConcept(json.getAsJsonObject("fundsReserve")));
4806    if (json.has("related")) {
4807      JsonArray array = json.getAsJsonArray("related");
4808      for (int i = 0; i < array.size(); i++) {
4809        res.getRelated().add(parseClaimRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
4810      }
4811    };
4812    if (json.has("prescription"))
4813      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
4814    if (json.has("originalPrescription"))
4815      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
4816    if (json.has("payee"))
4817      res.setPayee(parseClaimPayeeComponent(json.getAsJsonObject("payee"), res));
4818    if (json.has("referral"))
4819      res.setReferral(parseReference(json.getAsJsonObject("referral")));
4820    if (json.has("facility"))
4821      res.setFacility(parseReference(json.getAsJsonObject("facility")));
4822    if (json.has("careTeam")) {
4823      JsonArray array = json.getAsJsonArray("careTeam");
4824      for (int i = 0; i < array.size(); i++) {
4825        res.getCareTeam().add(parseClaimCareTeamComponent(array.get(i).getAsJsonObject(), res));
4826      }
4827    };
4828    if (json.has("information")) {
4829      JsonArray array = json.getAsJsonArray("information");
4830      for (int i = 0; i < array.size(); i++) {
4831        res.getInformation().add(parseClaimSpecialConditionComponent(array.get(i).getAsJsonObject(), res));
4832      }
4833    };
4834    if (json.has("diagnosis")) {
4835      JsonArray array = json.getAsJsonArray("diagnosis");
4836      for (int i = 0; i < array.size(); i++) {
4837        res.getDiagnosis().add(parseClaimDiagnosisComponent(array.get(i).getAsJsonObject(), res));
4838      }
4839    };
4840    if (json.has("procedure")) {
4841      JsonArray array = json.getAsJsonArray("procedure");
4842      for (int i = 0; i < array.size(); i++) {
4843        res.getProcedure().add(parseClaimProcedureComponent(array.get(i).getAsJsonObject(), res));
4844      }
4845    };
4846    if (json.has("insurance")) {
4847      JsonArray array = json.getAsJsonArray("insurance");
4848      for (int i = 0; i < array.size(); i++) {
4849        res.getInsurance().add(parseClaimInsuranceComponent(array.get(i).getAsJsonObject(), res));
4850      }
4851    };
4852    if (json.has("accident"))
4853      res.setAccident(parseClaimAccidentComponent(json.getAsJsonObject("accident"), res));
4854    if (json.has("item")) {
4855      JsonArray array = json.getAsJsonArray("item");
4856      for (int i = 0; i < array.size(); i++) {
4857        res.getItem().add(parseClaimItemComponent(array.get(i).getAsJsonObject(), res));
4858      }
4859    };
4860    if (json.has("total"))
4861      res.setTotal(parseMoney(json.getAsJsonObject("total")));
4862  }
4863
4864  protected Claim.RelatedClaimComponent parseClaimRelatedClaimComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4865    Claim.RelatedClaimComponent res = new Claim.RelatedClaimComponent();
4866    parseClaimRelatedClaimComponentProperties(json, owner, res);
4867    return res;
4868  }
4869
4870  protected void parseClaimRelatedClaimComponentProperties(JsonObject json, Claim owner, Claim.RelatedClaimComponent res) throws IOException, FHIRFormatError {
4871    parseBackboneElementProperties(json, res);
4872    if (json.has("claim"))
4873      res.setClaim(parseReference(json.getAsJsonObject("claim")));
4874    if (json.has("relationship"))
4875      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
4876    if (json.has("reference"))
4877      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
4878  }
4879
4880  protected Claim.PayeeComponent parseClaimPayeeComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4881    Claim.PayeeComponent res = new Claim.PayeeComponent();
4882    parseClaimPayeeComponentProperties(json, owner, res);
4883    return res;
4884  }
4885
4886  protected void parseClaimPayeeComponentProperties(JsonObject json, Claim owner, Claim.PayeeComponent res) throws IOException, FHIRFormatError {
4887    parseBackboneElementProperties(json, res);
4888    if (json.has("type"))
4889      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
4890    if (json.has("resource"))
4891      res.setResource(parseCoding(json.getAsJsonObject("resource")));
4892    if (json.has("party"))
4893      res.setParty(parseReference(json.getAsJsonObject("party")));
4894  }
4895
4896  protected Claim.CareTeamComponent parseClaimCareTeamComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4897    Claim.CareTeamComponent res = new Claim.CareTeamComponent();
4898    parseClaimCareTeamComponentProperties(json, owner, res);
4899    return res;
4900  }
4901
4902  protected void parseClaimCareTeamComponentProperties(JsonObject json, Claim owner, Claim.CareTeamComponent res) throws IOException, FHIRFormatError {
4903    parseBackboneElementProperties(json, res);
4904    if (json.has("sequence"))
4905      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4906    if (json.has("_sequence"))
4907      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4908    if (json.has("provider"))
4909      res.setProvider(parseReference(json.getAsJsonObject("provider")));
4910    if (json.has("responsible"))
4911      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
4912    if (json.has("_responsible"))
4913      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
4914    if (json.has("role"))
4915      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
4916    if (json.has("qualification"))
4917      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
4918  }
4919
4920  protected Claim.SpecialConditionComponent parseClaimSpecialConditionComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4921    Claim.SpecialConditionComponent res = new Claim.SpecialConditionComponent();
4922    parseClaimSpecialConditionComponentProperties(json, owner, res);
4923    return res;
4924  }
4925
4926  protected void parseClaimSpecialConditionComponentProperties(JsonObject json, Claim owner, Claim.SpecialConditionComponent res) throws IOException, FHIRFormatError {
4927    parseBackboneElementProperties(json, res);
4928    if (json.has("sequence"))
4929      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4930    if (json.has("_sequence"))
4931      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4932    if (json.has("category"))
4933      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
4934    if (json.has("code"))
4935      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
4936    Type timing = parseType("timing", json);
4937    if (timing != null)
4938      res.setTiming(timing);
4939    Type value = parseType("value", json);
4940    if (value != null)
4941      res.setValue(value);
4942    if (json.has("reason"))
4943      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
4944  }
4945
4946  protected Claim.DiagnosisComponent parseClaimDiagnosisComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4947    Claim.DiagnosisComponent res = new Claim.DiagnosisComponent();
4948    parseClaimDiagnosisComponentProperties(json, owner, res);
4949    return res;
4950  }
4951
4952  protected void parseClaimDiagnosisComponentProperties(JsonObject json, Claim owner, Claim.DiagnosisComponent res) throws IOException, FHIRFormatError {
4953    parseBackboneElementProperties(json, res);
4954    if (json.has("sequence"))
4955      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4956    if (json.has("_sequence"))
4957      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4958    Type diagnosis = parseType("diagnosis", json);
4959    if (diagnosis != null)
4960      res.setDiagnosis(diagnosis);
4961    if (json.has("type")) {
4962      JsonArray array = json.getAsJsonArray("type");
4963      for (int i = 0; i < array.size(); i++) {
4964        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
4965      }
4966    };
4967    if (json.has("onAdmission"))
4968      res.setOnAdmission(parseCodeableConcept(json.getAsJsonObject("onAdmission")));
4969    if (json.has("packageCode"))
4970      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
4971  }
4972
4973  protected Claim.ProcedureComponent parseClaimProcedureComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4974    Claim.ProcedureComponent res = new Claim.ProcedureComponent();
4975    parseClaimProcedureComponentProperties(json, owner, res);
4976    return res;
4977  }
4978
4979  protected void parseClaimProcedureComponentProperties(JsonObject json, Claim owner, Claim.ProcedureComponent res) throws IOException, FHIRFormatError {
4980    parseBackboneElementProperties(json, res);
4981    if (json.has("sequence"))
4982      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
4983    if (json.has("_sequence"))
4984      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
4985    if (json.has("date"))
4986      res.setDateElement(parseDateTime(json.get("date").getAsString()));
4987    if (json.has("_date"))
4988      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
4989    Type procedure = parseType("procedure", json);
4990    if (procedure != null)
4991      res.setProcedure(procedure);
4992  }
4993
4994  protected Claim.InsuranceComponent parseClaimInsuranceComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
4995    Claim.InsuranceComponent res = new Claim.InsuranceComponent();
4996    parseClaimInsuranceComponentProperties(json, owner, res);
4997    return res;
4998  }
4999
5000  protected void parseClaimInsuranceComponentProperties(JsonObject json, Claim owner, Claim.InsuranceComponent res) throws IOException, FHIRFormatError {
5001    parseBackboneElementProperties(json, res);
5002    if (json.has("sequence"))
5003      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5004    if (json.has("_sequence"))
5005      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5006    if (json.has("focal"))
5007      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5008    if (json.has("_focal"))
5009      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
5010    if (json.has("identifier"))
5011      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5012    if (json.has("coverage"))
5013      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
5014    if (json.has("businessArrangement"))
5015      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5016    if (json.has("_businessArrangement"))
5017      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
5018    if (json.has("preAuthRef")) {
5019      JsonArray array = json.getAsJsonArray("preAuthRef");
5020      for (int i = 0; i < array.size(); i++) {
5021        res.getPreAuthRef().add(parseString(array.get(i).getAsString()));
5022      }
5023    };
5024    if (json.has("_preAuthRef")) {
5025      JsonArray array = json.getAsJsonArray("_preAuthRef");
5026      for (int i = 0; i < array.size(); i++) {
5027        if (i == res.getPreAuthRef().size())
5028          res.getPreAuthRef().add(parseString(null));
5029        if (array.get(i) instanceof JsonObject) 
5030          parseElementProperties(array.get(i).getAsJsonObject(), res.getPreAuthRef().get(i));
5031      }
5032    };
5033    if (json.has("claimResponse"))
5034      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
5035  }
5036
5037  protected Claim.AccidentComponent parseClaimAccidentComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5038    Claim.AccidentComponent res = new Claim.AccidentComponent();
5039    parseClaimAccidentComponentProperties(json, owner, res);
5040    return res;
5041  }
5042
5043  protected void parseClaimAccidentComponentProperties(JsonObject json, Claim owner, Claim.AccidentComponent res) throws IOException, FHIRFormatError {
5044    parseBackboneElementProperties(json, res);
5045    if (json.has("date"))
5046      res.setDateElement(parseDate(json.get("date").getAsString()));
5047    if (json.has("_date"))
5048      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5049    if (json.has("type"))
5050      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5051    Type location = parseType("location", json);
5052    if (location != null)
5053      res.setLocation(location);
5054  }
5055
5056  protected Claim.ItemComponent parseClaimItemComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5057    Claim.ItemComponent res = new Claim.ItemComponent();
5058    parseClaimItemComponentProperties(json, owner, res);
5059    return res;
5060  }
5061
5062  protected void parseClaimItemComponentProperties(JsonObject json, Claim owner, Claim.ItemComponent res) throws IOException, FHIRFormatError {
5063    parseBackboneElementProperties(json, res);
5064    if (json.has("sequence"))
5065      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5066    if (json.has("_sequence"))
5067      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5068    if (json.has("careTeamSequence")) {
5069      JsonArray array = json.getAsJsonArray("careTeamSequence");
5070      for (int i = 0; i < array.size(); i++) {
5071        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
5072      }
5073    };
5074    if (json.has("_careTeamSequence")) {
5075      JsonArray array = json.getAsJsonArray("_careTeamSequence");
5076      for (int i = 0; i < array.size(); i++) {
5077        if (i == res.getCareTeamSequence().size())
5078          res.getCareTeamSequence().add(parsePositiveInt(null));
5079        if (array.get(i) instanceof JsonObject) 
5080          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
5081      }
5082    };
5083    if (json.has("diagnosisSequence")) {
5084      JsonArray array = json.getAsJsonArray("diagnosisSequence");
5085      for (int i = 0; i < array.size(); i++) {
5086        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
5087      }
5088    };
5089    if (json.has("_diagnosisSequence")) {
5090      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
5091      for (int i = 0; i < array.size(); i++) {
5092        if (i == res.getDiagnosisSequence().size())
5093          res.getDiagnosisSequence().add(parsePositiveInt(null));
5094        if (array.get(i) instanceof JsonObject) 
5095          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
5096      }
5097    };
5098    if (json.has("procedureSequence")) {
5099      JsonArray array = json.getAsJsonArray("procedureSequence");
5100      for (int i = 0; i < array.size(); i++) {
5101        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
5102      }
5103    };
5104    if (json.has("_procedureSequence")) {
5105      JsonArray array = json.getAsJsonArray("_procedureSequence");
5106      for (int i = 0; i < array.size(); i++) {
5107        if (i == res.getProcedureSequence().size())
5108          res.getProcedureSequence().add(parsePositiveInt(null));
5109        if (array.get(i) instanceof JsonObject) 
5110          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
5111      }
5112    };
5113    if (json.has("informationSequence")) {
5114      JsonArray array = json.getAsJsonArray("informationSequence");
5115      for (int i = 0; i < array.size(); i++) {
5116        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
5117      }
5118    };
5119    if (json.has("_informationSequence")) {
5120      JsonArray array = json.getAsJsonArray("_informationSequence");
5121      for (int i = 0; i < array.size(); i++) {
5122        if (i == res.getInformationSequence().size())
5123          res.getInformationSequence().add(parsePositiveInt(null));
5124        if (array.get(i) instanceof JsonObject) 
5125          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
5126      }
5127    };
5128    if (json.has("revenue"))
5129      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
5130    if (json.has("category"))
5131      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5132    if (json.has("billcode"))
5133      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
5134    if (json.has("modifier")) {
5135      JsonArray array = json.getAsJsonArray("modifier");
5136      for (int i = 0; i < array.size(); i++) {
5137        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5138      }
5139    };
5140    if (json.has("programCode")) {
5141      JsonArray array = json.getAsJsonArray("programCode");
5142      for (int i = 0; i < array.size(); i++) {
5143        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5144      }
5145    };
5146    Type serviced = parseType("serviced", json);
5147    if (serviced != null)
5148      res.setServiced(serviced);
5149    Type location = parseType("location", json);
5150    if (location != null)
5151      res.setLocation(location);
5152    if (json.has("quantity"))
5153      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5154    if (json.has("unitPrice"))
5155      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5156    if (json.has("factor"))
5157      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5158    if (json.has("_factor"))
5159      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5160    if (json.has("net"))
5161      res.setNet(parseMoney(json.getAsJsonObject("net")));
5162    if (json.has("udi")) {
5163      JsonArray array = json.getAsJsonArray("udi");
5164      for (int i = 0; i < array.size(); i++) {
5165        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5166      }
5167    };
5168    if (json.has("bodySite"))
5169      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
5170    if (json.has("subSite")) {
5171      JsonArray array = json.getAsJsonArray("subSite");
5172      for (int i = 0; i < array.size(); i++) {
5173        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5174      }
5175    };
5176    if (json.has("encounter")) {
5177      JsonArray array = json.getAsJsonArray("encounter");
5178      for (int i = 0; i < array.size(); i++) {
5179        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
5180      }
5181    };
5182    if (json.has("detail")) {
5183      JsonArray array = json.getAsJsonArray("detail");
5184      for (int i = 0; i < array.size(); i++) {
5185        res.getDetail().add(parseClaimDetailComponent(array.get(i).getAsJsonObject(), owner));
5186      }
5187    };
5188  }
5189
5190  protected Claim.DetailComponent parseClaimDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5191    Claim.DetailComponent res = new Claim.DetailComponent();
5192    parseClaimDetailComponentProperties(json, owner, res);
5193    return res;
5194  }
5195
5196  protected void parseClaimDetailComponentProperties(JsonObject json, Claim owner, Claim.DetailComponent res) throws IOException, FHIRFormatError {
5197    parseBackboneElementProperties(json, res);
5198    if (json.has("sequence"))
5199      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5200    if (json.has("_sequence"))
5201      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5202    if (json.has("revenue"))
5203      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
5204    if (json.has("category"))
5205      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5206    if (json.has("billcode"))
5207      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
5208    if (json.has("modifier")) {
5209      JsonArray array = json.getAsJsonArray("modifier");
5210      for (int i = 0; i < array.size(); i++) {
5211        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5212      }
5213    };
5214    if (json.has("programCode")) {
5215      JsonArray array = json.getAsJsonArray("programCode");
5216      for (int i = 0; i < array.size(); i++) {
5217        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5218      }
5219    };
5220    if (json.has("quantity"))
5221      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5222    if (json.has("unitPrice"))
5223      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5224    if (json.has("factor"))
5225      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5226    if (json.has("_factor"))
5227      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5228    if (json.has("net"))
5229      res.setNet(parseMoney(json.getAsJsonObject("net")));
5230    if (json.has("udi")) {
5231      JsonArray array = json.getAsJsonArray("udi");
5232      for (int i = 0; i < array.size(); i++) {
5233        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5234      }
5235    };
5236    if (json.has("subDetail")) {
5237      JsonArray array = json.getAsJsonArray("subDetail");
5238      for (int i = 0; i < array.size(); i++) {
5239        res.getSubDetail().add(parseClaimSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5240      }
5241    };
5242  }
5243
5244  protected Claim.SubDetailComponent parseClaimSubDetailComponent(JsonObject json, Claim owner) throws IOException, FHIRFormatError {
5245    Claim.SubDetailComponent res = new Claim.SubDetailComponent();
5246    parseClaimSubDetailComponentProperties(json, owner, res);
5247    return res;
5248  }
5249
5250  protected void parseClaimSubDetailComponentProperties(JsonObject json, Claim owner, Claim.SubDetailComponent res) throws IOException, FHIRFormatError {
5251    parseBackboneElementProperties(json, res);
5252    if (json.has("sequence"))
5253      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5254    if (json.has("_sequence"))
5255      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5256    if (json.has("revenue"))
5257      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
5258    if (json.has("category"))
5259      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5260    if (json.has("billcode"))
5261      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
5262    if (json.has("modifier")) {
5263      JsonArray array = json.getAsJsonArray("modifier");
5264      for (int i = 0; i < array.size(); i++) {
5265        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5266      }
5267    };
5268    if (json.has("programCode")) {
5269      JsonArray array = json.getAsJsonArray("programCode");
5270      for (int i = 0; i < array.size(); i++) {
5271        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5272      }
5273    };
5274    if (json.has("quantity"))
5275      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5276    if (json.has("unitPrice"))
5277      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5278    if (json.has("factor"))
5279      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5280    if (json.has("_factor"))
5281      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5282    if (json.has("net"))
5283      res.setNet(parseMoney(json.getAsJsonObject("net")));
5284    if (json.has("udi")) {
5285      JsonArray array = json.getAsJsonArray("udi");
5286      for (int i = 0; i < array.size(); i++) {
5287        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
5288      }
5289    };
5290  }
5291
5292  protected ClaimResponse parseClaimResponse(JsonObject json) throws IOException, FHIRFormatError {
5293    ClaimResponse res = new ClaimResponse();
5294    parseClaimResponseProperties(json, res);
5295    return res;
5296  }
5297
5298  protected void parseClaimResponseProperties(JsonObject json, ClaimResponse res) throws IOException, FHIRFormatError {
5299    parseDomainResourceProperties(json, res);
5300    if (json.has("identifier")) {
5301      JsonArray array = json.getAsJsonArray("identifier");
5302      for (int i = 0; i < array.size(); i++) {
5303        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5304      }
5305    };
5306    if (json.has("status"))
5307      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClaimResponse.ClaimResponseStatus.NULL, new ClaimResponse.ClaimResponseStatusEnumFactory()));
5308    if (json.has("_status"))
5309      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5310    if (json.has("type"))
5311      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5312    if (json.has("subType"))
5313      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
5314    if (json.has("use"))
5315      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ClaimResponse.Use.NULL, new ClaimResponse.UseEnumFactory()));
5316    if (json.has("_use"))
5317      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
5318    if (json.has("patient"))
5319      res.setPatient(parseReference(json.getAsJsonObject("patient")));
5320    if (json.has("created"))
5321      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
5322    if (json.has("_created"))
5323      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
5324    if (json.has("insurer"))
5325      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
5326    if (json.has("requestProvider"))
5327      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
5328    if (json.has("request"))
5329      res.setRequest(parseReference(json.getAsJsonObject("request")));
5330    if (json.has("outcome"))
5331      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ClaimResponse.RemittanceOutcome.NULL, new ClaimResponse.RemittanceOutcomeEnumFactory()));
5332    if (json.has("_outcome"))
5333      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
5334    if (json.has("disposition"))
5335      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
5336    if (json.has("_disposition"))
5337      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
5338    if (json.has("preAuthRef"))
5339      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
5340    if (json.has("_preAuthRef"))
5341      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
5342    if (json.has("payeeType"))
5343      res.setPayeeType(parseCodeableConcept(json.getAsJsonObject("payeeType")));
5344    if (json.has("item")) {
5345      JsonArray array = json.getAsJsonArray("item");
5346      for (int i = 0; i < array.size(); i++) {
5347        res.getItem().add(parseClaimResponseItemComponent(array.get(i).getAsJsonObject(), res));
5348      }
5349    };
5350    if (json.has("addItem")) {
5351      JsonArray array = json.getAsJsonArray("addItem");
5352      for (int i = 0; i < array.size(); i++) {
5353        res.getAddItem().add(parseClaimResponseAddedItemComponent(array.get(i).getAsJsonObject(), res));
5354      }
5355    };
5356    if (json.has("error")) {
5357      JsonArray array = json.getAsJsonArray("error");
5358      for (int i = 0; i < array.size(); i++) {
5359        res.getError().add(parseClaimResponseErrorComponent(array.get(i).getAsJsonObject(), res));
5360      }
5361    };
5362    if (json.has("total")) {
5363      JsonArray array = json.getAsJsonArray("total");
5364      for (int i = 0; i < array.size(); i++) {
5365        res.getTotal().add(parseClaimResponseTotalComponent(array.get(i).getAsJsonObject(), res));
5366      }
5367    };
5368    if (json.has("payment"))
5369      res.setPayment(parseClaimResponsePaymentComponent(json.getAsJsonObject("payment"), res));
5370    if (json.has("reserved"))
5371      res.setReserved(parseCoding(json.getAsJsonObject("reserved")));
5372    if (json.has("form"))
5373      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
5374    if (json.has("processNote")) {
5375      JsonArray array = json.getAsJsonArray("processNote");
5376      for (int i = 0; i < array.size(); i++) {
5377        res.getProcessNote().add(parseClaimResponseNoteComponent(array.get(i).getAsJsonObject(), res));
5378      }
5379    };
5380    if (json.has("communicationRequest")) {
5381      JsonArray array = json.getAsJsonArray("communicationRequest");
5382      for (int i = 0; i < array.size(); i++) {
5383        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
5384      }
5385    };
5386    if (json.has("insurance")) {
5387      JsonArray array = json.getAsJsonArray("insurance");
5388      for (int i = 0; i < array.size(); i++) {
5389        res.getInsurance().add(parseClaimResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
5390      }
5391    };
5392  }
5393
5394  protected ClaimResponse.ItemComponent parseClaimResponseItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5395    ClaimResponse.ItemComponent res = new ClaimResponse.ItemComponent();
5396    parseClaimResponseItemComponentProperties(json, owner, res);
5397    return res;
5398  }
5399
5400  protected void parseClaimResponseItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemComponent res) throws IOException, FHIRFormatError {
5401    parseBackboneElementProperties(json, res);
5402    if (json.has("itemSequence"))
5403      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5404    if (json.has("_itemSequence"))
5405      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
5406    if (json.has("noteNumber")) {
5407      JsonArray array = json.getAsJsonArray("noteNumber");
5408      for (int i = 0; i < array.size(); i++) {
5409        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5410      }
5411    };
5412    if (json.has("_noteNumber")) {
5413      JsonArray array = json.getAsJsonArray("_noteNumber");
5414      for (int i = 0; i < array.size(); i++) {
5415        if (i == res.getNoteNumber().size())
5416          res.getNoteNumber().add(parsePositiveInt(null));
5417        if (array.get(i) instanceof JsonObject) 
5418          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5419      }
5420    };
5421    if (json.has("adjudication")) {
5422      JsonArray array = json.getAsJsonArray("adjudication");
5423      for (int i = 0; i < array.size(); i++) {
5424        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5425      }
5426    };
5427    if (json.has("detail")) {
5428      JsonArray array = json.getAsJsonArray("detail");
5429      for (int i = 0; i < array.size(); i++) {
5430        res.getDetail().add(parseClaimResponseItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5431      }
5432    };
5433  }
5434
5435  protected ClaimResponse.AdjudicationComponent parseClaimResponseAdjudicationComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5436    ClaimResponse.AdjudicationComponent res = new ClaimResponse.AdjudicationComponent();
5437    parseClaimResponseAdjudicationComponentProperties(json, owner, res);
5438    return res;
5439  }
5440
5441  protected void parseClaimResponseAdjudicationComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AdjudicationComponent res) throws IOException, FHIRFormatError {
5442    parseBackboneElementProperties(json, res);
5443    if (json.has("category"))
5444      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5445    if (json.has("reason"))
5446      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
5447    if (json.has("amount"))
5448      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5449    if (json.has("value"))
5450      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
5451    if (json.has("_value"))
5452      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
5453  }
5454
5455  protected ClaimResponse.ItemDetailComponent parseClaimResponseItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5456    ClaimResponse.ItemDetailComponent res = new ClaimResponse.ItemDetailComponent();
5457    parseClaimResponseItemDetailComponentProperties(json, owner, res);
5458    return res;
5459  }
5460
5461  protected void parseClaimResponseItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ItemDetailComponent res) throws IOException, FHIRFormatError {
5462    parseBackboneElementProperties(json, res);
5463    if (json.has("detailSequence"))
5464      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5465    if (json.has("_detailSequence"))
5466      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
5467    if (json.has("noteNumber")) {
5468      JsonArray array = json.getAsJsonArray("noteNumber");
5469      for (int i = 0; i < array.size(); i++) {
5470        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5471      }
5472    };
5473    if (json.has("_noteNumber")) {
5474      JsonArray array = json.getAsJsonArray("_noteNumber");
5475      for (int i = 0; i < array.size(); i++) {
5476        if (i == res.getNoteNumber().size())
5477          res.getNoteNumber().add(parsePositiveInt(null));
5478        if (array.get(i) instanceof JsonObject) 
5479          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5480      }
5481    };
5482    if (json.has("adjudication")) {
5483      JsonArray array = json.getAsJsonArray("adjudication");
5484      for (int i = 0; i < array.size(); i++) {
5485        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5486      }
5487    };
5488    if (json.has("subDetail")) {
5489      JsonArray array = json.getAsJsonArray("subDetail");
5490      for (int i = 0; i < array.size(); i++) {
5491        res.getSubDetail().add(parseClaimResponseSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5492      }
5493    };
5494  }
5495
5496  protected ClaimResponse.SubDetailComponent parseClaimResponseSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5497    ClaimResponse.SubDetailComponent res = new ClaimResponse.SubDetailComponent();
5498    parseClaimResponseSubDetailComponentProperties(json, owner, res);
5499    return res;
5500  }
5501
5502  protected void parseClaimResponseSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.SubDetailComponent res) throws IOException, FHIRFormatError {
5503    parseBackboneElementProperties(json, res);
5504    if (json.has("subDetailSequence"))
5505      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5506    if (json.has("_subDetailSequence"))
5507      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
5508    if (json.has("noteNumber")) {
5509      JsonArray array = json.getAsJsonArray("noteNumber");
5510      for (int i = 0; i < array.size(); i++) {
5511        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5512      }
5513    };
5514    if (json.has("_noteNumber")) {
5515      JsonArray array = json.getAsJsonArray("_noteNumber");
5516      for (int i = 0; i < array.size(); i++) {
5517        if (i == res.getNoteNumber().size())
5518          res.getNoteNumber().add(parsePositiveInt(null));
5519        if (array.get(i) instanceof JsonObject) 
5520          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5521      }
5522    };
5523    if (json.has("adjudication")) {
5524      JsonArray array = json.getAsJsonArray("adjudication");
5525      for (int i = 0; i < array.size(); i++) {
5526        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5527      }
5528    };
5529  }
5530
5531  protected ClaimResponse.AddedItemComponent parseClaimResponseAddedItemComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5532    ClaimResponse.AddedItemComponent res = new ClaimResponse.AddedItemComponent();
5533    parseClaimResponseAddedItemComponentProperties(json, owner, res);
5534    return res;
5535  }
5536
5537  protected void parseClaimResponseAddedItemComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemComponent res) throws IOException, FHIRFormatError {
5538    parseBackboneElementProperties(json, res);
5539    if (json.has("itemSequence")) {
5540      JsonArray array = json.getAsJsonArray("itemSequence");
5541      for (int i = 0; i < array.size(); i++) {
5542        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
5543      }
5544    };
5545    if (json.has("_itemSequence")) {
5546      JsonArray array = json.getAsJsonArray("_itemSequence");
5547      for (int i = 0; i < array.size(); i++) {
5548        if (i == res.getItemSequence().size())
5549          res.getItemSequence().add(parsePositiveInt(null));
5550        if (array.get(i) instanceof JsonObject) 
5551          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
5552      }
5553    };
5554    if (json.has("detailSequence")) {
5555      JsonArray array = json.getAsJsonArray("detailSequence");
5556      for (int i = 0; i < array.size(); i++) {
5557        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5558      }
5559    };
5560    if (json.has("_detailSequence")) {
5561      JsonArray array = json.getAsJsonArray("_detailSequence");
5562      for (int i = 0; i < array.size(); i++) {
5563        if (i == res.getDetailSequence().size())
5564          res.getDetailSequence().add(parsePositiveInt(null));
5565        if (array.get(i) instanceof JsonObject) 
5566          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
5567      }
5568    };
5569    if (json.has("subdetailSequence")) {
5570      JsonArray array = json.getAsJsonArray("subdetailSequence");
5571      for (int i = 0; i < array.size(); i++) {
5572        res.getSubdetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
5573      }
5574    };
5575    if (json.has("_subdetailSequence")) {
5576      JsonArray array = json.getAsJsonArray("_subdetailSequence");
5577      for (int i = 0; i < array.size(); i++) {
5578        if (i == res.getSubdetailSequence().size())
5579          res.getSubdetailSequence().add(parsePositiveInt(null));
5580        if (array.get(i) instanceof JsonObject) 
5581          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubdetailSequence().get(i));
5582      }
5583    };
5584    if (json.has("provider")) {
5585      JsonArray array = json.getAsJsonArray("provider");
5586      for (int i = 0; i < array.size(); i++) {
5587        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
5588      }
5589    };
5590    if (json.has("billcode"))
5591      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
5592    if (json.has("modifier")) {
5593      JsonArray array = json.getAsJsonArray("modifier");
5594      for (int i = 0; i < array.size(); i++) {
5595        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5596      }
5597    };
5598    if (json.has("programCode")) {
5599      JsonArray array = json.getAsJsonArray("programCode");
5600      for (int i = 0; i < array.size(); i++) {
5601        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5602      }
5603    };
5604    Type serviced = parseType("serviced", json);
5605    if (serviced != null)
5606      res.setServiced(serviced);
5607    Type location = parseType("location", json);
5608    if (location != null)
5609      res.setLocation(location);
5610    if (json.has("quantity"))
5611      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5612    if (json.has("unitPrice"))
5613      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5614    if (json.has("factor"))
5615      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5616    if (json.has("_factor"))
5617      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5618    if (json.has("net"))
5619      res.setNet(parseMoney(json.getAsJsonObject("net")));
5620    if (json.has("bodySite"))
5621      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
5622    if (json.has("subSite")) {
5623      JsonArray array = json.getAsJsonArray("subSite");
5624      for (int i = 0; i < array.size(); i++) {
5625        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5626      }
5627    };
5628    if (json.has("noteNumber")) {
5629      JsonArray array = json.getAsJsonArray("noteNumber");
5630      for (int i = 0; i < array.size(); i++) {
5631        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5632      }
5633    };
5634    if (json.has("_noteNumber")) {
5635      JsonArray array = json.getAsJsonArray("_noteNumber");
5636      for (int i = 0; i < array.size(); i++) {
5637        if (i == res.getNoteNumber().size())
5638          res.getNoteNumber().add(parsePositiveInt(null));
5639        if (array.get(i) instanceof JsonObject) 
5640          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5641      }
5642    };
5643    if (json.has("adjudication")) {
5644      JsonArray array = json.getAsJsonArray("adjudication");
5645      for (int i = 0; i < array.size(); i++) {
5646        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5647      }
5648    };
5649    if (json.has("detail")) {
5650      JsonArray array = json.getAsJsonArray("detail");
5651      for (int i = 0; i < array.size(); i++) {
5652        res.getDetail().add(parseClaimResponseAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
5653      }
5654    };
5655  }
5656
5657  protected ClaimResponse.AddedItemDetailComponent parseClaimResponseAddedItemDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5658    ClaimResponse.AddedItemDetailComponent res = new ClaimResponse.AddedItemDetailComponent();
5659    parseClaimResponseAddedItemDetailComponentProperties(json, owner, res);
5660    return res;
5661  }
5662
5663  protected void parseClaimResponseAddedItemDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
5664    parseBackboneElementProperties(json, res);
5665    if (json.has("billcode"))
5666      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
5667    if (json.has("modifier")) {
5668      JsonArray array = json.getAsJsonArray("modifier");
5669      for (int i = 0; i < array.size(); i++) {
5670        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5671      }
5672    };
5673    if (json.has("quantity"))
5674      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5675    if (json.has("unitPrice"))
5676      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5677    if (json.has("factor"))
5678      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5679    if (json.has("_factor"))
5680      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5681    if (json.has("net"))
5682      res.setNet(parseMoney(json.getAsJsonObject("net")));
5683    if (json.has("noteNumber")) {
5684      JsonArray array = json.getAsJsonArray("noteNumber");
5685      for (int i = 0; i < array.size(); i++) {
5686        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5687      }
5688    };
5689    if (json.has("_noteNumber")) {
5690      JsonArray array = json.getAsJsonArray("_noteNumber");
5691      for (int i = 0; i < array.size(); i++) {
5692        if (i == res.getNoteNumber().size())
5693          res.getNoteNumber().add(parsePositiveInt(null));
5694        if (array.get(i) instanceof JsonObject) 
5695          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5696      }
5697    };
5698    if (json.has("adjudication")) {
5699      JsonArray array = json.getAsJsonArray("adjudication");
5700      for (int i = 0; i < array.size(); i++) {
5701        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5702      }
5703    };
5704    if (json.has("subDetail")) {
5705      JsonArray array = json.getAsJsonArray("subDetail");
5706      for (int i = 0; i < array.size(); i++) {
5707        res.getSubDetail().add(parseClaimResponseAddedItemSubDetailComponent(array.get(i).getAsJsonObject(), owner));
5708      }
5709    };
5710  }
5711
5712  protected ClaimResponse.AddedItemSubDetailComponent parseClaimResponseAddedItemSubDetailComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5713    ClaimResponse.AddedItemSubDetailComponent res = new ClaimResponse.AddedItemSubDetailComponent();
5714    parseClaimResponseAddedItemSubDetailComponentProperties(json, owner, res);
5715    return res;
5716  }
5717
5718  protected void parseClaimResponseAddedItemSubDetailComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.AddedItemSubDetailComponent res) throws IOException, FHIRFormatError {
5719    parseBackboneElementProperties(json, res);
5720    if (json.has("billcode"))
5721      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
5722    if (json.has("modifier")) {
5723      JsonArray array = json.getAsJsonArray("modifier");
5724      for (int i = 0; i < array.size(); i++) {
5725        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5726      }
5727    };
5728    if (json.has("quantity"))
5729      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
5730    if (json.has("unitPrice"))
5731      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
5732    if (json.has("factor"))
5733      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
5734    if (json.has("_factor"))
5735      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
5736    if (json.has("net"))
5737      res.setNet(parseMoney(json.getAsJsonObject("net")));
5738    if (json.has("noteNumber")) {
5739      JsonArray array = json.getAsJsonArray("noteNumber");
5740      for (int i = 0; i < array.size(); i++) {
5741        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
5742      }
5743    };
5744    if (json.has("_noteNumber")) {
5745      JsonArray array = json.getAsJsonArray("_noteNumber");
5746      for (int i = 0; i < array.size(); i++) {
5747        if (i == res.getNoteNumber().size())
5748          res.getNoteNumber().add(parsePositiveInt(null));
5749        if (array.get(i) instanceof JsonObject) 
5750          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
5751      }
5752    };
5753    if (json.has("adjudication")) {
5754      JsonArray array = json.getAsJsonArray("adjudication");
5755      for (int i = 0; i < array.size(); i++) {
5756        res.getAdjudication().add(parseClaimResponseAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
5757      }
5758    };
5759  }
5760
5761  protected ClaimResponse.ErrorComponent parseClaimResponseErrorComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5762    ClaimResponse.ErrorComponent res = new ClaimResponse.ErrorComponent();
5763    parseClaimResponseErrorComponentProperties(json, owner, res);
5764    return res;
5765  }
5766
5767  protected void parseClaimResponseErrorComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.ErrorComponent res) throws IOException, FHIRFormatError {
5768    parseBackboneElementProperties(json, res);
5769    if (json.has("itemSequence"))
5770      res.setItemSequenceElement(parsePositiveInt(json.get("itemSequence").getAsString()));
5771    if (json.has("_itemSequence"))
5772      parseElementProperties(json.getAsJsonObject("_itemSequence"), res.getItemSequenceElement());
5773    if (json.has("detailSequence"))
5774      res.setDetailSequenceElement(parsePositiveInt(json.get("detailSequence").getAsString()));
5775    if (json.has("_detailSequence"))
5776      parseElementProperties(json.getAsJsonObject("_detailSequence"), res.getDetailSequenceElement());
5777    if (json.has("subDetailSequence"))
5778      res.setSubDetailSequenceElement(parsePositiveInt(json.get("subDetailSequence").getAsString()));
5779    if (json.has("_subDetailSequence"))
5780      parseElementProperties(json.getAsJsonObject("_subDetailSequence"), res.getSubDetailSequenceElement());
5781    if (json.has("code"))
5782      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5783  }
5784
5785  protected ClaimResponse.TotalComponent parseClaimResponseTotalComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5786    ClaimResponse.TotalComponent res = new ClaimResponse.TotalComponent();
5787    parseClaimResponseTotalComponentProperties(json, owner, res);
5788    return res;
5789  }
5790
5791  protected void parseClaimResponseTotalComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.TotalComponent res) throws IOException, FHIRFormatError {
5792    parseBackboneElementProperties(json, res);
5793    if (json.has("category"))
5794      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
5795    if (json.has("amount"))
5796      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5797  }
5798
5799  protected ClaimResponse.PaymentComponent parseClaimResponsePaymentComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5800    ClaimResponse.PaymentComponent res = new ClaimResponse.PaymentComponent();
5801    parseClaimResponsePaymentComponentProperties(json, owner, res);
5802    return res;
5803  }
5804
5805  protected void parseClaimResponsePaymentComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.PaymentComponent res) throws IOException, FHIRFormatError {
5806    parseBackboneElementProperties(json, res);
5807    if (json.has("type"))
5808      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
5809    if (json.has("adjustment"))
5810      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
5811    if (json.has("adjustmentReason"))
5812      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
5813    if (json.has("date"))
5814      res.setDateElement(parseDate(json.get("date").getAsString()));
5815    if (json.has("_date"))
5816      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5817    if (json.has("amount"))
5818      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
5819    if (json.has("identifier"))
5820      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
5821  }
5822
5823  protected ClaimResponse.NoteComponent parseClaimResponseNoteComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5824    ClaimResponse.NoteComponent res = new ClaimResponse.NoteComponent();
5825    parseClaimResponseNoteComponentProperties(json, owner, res);
5826    return res;
5827  }
5828
5829  protected void parseClaimResponseNoteComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.NoteComponent res) throws IOException, FHIRFormatError {
5830    parseBackboneElementProperties(json, res);
5831    if (json.has("number"))
5832      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
5833    if (json.has("_number"))
5834      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
5835    if (json.has("type"))
5836      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
5837    if (json.has("_type"))
5838      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
5839    if (json.has("text"))
5840      res.setTextElement(parseString(json.get("text").getAsString()));
5841    if (json.has("_text"))
5842      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
5843    if (json.has("language"))
5844      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
5845  }
5846
5847  protected ClaimResponse.InsuranceComponent parseClaimResponseInsuranceComponent(JsonObject json, ClaimResponse owner) throws IOException, FHIRFormatError {
5848    ClaimResponse.InsuranceComponent res = new ClaimResponse.InsuranceComponent();
5849    parseClaimResponseInsuranceComponentProperties(json, owner, res);
5850    return res;
5851  }
5852
5853  protected void parseClaimResponseInsuranceComponentProperties(JsonObject json, ClaimResponse owner, ClaimResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
5854    parseBackboneElementProperties(json, res);
5855    if (json.has("sequence"))
5856      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
5857    if (json.has("_sequence"))
5858      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
5859    if (json.has("focal"))
5860      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
5861    if (json.has("_focal"))
5862      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
5863    if (json.has("coverage"))
5864      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
5865    if (json.has("businessArrangement"))
5866      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
5867    if (json.has("_businessArrangement"))
5868      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
5869    if (json.has("claimResponse"))
5870      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
5871  }
5872
5873  protected ClinicalImpression parseClinicalImpression(JsonObject json) throws IOException, FHIRFormatError {
5874    ClinicalImpression res = new ClinicalImpression();
5875    parseClinicalImpressionProperties(json, res);
5876    return res;
5877  }
5878
5879  protected void parseClinicalImpressionProperties(JsonObject json, ClinicalImpression res) throws IOException, FHIRFormatError {
5880    parseDomainResourceProperties(json, res);
5881    if (json.has("identifier")) {
5882      JsonArray array = json.getAsJsonArray("identifier");
5883      for (int i = 0; i < array.size(); i++) {
5884        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
5885      }
5886    };
5887    if (json.has("status"))
5888      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ClinicalImpression.ClinicalImpressionStatus.NULL, new ClinicalImpression.ClinicalImpressionStatusEnumFactory()));
5889    if (json.has("_status"))
5890      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
5891    if (json.has("statusReason"))
5892      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
5893    if (json.has("code"))
5894      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5895    if (json.has("description"))
5896      res.setDescriptionElement(parseString(json.get("description").getAsString()));
5897    if (json.has("_description"))
5898      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
5899    if (json.has("subject"))
5900      res.setSubject(parseReference(json.getAsJsonObject("subject")));
5901    if (json.has("context"))
5902      res.setContext(parseReference(json.getAsJsonObject("context")));
5903    Type effective = parseType("effective", json);
5904    if (effective != null)
5905      res.setEffective(effective);
5906    if (json.has("date"))
5907      res.setDateElement(parseDateTime(json.get("date").getAsString()));
5908    if (json.has("_date"))
5909      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
5910    if (json.has("assessor"))
5911      res.setAssessor(parseReference(json.getAsJsonObject("assessor")));
5912    if (json.has("previous"))
5913      res.setPrevious(parseReference(json.getAsJsonObject("previous")));
5914    if (json.has("problem")) {
5915      JsonArray array = json.getAsJsonArray("problem");
5916      for (int i = 0; i < array.size(); i++) {
5917        res.getProblem().add(parseReference(array.get(i).getAsJsonObject()));
5918      }
5919    };
5920    if (json.has("investigation")) {
5921      JsonArray array = json.getAsJsonArray("investigation");
5922      for (int i = 0; i < array.size(); i++) {
5923        res.getInvestigation().add(parseClinicalImpressionClinicalImpressionInvestigationComponent(array.get(i).getAsJsonObject(), res));
5924      }
5925    };
5926    if (json.has("protocol")) {
5927      JsonArray array = json.getAsJsonArray("protocol");
5928      for (int i = 0; i < array.size(); i++) {
5929        res.getProtocol().add(parseUri(array.get(i).getAsString()));
5930      }
5931    };
5932    if (json.has("_protocol")) {
5933      JsonArray array = json.getAsJsonArray("_protocol");
5934      for (int i = 0; i < array.size(); i++) {
5935        if (i == res.getProtocol().size())
5936          res.getProtocol().add(parseUri(null));
5937        if (array.get(i) instanceof JsonObject) 
5938          parseElementProperties(array.get(i).getAsJsonObject(), res.getProtocol().get(i));
5939      }
5940    };
5941    if (json.has("summary"))
5942      res.setSummaryElement(parseString(json.get("summary").getAsString()));
5943    if (json.has("_summary"))
5944      parseElementProperties(json.getAsJsonObject("_summary"), res.getSummaryElement());
5945    if (json.has("finding")) {
5946      JsonArray array = json.getAsJsonArray("finding");
5947      for (int i = 0; i < array.size(); i++) {
5948        res.getFinding().add(parseClinicalImpressionClinicalImpressionFindingComponent(array.get(i).getAsJsonObject(), res));
5949      }
5950    };
5951    if (json.has("prognosisCodeableConcept")) {
5952      JsonArray array = json.getAsJsonArray("prognosisCodeableConcept");
5953      for (int i = 0; i < array.size(); i++) {
5954        res.getPrognosisCodeableConcept().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
5955      }
5956    };
5957    if (json.has("prognosisReference")) {
5958      JsonArray array = json.getAsJsonArray("prognosisReference");
5959      for (int i = 0; i < array.size(); i++) {
5960        res.getPrognosisReference().add(parseReference(array.get(i).getAsJsonObject()));
5961      }
5962    };
5963    if (json.has("supportingInfo")) {
5964      JsonArray array = json.getAsJsonArray("supportingInfo");
5965      for (int i = 0; i < array.size(); i++) {
5966        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
5967      }
5968    };
5969    if (json.has("note")) {
5970      JsonArray array = json.getAsJsonArray("note");
5971      for (int i = 0; i < array.size(); i++) {
5972        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
5973      }
5974    };
5975  }
5976
5977  protected ClinicalImpression.ClinicalImpressionInvestigationComponent parseClinicalImpressionClinicalImpressionInvestigationComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
5978    ClinicalImpression.ClinicalImpressionInvestigationComponent res = new ClinicalImpression.ClinicalImpressionInvestigationComponent();
5979    parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(json, owner, res);
5980    return res;
5981  }
5982
5983  protected void parseClinicalImpressionClinicalImpressionInvestigationComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionInvestigationComponent res) throws IOException, FHIRFormatError {
5984    parseBackboneElementProperties(json, res);
5985    if (json.has("code"))
5986      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
5987    if (json.has("item")) {
5988      JsonArray array = json.getAsJsonArray("item");
5989      for (int i = 0; i < array.size(); i++) {
5990        res.getItem().add(parseReference(array.get(i).getAsJsonObject()));
5991      }
5992    };
5993  }
5994
5995  protected ClinicalImpression.ClinicalImpressionFindingComponent parseClinicalImpressionClinicalImpressionFindingComponent(JsonObject json, ClinicalImpression owner) throws IOException, FHIRFormatError {
5996    ClinicalImpression.ClinicalImpressionFindingComponent res = new ClinicalImpression.ClinicalImpressionFindingComponent();
5997    parseClinicalImpressionClinicalImpressionFindingComponentProperties(json, owner, res);
5998    return res;
5999  }
6000
6001  protected void parseClinicalImpressionClinicalImpressionFindingComponentProperties(JsonObject json, ClinicalImpression owner, ClinicalImpression.ClinicalImpressionFindingComponent res) throws IOException, FHIRFormatError {
6002    parseBackboneElementProperties(json, res);
6003    if (json.has("itemCodeableConcept"))
6004      res.setItemCodeableConcept(parseCodeableConcept(json.getAsJsonObject("itemCodeableConcept")));
6005    if (json.has("itemReference"))
6006      res.setItemReference(parseReference(json.getAsJsonObject("itemReference")));
6007    if (json.has("basis"))
6008      res.setBasisElement(parseString(json.get("basis").getAsString()));
6009    if (json.has("_basis"))
6010      parseElementProperties(json.getAsJsonObject("_basis"), res.getBasisElement());
6011  }
6012
6013  protected CodeSystem parseCodeSystem(JsonObject json) throws IOException, FHIRFormatError {
6014    CodeSystem res = new CodeSystem();
6015    parseCodeSystemProperties(json, res);
6016    return res;
6017  }
6018
6019  protected void parseCodeSystemProperties(JsonObject json, CodeSystem res) throws IOException, FHIRFormatError {
6020    parseDomainResourceProperties(json, res);
6021    if (json.has("url"))
6022      res.setUrlElement(parseUri(json.get("url").getAsString()));
6023    if (json.has("_url"))
6024      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6025    if (json.has("identifier")) {
6026      JsonArray array = json.getAsJsonArray("identifier");
6027      for (int i = 0; i < array.size(); i++) {
6028        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6029      }
6030    };
6031    if (json.has("version"))
6032      res.setVersionElement(parseString(json.get("version").getAsString()));
6033    if (json.has("_version"))
6034      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6035    if (json.has("name"))
6036      res.setNameElement(parseString(json.get("name").getAsString()));
6037    if (json.has("_name"))
6038      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6039    if (json.has("title"))
6040      res.setTitleElement(parseString(json.get("title").getAsString()));
6041    if (json.has("_title"))
6042      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6043    if (json.has("status"))
6044      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6045    if (json.has("_status"))
6046      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6047    if (json.has("experimental"))
6048      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6049    if (json.has("_experimental"))
6050      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6051    if (json.has("date"))
6052      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6053    if (json.has("_date"))
6054      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6055    if (json.has("publisher"))
6056      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6057    if (json.has("_publisher"))
6058      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6059    if (json.has("contact")) {
6060      JsonArray array = json.getAsJsonArray("contact");
6061      for (int i = 0; i < array.size(); i++) {
6062        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6063      }
6064    };
6065    if (json.has("description"))
6066      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6067    if (json.has("_description"))
6068      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6069    if (json.has("useContext")) {
6070      JsonArray array = json.getAsJsonArray("useContext");
6071      for (int i = 0; i < array.size(); i++) {
6072        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6073      }
6074    };
6075    if (json.has("jurisdiction")) {
6076      JsonArray array = json.getAsJsonArray("jurisdiction");
6077      for (int i = 0; i < array.size(); i++) {
6078        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6079      }
6080    };
6081    if (json.has("purpose"))
6082      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6083    if (json.has("_purpose"))
6084      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6085    if (json.has("copyright"))
6086      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6087    if (json.has("_copyright"))
6088      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6089    if (json.has("caseSensitive"))
6090      res.setCaseSensitiveElement(parseBoolean(json.get("caseSensitive").getAsBoolean()));
6091    if (json.has("_caseSensitive"))
6092      parseElementProperties(json.getAsJsonObject("_caseSensitive"), res.getCaseSensitiveElement());
6093    if (json.has("valueSet"))
6094      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
6095    if (json.has("_valueSet"))
6096      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
6097    if (json.has("hierarchyMeaning"))
6098      res.setHierarchyMeaningElement(parseEnumeration(json.get("hierarchyMeaning").getAsString(), CodeSystem.CodeSystemHierarchyMeaning.NULL, new CodeSystem.CodeSystemHierarchyMeaningEnumFactory()));
6099    if (json.has("_hierarchyMeaning"))
6100      parseElementProperties(json.getAsJsonObject("_hierarchyMeaning"), res.getHierarchyMeaningElement());
6101    if (json.has("compositional"))
6102      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
6103    if (json.has("_compositional"))
6104      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
6105    if (json.has("versionNeeded"))
6106      res.setVersionNeededElement(parseBoolean(json.get("versionNeeded").getAsBoolean()));
6107    if (json.has("_versionNeeded"))
6108      parseElementProperties(json.getAsJsonObject("_versionNeeded"), res.getVersionNeededElement());
6109    if (json.has("content"))
6110      res.setContentElement(parseEnumeration(json.get("content").getAsString(), CodeSystem.CodeSystemContentMode.NULL, new CodeSystem.CodeSystemContentModeEnumFactory()));
6111    if (json.has("_content"))
6112      parseElementProperties(json.getAsJsonObject("_content"), res.getContentElement());
6113    if (json.has("supplements"))
6114      res.setSupplementsElement(parseCanonical(json.get("supplements").getAsString()));
6115    if (json.has("_supplements"))
6116      parseElementProperties(json.getAsJsonObject("_supplements"), res.getSupplementsElement());
6117    if (json.has("count"))
6118      res.setCountElement(parseUnsignedInt(json.get("count").getAsString()));
6119    if (json.has("_count"))
6120      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
6121    if (json.has("filter")) {
6122      JsonArray array = json.getAsJsonArray("filter");
6123      for (int i = 0; i < array.size(); i++) {
6124        res.getFilter().add(parseCodeSystemCodeSystemFilterComponent(array.get(i).getAsJsonObject(), res));
6125      }
6126    };
6127    if (json.has("property")) {
6128      JsonArray array = json.getAsJsonArray("property");
6129      for (int i = 0; i < array.size(); i++) {
6130        res.getProperty().add(parseCodeSystemPropertyComponent(array.get(i).getAsJsonObject(), res));
6131      }
6132    };
6133    if (json.has("concept")) {
6134      JsonArray array = json.getAsJsonArray("concept");
6135      for (int i = 0; i < array.size(); i++) {
6136        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), res));
6137      }
6138    };
6139  }
6140
6141  protected CodeSystem.CodeSystemFilterComponent parseCodeSystemCodeSystemFilterComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6142    CodeSystem.CodeSystemFilterComponent res = new CodeSystem.CodeSystemFilterComponent();
6143    parseCodeSystemCodeSystemFilterComponentProperties(json, owner, res);
6144    return res;
6145  }
6146
6147  protected void parseCodeSystemCodeSystemFilterComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.CodeSystemFilterComponent res) throws IOException, FHIRFormatError {
6148    parseBackboneElementProperties(json, res);
6149    if (json.has("code"))
6150      res.setCodeElement(parseCode(json.get("code").getAsString()));
6151    if (json.has("_code"))
6152      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6153    if (json.has("description"))
6154      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6155    if (json.has("_description"))
6156      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6157    if (json.has("operator")) {
6158      JsonArray array = json.getAsJsonArray("operator");
6159      for (int i = 0; i < array.size(); i++) {
6160        res.getOperator().add(parseEnumeration(array.get(i).getAsString(), CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
6161      }
6162    };
6163    if (json.has("_operator")) {
6164      JsonArray array = json.getAsJsonArray("_operator");
6165      for (int i = 0; i < array.size(); i++) {
6166        if (i == res.getOperator().size())
6167          res.getOperator().add(parseEnumeration(null, CodeSystem.FilterOperator.NULL, new CodeSystem.FilterOperatorEnumFactory()));
6168        if (array.get(i) instanceof JsonObject) 
6169          parseElementProperties(array.get(i).getAsJsonObject(), res.getOperator().get(i));
6170      }
6171    };
6172    if (json.has("value"))
6173      res.setValueElement(parseString(json.get("value").getAsString()));
6174    if (json.has("_value"))
6175      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6176  }
6177
6178  protected CodeSystem.PropertyComponent parseCodeSystemPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6179    CodeSystem.PropertyComponent res = new CodeSystem.PropertyComponent();
6180    parseCodeSystemPropertyComponentProperties(json, owner, res);
6181    return res;
6182  }
6183
6184  protected void parseCodeSystemPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.PropertyComponent res) throws IOException, FHIRFormatError {
6185    parseBackboneElementProperties(json, res);
6186    if (json.has("code"))
6187      res.setCodeElement(parseCode(json.get("code").getAsString()));
6188    if (json.has("_code"))
6189      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6190    if (json.has("uri"))
6191      res.setUriElement(parseUri(json.get("uri").getAsString()));
6192    if (json.has("_uri"))
6193      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
6194    if (json.has("description"))
6195      res.setDescriptionElement(parseString(json.get("description").getAsString()));
6196    if (json.has("_description"))
6197      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6198    if (json.has("type"))
6199      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), CodeSystem.PropertyType.NULL, new CodeSystem.PropertyTypeEnumFactory()));
6200    if (json.has("_type"))
6201      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
6202  }
6203
6204  protected CodeSystem.ConceptDefinitionComponent parseCodeSystemConceptDefinitionComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6205    CodeSystem.ConceptDefinitionComponent res = new CodeSystem.ConceptDefinitionComponent();
6206    parseCodeSystemConceptDefinitionComponentProperties(json, owner, res);
6207    return res;
6208  }
6209
6210  protected void parseCodeSystemConceptDefinitionComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionComponent res) throws IOException, FHIRFormatError {
6211    parseBackboneElementProperties(json, res);
6212    if (json.has("code"))
6213      res.setCodeElement(parseCode(json.get("code").getAsString()));
6214    if (json.has("_code"))
6215      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6216    if (json.has("display"))
6217      res.setDisplayElement(parseString(json.get("display").getAsString()));
6218    if (json.has("_display"))
6219      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6220    if (json.has("definition"))
6221      res.setDefinitionElement(parseString(json.get("definition").getAsString()));
6222    if (json.has("_definition"))
6223      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
6224    if (json.has("designation")) {
6225      JsonArray array = json.getAsJsonArray("designation");
6226      for (int i = 0; i < array.size(); i++) {
6227        res.getDesignation().add(parseCodeSystemConceptDefinitionDesignationComponent(array.get(i).getAsJsonObject(), owner));
6228      }
6229    };
6230    if (json.has("property")) {
6231      JsonArray array = json.getAsJsonArray("property");
6232      for (int i = 0; i < array.size(); i++) {
6233        res.getProperty().add(parseCodeSystemConceptPropertyComponent(array.get(i).getAsJsonObject(), owner));
6234      }
6235    };
6236    if (json.has("concept")) {
6237      JsonArray array = json.getAsJsonArray("concept");
6238      for (int i = 0; i < array.size(); i++) {
6239        res.getConcept().add(parseCodeSystemConceptDefinitionComponent(array.get(i).getAsJsonObject(), owner));
6240      }
6241    };
6242  }
6243
6244  protected CodeSystem.ConceptDefinitionDesignationComponent parseCodeSystemConceptDefinitionDesignationComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6245    CodeSystem.ConceptDefinitionDesignationComponent res = new CodeSystem.ConceptDefinitionDesignationComponent();
6246    parseCodeSystemConceptDefinitionDesignationComponentProperties(json, owner, res);
6247    return res;
6248  }
6249
6250  protected void parseCodeSystemConceptDefinitionDesignationComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptDefinitionDesignationComponent res) throws IOException, FHIRFormatError {
6251    parseBackboneElementProperties(json, res);
6252    if (json.has("language"))
6253      res.setLanguageElement(parseCode(json.get("language").getAsString()));
6254    if (json.has("_language"))
6255      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
6256    if (json.has("use"))
6257      res.setUse(parseCoding(json.getAsJsonObject("use")));
6258    if (json.has("value"))
6259      res.setValueElement(parseString(json.get("value").getAsString()));
6260    if (json.has("_value"))
6261      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
6262  }
6263
6264  protected CodeSystem.ConceptPropertyComponent parseCodeSystemConceptPropertyComponent(JsonObject json, CodeSystem owner) throws IOException, FHIRFormatError {
6265    CodeSystem.ConceptPropertyComponent res = new CodeSystem.ConceptPropertyComponent();
6266    parseCodeSystemConceptPropertyComponentProperties(json, owner, res);
6267    return res;
6268  }
6269
6270  protected void parseCodeSystemConceptPropertyComponentProperties(JsonObject json, CodeSystem owner, CodeSystem.ConceptPropertyComponent res) throws IOException, FHIRFormatError {
6271    parseBackboneElementProperties(json, res);
6272    if (json.has("code"))
6273      res.setCodeElement(parseCode(json.get("code").getAsString()));
6274    if (json.has("_code"))
6275      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6276    Type value = parseType("value", json);
6277    if (value != null)
6278      res.setValue(value);
6279  }
6280
6281  protected Communication parseCommunication(JsonObject json) throws IOException, FHIRFormatError {
6282    Communication res = new Communication();
6283    parseCommunicationProperties(json, res);
6284    return res;
6285  }
6286
6287  protected void parseCommunicationProperties(JsonObject json, Communication res) throws IOException, FHIRFormatError {
6288    parseDomainResourceProperties(json, res);
6289    if (json.has("identifier")) {
6290      JsonArray array = json.getAsJsonArray("identifier");
6291      for (int i = 0; i < array.size(); i++) {
6292        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6293      }
6294    };
6295    if (json.has("instantiatesCanonical")) {
6296      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
6297      for (int i = 0; i < array.size(); i++) {
6298        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
6299      }
6300    };
6301    if (json.has("_instantiatesCanonical")) {
6302      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
6303      for (int i = 0; i < array.size(); i++) {
6304        if (i == res.getInstantiatesCanonical().size())
6305          res.getInstantiatesCanonical().add(parseCanonical(null));
6306        if (array.get(i) instanceof JsonObject) 
6307          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
6308      }
6309    };
6310    if (json.has("instantiatesUri")) {
6311      JsonArray array = json.getAsJsonArray("instantiatesUri");
6312      for (int i = 0; i < array.size(); i++) {
6313        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
6314      }
6315    };
6316    if (json.has("_instantiatesUri")) {
6317      JsonArray array = json.getAsJsonArray("_instantiatesUri");
6318      for (int i = 0; i < array.size(); i++) {
6319        if (i == res.getInstantiatesUri().size())
6320          res.getInstantiatesUri().add(parseUri(null));
6321        if (array.get(i) instanceof JsonObject) 
6322          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
6323      }
6324    };
6325    if (json.has("basedOn")) {
6326      JsonArray array = json.getAsJsonArray("basedOn");
6327      for (int i = 0; i < array.size(); i++) {
6328        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
6329      }
6330    };
6331    if (json.has("partOf")) {
6332      JsonArray array = json.getAsJsonArray("partOf");
6333      for (int i = 0; i < array.size(); i++) {
6334        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
6335      }
6336    };
6337    if (json.has("inResponseTo")) {
6338      JsonArray array = json.getAsJsonArray("inResponseTo");
6339      for (int i = 0; i < array.size(); i++) {
6340        res.getInResponseTo().add(parseReference(array.get(i).getAsJsonObject()));
6341      }
6342    };
6343    if (json.has("status"))
6344      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Communication.CommunicationStatus.NULL, new Communication.CommunicationStatusEnumFactory()));
6345    if (json.has("_status"))
6346      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6347    if (json.has("statusReason"))
6348      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
6349    if (json.has("category")) {
6350      JsonArray array = json.getAsJsonArray("category");
6351      for (int i = 0; i < array.size(); i++) {
6352        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6353      }
6354    };
6355    if (json.has("priority"))
6356      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Communication.CommunicationPriority.NULL, new Communication.CommunicationPriorityEnumFactory()));
6357    if (json.has("_priority"))
6358      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
6359    if (json.has("medium")) {
6360      JsonArray array = json.getAsJsonArray("medium");
6361      for (int i = 0; i < array.size(); i++) {
6362        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6363      }
6364    };
6365    if (json.has("subject"))
6366      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6367    if (json.has("topic"))
6368      res.setTopic(parseCodeableConcept(json.getAsJsonObject("topic")));
6369    if (json.has("about")) {
6370      JsonArray array = json.getAsJsonArray("about");
6371      for (int i = 0; i < array.size(); i++) {
6372        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
6373      }
6374    };
6375    if (json.has("context"))
6376      res.setContext(parseReference(json.getAsJsonObject("context")));
6377    if (json.has("sent"))
6378      res.setSentElement(parseDateTime(json.get("sent").getAsString()));
6379    if (json.has("_sent"))
6380      parseElementProperties(json.getAsJsonObject("_sent"), res.getSentElement());
6381    if (json.has("received"))
6382      res.setReceivedElement(parseDateTime(json.get("received").getAsString()));
6383    if (json.has("_received"))
6384      parseElementProperties(json.getAsJsonObject("_received"), res.getReceivedElement());
6385    if (json.has("recipient")) {
6386      JsonArray array = json.getAsJsonArray("recipient");
6387      for (int i = 0; i < array.size(); i++) {
6388        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6389      }
6390    };
6391    if (json.has("sender"))
6392      res.setSender(parseReference(json.getAsJsonObject("sender")));
6393    if (json.has("reasonCode")) {
6394      JsonArray array = json.getAsJsonArray("reasonCode");
6395      for (int i = 0; i < array.size(); i++) {
6396        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6397      }
6398    };
6399    if (json.has("reasonReference")) {
6400      JsonArray array = json.getAsJsonArray("reasonReference");
6401      for (int i = 0; i < array.size(); i++) {
6402        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
6403      }
6404    };
6405    if (json.has("payload")) {
6406      JsonArray array = json.getAsJsonArray("payload");
6407      for (int i = 0; i < array.size(); i++) {
6408        res.getPayload().add(parseCommunicationCommunicationPayloadComponent(array.get(i).getAsJsonObject(), res));
6409      }
6410    };
6411    if (json.has("note")) {
6412      JsonArray array = json.getAsJsonArray("note");
6413      for (int i = 0; i < array.size(); i++) {
6414        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6415      }
6416    };
6417  }
6418
6419  protected Communication.CommunicationPayloadComponent parseCommunicationCommunicationPayloadComponent(JsonObject json, Communication owner) throws IOException, FHIRFormatError {
6420    Communication.CommunicationPayloadComponent res = new Communication.CommunicationPayloadComponent();
6421    parseCommunicationCommunicationPayloadComponentProperties(json, owner, res);
6422    return res;
6423  }
6424
6425  protected void parseCommunicationCommunicationPayloadComponentProperties(JsonObject json, Communication owner, Communication.CommunicationPayloadComponent res) throws IOException, FHIRFormatError {
6426    parseBackboneElementProperties(json, res);
6427    Type content = parseType("content", json);
6428    if (content != null)
6429      res.setContent(content);
6430  }
6431
6432  protected CommunicationRequest parseCommunicationRequest(JsonObject json) throws IOException, FHIRFormatError {
6433    CommunicationRequest res = new CommunicationRequest();
6434    parseCommunicationRequestProperties(json, res);
6435    return res;
6436  }
6437
6438  protected void parseCommunicationRequestProperties(JsonObject json, CommunicationRequest res) throws IOException, FHIRFormatError {
6439    parseDomainResourceProperties(json, res);
6440    if (json.has("identifier")) {
6441      JsonArray array = json.getAsJsonArray("identifier");
6442      for (int i = 0; i < array.size(); i++) {
6443        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
6444      }
6445    };
6446    if (json.has("basedOn")) {
6447      JsonArray array = json.getAsJsonArray("basedOn");
6448      for (int i = 0; i < array.size(); i++) {
6449        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
6450      }
6451    };
6452    if (json.has("replaces")) {
6453      JsonArray array = json.getAsJsonArray("replaces");
6454      for (int i = 0; i < array.size(); i++) {
6455        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
6456      }
6457    };
6458    if (json.has("groupIdentifier"))
6459      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
6460    if (json.has("status"))
6461      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CommunicationRequest.CommunicationRequestStatus.NULL, new CommunicationRequest.CommunicationRequestStatusEnumFactory()));
6462    if (json.has("_status"))
6463      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6464    if (json.has("statusReason"))
6465      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
6466    if (json.has("category")) {
6467      JsonArray array = json.getAsJsonArray("category");
6468      for (int i = 0; i < array.size(); i++) {
6469        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6470      }
6471    };
6472    if (json.has("priority"))
6473      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), CommunicationRequest.CommunicationPriority.NULL, new CommunicationRequest.CommunicationPriorityEnumFactory()));
6474    if (json.has("_priority"))
6475      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
6476    if (json.has("doNotPerform"))
6477      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
6478    if (json.has("_doNotPerform"))
6479      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
6480    if (json.has("medium")) {
6481      JsonArray array = json.getAsJsonArray("medium");
6482      for (int i = 0; i < array.size(); i++) {
6483        res.getMedium().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6484      }
6485    };
6486    if (json.has("subject"))
6487      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6488    if (json.has("about")) {
6489      JsonArray array = json.getAsJsonArray("about");
6490      for (int i = 0; i < array.size(); i++) {
6491        res.getAbout().add(parseReference(array.get(i).getAsJsonObject()));
6492      }
6493    };
6494    if (json.has("context"))
6495      res.setContext(parseReference(json.getAsJsonObject("context")));
6496    if (json.has("payload")) {
6497      JsonArray array = json.getAsJsonArray("payload");
6498      for (int i = 0; i < array.size(); i++) {
6499        res.getPayload().add(parseCommunicationRequestCommunicationRequestPayloadComponent(array.get(i).getAsJsonObject(), res));
6500      }
6501    };
6502    Type occurrence = parseType("occurrence", json);
6503    if (occurrence != null)
6504      res.setOccurrence(occurrence);
6505    if (json.has("authoredOn"))
6506      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
6507    if (json.has("_authoredOn"))
6508      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
6509    if (json.has("requester"))
6510      res.setRequester(parseReference(json.getAsJsonObject("requester")));
6511    if (json.has("recipient")) {
6512      JsonArray array = json.getAsJsonArray("recipient");
6513      for (int i = 0; i < array.size(); i++) {
6514        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
6515      }
6516    };
6517    if (json.has("sender"))
6518      res.setSender(parseReference(json.getAsJsonObject("sender")));
6519    if (json.has("reasonCode")) {
6520      JsonArray array = json.getAsJsonArray("reasonCode");
6521      for (int i = 0; i < array.size(); i++) {
6522        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6523      }
6524    };
6525    if (json.has("reasonReference")) {
6526      JsonArray array = json.getAsJsonArray("reasonReference");
6527      for (int i = 0; i < array.size(); i++) {
6528        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
6529      }
6530    };
6531    if (json.has("note")) {
6532      JsonArray array = json.getAsJsonArray("note");
6533      for (int i = 0; i < array.size(); i++) {
6534        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
6535      }
6536    };
6537  }
6538
6539  protected CommunicationRequest.CommunicationRequestPayloadComponent parseCommunicationRequestCommunicationRequestPayloadComponent(JsonObject json, CommunicationRequest owner) throws IOException, FHIRFormatError {
6540    CommunicationRequest.CommunicationRequestPayloadComponent res = new CommunicationRequest.CommunicationRequestPayloadComponent();
6541    parseCommunicationRequestCommunicationRequestPayloadComponentProperties(json, owner, res);
6542    return res;
6543  }
6544
6545  protected void parseCommunicationRequestCommunicationRequestPayloadComponentProperties(JsonObject json, CommunicationRequest owner, CommunicationRequest.CommunicationRequestPayloadComponent res) throws IOException, FHIRFormatError {
6546    parseBackboneElementProperties(json, res);
6547    Type content = parseType("content", json);
6548    if (content != null)
6549      res.setContent(content);
6550  }
6551
6552  protected CompartmentDefinition parseCompartmentDefinition(JsonObject json) throws IOException, FHIRFormatError {
6553    CompartmentDefinition res = new CompartmentDefinition();
6554    parseCompartmentDefinitionProperties(json, res);
6555    return res;
6556  }
6557
6558  protected void parseCompartmentDefinitionProperties(JsonObject json, CompartmentDefinition res) throws IOException, FHIRFormatError {
6559    parseDomainResourceProperties(json, res);
6560    if (json.has("url"))
6561      res.setUrlElement(parseUri(json.get("url").getAsString()));
6562    if (json.has("_url"))
6563      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6564    if (json.has("version"))
6565      res.setVersionElement(parseString(json.get("version").getAsString()));
6566    if (json.has("_version"))
6567      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6568    if (json.has("name"))
6569      res.setNameElement(parseString(json.get("name").getAsString()));
6570    if (json.has("_name"))
6571      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6572    if (json.has("status"))
6573      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6574    if (json.has("_status"))
6575      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6576    if (json.has("experimental"))
6577      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6578    if (json.has("_experimental"))
6579      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6580    if (json.has("date"))
6581      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6582    if (json.has("_date"))
6583      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6584    if (json.has("publisher"))
6585      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6586    if (json.has("_publisher"))
6587      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6588    if (json.has("contact")) {
6589      JsonArray array = json.getAsJsonArray("contact");
6590      for (int i = 0; i < array.size(); i++) {
6591        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6592      }
6593    };
6594    if (json.has("description"))
6595      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6596    if (json.has("_description"))
6597      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6598    if (json.has("useContext")) {
6599      JsonArray array = json.getAsJsonArray("useContext");
6600      for (int i = 0; i < array.size(); i++) {
6601        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6602      }
6603    };
6604    if (json.has("purpose"))
6605      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6606    if (json.has("_purpose"))
6607      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6608    if (json.has("code"))
6609      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), CompartmentDefinition.CompartmentType.NULL, new CompartmentDefinition.CompartmentTypeEnumFactory()));
6610    if (json.has("_code"))
6611      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6612    if (json.has("search"))
6613      res.setSearchElement(parseBoolean(json.get("search").getAsBoolean()));
6614    if (json.has("_search"))
6615      parseElementProperties(json.getAsJsonObject("_search"), res.getSearchElement());
6616    if (json.has("resource")) {
6617      JsonArray array = json.getAsJsonArray("resource");
6618      for (int i = 0; i < array.size(); i++) {
6619        res.getResource().add(parseCompartmentDefinitionCompartmentDefinitionResourceComponent(array.get(i).getAsJsonObject(), res));
6620      }
6621    };
6622  }
6623
6624  protected CompartmentDefinition.CompartmentDefinitionResourceComponent parseCompartmentDefinitionCompartmentDefinitionResourceComponent(JsonObject json, CompartmentDefinition owner) throws IOException, FHIRFormatError {
6625    CompartmentDefinition.CompartmentDefinitionResourceComponent res = new CompartmentDefinition.CompartmentDefinitionResourceComponent();
6626    parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(json, owner, res);
6627    return res;
6628  }
6629
6630  protected void parseCompartmentDefinitionCompartmentDefinitionResourceComponentProperties(JsonObject json, CompartmentDefinition owner, CompartmentDefinition.CompartmentDefinitionResourceComponent res) throws IOException, FHIRFormatError {
6631    parseBackboneElementProperties(json, res);
6632    if (json.has("code"))
6633      res.setCodeElement(parseCode(json.get("code").getAsString()));
6634    if (json.has("_code"))
6635      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6636    if (json.has("param")) {
6637      JsonArray array = json.getAsJsonArray("param");
6638      for (int i = 0; i < array.size(); i++) {
6639        res.getParam().add(parseString(array.get(i).getAsString()));
6640      }
6641    };
6642    if (json.has("_param")) {
6643      JsonArray array = json.getAsJsonArray("_param");
6644      for (int i = 0; i < array.size(); i++) {
6645        if (i == res.getParam().size())
6646          res.getParam().add(parseString(null));
6647        if (array.get(i) instanceof JsonObject) 
6648          parseElementProperties(array.get(i).getAsJsonObject(), res.getParam().get(i));
6649      }
6650    };
6651    if (json.has("documentation"))
6652      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
6653    if (json.has("_documentation"))
6654      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
6655  }
6656
6657  protected Composition parseComposition(JsonObject json) throws IOException, FHIRFormatError {
6658    Composition res = new Composition();
6659    parseCompositionProperties(json, res);
6660    return res;
6661  }
6662
6663  protected void parseCompositionProperties(JsonObject json, Composition res) throws IOException, FHIRFormatError {
6664    parseDomainResourceProperties(json, res);
6665    if (json.has("identifier"))
6666      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6667    if (json.has("status"))
6668      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Composition.CompositionStatus.NULL, new Composition.CompositionStatusEnumFactory()));
6669    if (json.has("_status"))
6670      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6671    if (json.has("type"))
6672      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
6673    if (json.has("category")) {
6674      JsonArray array = json.getAsJsonArray("category");
6675      for (int i = 0; i < array.size(); i++) {
6676        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6677      }
6678    };
6679    if (json.has("subject"))
6680      res.setSubject(parseReference(json.getAsJsonObject("subject")));
6681    if (json.has("encounter"))
6682      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
6683    if (json.has("date"))
6684      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6685    if (json.has("_date"))
6686      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6687    if (json.has("author")) {
6688      JsonArray array = json.getAsJsonArray("author");
6689      for (int i = 0; i < array.size(); i++) {
6690        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6691      }
6692    };
6693    if (json.has("title"))
6694      res.setTitleElement(parseString(json.get("title").getAsString()));
6695    if (json.has("_title"))
6696      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6697    if (json.has("confidentiality"))
6698      res.setConfidentialityElement(parseEnumeration(json.get("confidentiality").getAsString(), Composition.DocumentConfidentiality.NULL, new Composition.DocumentConfidentialityEnumFactory()));
6699    if (json.has("_confidentiality"))
6700      parseElementProperties(json.getAsJsonObject("_confidentiality"), res.getConfidentialityElement());
6701    if (json.has("attester")) {
6702      JsonArray array = json.getAsJsonArray("attester");
6703      for (int i = 0; i < array.size(); i++) {
6704        res.getAttester().add(parseCompositionCompositionAttesterComponent(array.get(i).getAsJsonObject(), res));
6705      }
6706    };
6707    if (json.has("custodian"))
6708      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
6709    if (json.has("relatesTo")) {
6710      JsonArray array = json.getAsJsonArray("relatesTo");
6711      for (int i = 0; i < array.size(); i++) {
6712        res.getRelatesTo().add(parseCompositionCompositionRelatesToComponent(array.get(i).getAsJsonObject(), res));
6713      }
6714    };
6715    if (json.has("event")) {
6716      JsonArray array = json.getAsJsonArray("event");
6717      for (int i = 0; i < array.size(); i++) {
6718        res.getEvent().add(parseCompositionCompositionEventComponent(array.get(i).getAsJsonObject(), res));
6719      }
6720    };
6721    if (json.has("section")) {
6722      JsonArray array = json.getAsJsonArray("section");
6723      for (int i = 0; i < array.size(); i++) {
6724        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), res));
6725      }
6726    };
6727  }
6728
6729  protected Composition.CompositionAttesterComponent parseCompositionCompositionAttesterComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6730    Composition.CompositionAttesterComponent res = new Composition.CompositionAttesterComponent();
6731    parseCompositionCompositionAttesterComponentProperties(json, owner, res);
6732    return res;
6733  }
6734
6735  protected void parseCompositionCompositionAttesterComponentProperties(JsonObject json, Composition owner, Composition.CompositionAttesterComponent res) throws IOException, FHIRFormatError {
6736    parseBackboneElementProperties(json, res);
6737    if (json.has("mode"))
6738      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.CompositionAttestationMode.NULL, new Composition.CompositionAttestationModeEnumFactory()));
6739    if (json.has("_mode"))
6740      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6741    if (json.has("time"))
6742      res.setTimeElement(parseDateTime(json.get("time").getAsString()));
6743    if (json.has("_time"))
6744      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
6745    if (json.has("party"))
6746      res.setParty(parseReference(json.getAsJsonObject("party")));
6747  }
6748
6749  protected Composition.CompositionRelatesToComponent parseCompositionCompositionRelatesToComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6750    Composition.CompositionRelatesToComponent res = new Composition.CompositionRelatesToComponent();
6751    parseCompositionCompositionRelatesToComponentProperties(json, owner, res);
6752    return res;
6753  }
6754
6755  protected void parseCompositionCompositionRelatesToComponentProperties(JsonObject json, Composition owner, Composition.CompositionRelatesToComponent res) throws IOException, FHIRFormatError {
6756    parseBackboneElementProperties(json, res);
6757    if (json.has("code"))
6758      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), Composition.DocumentRelationshipType.NULL, new Composition.DocumentRelationshipTypeEnumFactory()));
6759    if (json.has("_code"))
6760      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6761    Type target = parseType("target", json);
6762    if (target != null)
6763      res.setTarget(target);
6764  }
6765
6766  protected Composition.CompositionEventComponent parseCompositionCompositionEventComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6767    Composition.CompositionEventComponent res = new Composition.CompositionEventComponent();
6768    parseCompositionCompositionEventComponentProperties(json, owner, res);
6769    return res;
6770  }
6771
6772  protected void parseCompositionCompositionEventComponentProperties(JsonObject json, Composition owner, Composition.CompositionEventComponent res) throws IOException, FHIRFormatError {
6773    parseBackboneElementProperties(json, res);
6774    if (json.has("code")) {
6775      JsonArray array = json.getAsJsonArray("code");
6776      for (int i = 0; i < array.size(); i++) {
6777        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6778      }
6779    };
6780    if (json.has("period"))
6781      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
6782    if (json.has("detail")) {
6783      JsonArray array = json.getAsJsonArray("detail");
6784      for (int i = 0; i < array.size(); i++) {
6785        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
6786      }
6787    };
6788  }
6789
6790  protected Composition.SectionComponent parseCompositionSectionComponent(JsonObject json, Composition owner) throws IOException, FHIRFormatError {
6791    Composition.SectionComponent res = new Composition.SectionComponent();
6792    parseCompositionSectionComponentProperties(json, owner, res);
6793    return res;
6794  }
6795
6796  protected void parseCompositionSectionComponentProperties(JsonObject json, Composition owner, Composition.SectionComponent res) throws IOException, FHIRFormatError {
6797    parseBackboneElementProperties(json, res);
6798    if (json.has("title"))
6799      res.setTitleElement(parseString(json.get("title").getAsString()));
6800    if (json.has("_title"))
6801      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6802    if (json.has("code"))
6803      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
6804    if (json.has("author")) {
6805      JsonArray array = json.getAsJsonArray("author");
6806      for (int i = 0; i < array.size(); i++) {
6807        res.getAuthor().add(parseReference(array.get(i).getAsJsonObject()));
6808      }
6809    };
6810    if (json.has("text"))
6811      res.setText(parseNarrative(json.getAsJsonObject("text")));
6812    if (json.has("mode"))
6813      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Composition.SectionMode.NULL, new Composition.SectionModeEnumFactory()));
6814    if (json.has("_mode"))
6815      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
6816    if (json.has("orderedBy"))
6817      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
6818    if (json.has("entry")) {
6819      JsonArray array = json.getAsJsonArray("entry");
6820      for (int i = 0; i < array.size(); i++) {
6821        res.getEntry().add(parseReference(array.get(i).getAsJsonObject()));
6822      }
6823    };
6824    if (json.has("emptyReason"))
6825      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
6826    if (json.has("section")) {
6827      JsonArray array = json.getAsJsonArray("section");
6828      for (int i = 0; i < array.size(); i++) {
6829        res.getSection().add(parseCompositionSectionComponent(array.get(i).getAsJsonObject(), owner));
6830      }
6831    };
6832  }
6833
6834  protected ConceptMap parseConceptMap(JsonObject json) throws IOException, FHIRFormatError {
6835    ConceptMap res = new ConceptMap();
6836    parseConceptMapProperties(json, res);
6837    return res;
6838  }
6839
6840  protected void parseConceptMapProperties(JsonObject json, ConceptMap res) throws IOException, FHIRFormatError {
6841    parseDomainResourceProperties(json, res);
6842    if (json.has("url"))
6843      res.setUrlElement(parseUri(json.get("url").getAsString()));
6844    if (json.has("_url"))
6845      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
6846    if (json.has("identifier"))
6847      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
6848    if (json.has("version"))
6849      res.setVersionElement(parseString(json.get("version").getAsString()));
6850    if (json.has("_version"))
6851      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
6852    if (json.has("name"))
6853      res.setNameElement(parseString(json.get("name").getAsString()));
6854    if (json.has("_name"))
6855      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
6856    if (json.has("title"))
6857      res.setTitleElement(parseString(json.get("title").getAsString()));
6858    if (json.has("_title"))
6859      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
6860    if (json.has("status"))
6861      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
6862    if (json.has("_status"))
6863      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
6864    if (json.has("experimental"))
6865      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
6866    if (json.has("_experimental"))
6867      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
6868    if (json.has("date"))
6869      res.setDateElement(parseDateTime(json.get("date").getAsString()));
6870    if (json.has("_date"))
6871      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
6872    if (json.has("publisher"))
6873      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
6874    if (json.has("_publisher"))
6875      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
6876    if (json.has("contact")) {
6877      JsonArray array = json.getAsJsonArray("contact");
6878      for (int i = 0; i < array.size(); i++) {
6879        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
6880      }
6881    };
6882    if (json.has("description"))
6883      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
6884    if (json.has("_description"))
6885      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
6886    if (json.has("useContext")) {
6887      JsonArray array = json.getAsJsonArray("useContext");
6888      for (int i = 0; i < array.size(); i++) {
6889        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
6890      }
6891    };
6892    if (json.has("jurisdiction")) {
6893      JsonArray array = json.getAsJsonArray("jurisdiction");
6894      for (int i = 0; i < array.size(); i++) {
6895        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
6896      }
6897    };
6898    if (json.has("purpose"))
6899      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
6900    if (json.has("_purpose"))
6901      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
6902    if (json.has("copyright"))
6903      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
6904    if (json.has("_copyright"))
6905      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
6906    Type source = parseType("source", json);
6907    if (source != null)
6908      res.setSource(source);
6909    Type target = parseType("target", json);
6910    if (target != null)
6911      res.setTarget(target);
6912    if (json.has("group")) {
6913      JsonArray array = json.getAsJsonArray("group");
6914      for (int i = 0; i < array.size(); i++) {
6915        res.getGroup().add(parseConceptMapConceptMapGroupComponent(array.get(i).getAsJsonObject(), res));
6916      }
6917    };
6918  }
6919
6920  protected ConceptMap.ConceptMapGroupComponent parseConceptMapConceptMapGroupComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6921    ConceptMap.ConceptMapGroupComponent res = new ConceptMap.ConceptMapGroupComponent();
6922    parseConceptMapConceptMapGroupComponentProperties(json, owner, res);
6923    return res;
6924  }
6925
6926  protected void parseConceptMapConceptMapGroupComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupComponent res) throws IOException, FHIRFormatError {
6927    parseBackboneElementProperties(json, res);
6928    if (json.has("source"))
6929      res.setSourceElement(parseUri(json.get("source").getAsString()));
6930    if (json.has("_source"))
6931      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
6932    if (json.has("sourceVersion"))
6933      res.setSourceVersionElement(parseString(json.get("sourceVersion").getAsString()));
6934    if (json.has("_sourceVersion"))
6935      parseElementProperties(json.getAsJsonObject("_sourceVersion"), res.getSourceVersionElement());
6936    if (json.has("target"))
6937      res.setTargetElement(parseUri(json.get("target").getAsString()));
6938    if (json.has("_target"))
6939      parseElementProperties(json.getAsJsonObject("_target"), res.getTargetElement());
6940    if (json.has("targetVersion"))
6941      res.setTargetVersionElement(parseString(json.get("targetVersion").getAsString()));
6942    if (json.has("_targetVersion"))
6943      parseElementProperties(json.getAsJsonObject("_targetVersion"), res.getTargetVersionElement());
6944    if (json.has("element")) {
6945      JsonArray array = json.getAsJsonArray("element");
6946      for (int i = 0; i < array.size(); i++) {
6947        res.getElement().add(parseConceptMapSourceElementComponent(array.get(i).getAsJsonObject(), owner));
6948      }
6949    };
6950    if (json.has("unmapped"))
6951      res.setUnmapped(parseConceptMapConceptMapGroupUnmappedComponent(json.getAsJsonObject("unmapped"), owner));
6952  }
6953
6954  protected ConceptMap.SourceElementComponent parseConceptMapSourceElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6955    ConceptMap.SourceElementComponent res = new ConceptMap.SourceElementComponent();
6956    parseConceptMapSourceElementComponentProperties(json, owner, res);
6957    return res;
6958  }
6959
6960  protected void parseConceptMapSourceElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.SourceElementComponent res) throws IOException, FHIRFormatError {
6961    parseBackboneElementProperties(json, res);
6962    if (json.has("code"))
6963      res.setCodeElement(parseCode(json.get("code").getAsString()));
6964    if (json.has("_code"))
6965      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6966    if (json.has("display"))
6967      res.setDisplayElement(parseString(json.get("display").getAsString()));
6968    if (json.has("_display"))
6969      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6970    if (json.has("target")) {
6971      JsonArray array = json.getAsJsonArray("target");
6972      for (int i = 0; i < array.size(); i++) {
6973        res.getTarget().add(parseConceptMapTargetElementComponent(array.get(i).getAsJsonObject(), owner));
6974      }
6975    };
6976  }
6977
6978  protected ConceptMap.TargetElementComponent parseConceptMapTargetElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
6979    ConceptMap.TargetElementComponent res = new ConceptMap.TargetElementComponent();
6980    parseConceptMapTargetElementComponentProperties(json, owner, res);
6981    return res;
6982  }
6983
6984  protected void parseConceptMapTargetElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.TargetElementComponent res) throws IOException, FHIRFormatError {
6985    parseBackboneElementProperties(json, res);
6986    if (json.has("code"))
6987      res.setCodeElement(parseCode(json.get("code").getAsString()));
6988    if (json.has("_code"))
6989      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
6990    if (json.has("display"))
6991      res.setDisplayElement(parseString(json.get("display").getAsString()));
6992    if (json.has("_display"))
6993      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
6994    if (json.has("equivalence"))
6995      res.setEquivalenceElement(parseEnumeration(json.get("equivalence").getAsString(), Enumerations.ConceptMapEquivalence.NULL, new Enumerations.ConceptMapEquivalenceEnumFactory()));
6996    if (json.has("_equivalence"))
6997      parseElementProperties(json.getAsJsonObject("_equivalence"), res.getEquivalenceElement());
6998    if (json.has("comment"))
6999      res.setCommentElement(parseString(json.get("comment").getAsString()));
7000    if (json.has("_comment"))
7001      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
7002    if (json.has("dependsOn")) {
7003      JsonArray array = json.getAsJsonArray("dependsOn");
7004      for (int i = 0; i < array.size(); i++) {
7005        res.getDependsOn().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7006      }
7007    };
7008    if (json.has("product")) {
7009      JsonArray array = json.getAsJsonArray("product");
7010      for (int i = 0; i < array.size(); i++) {
7011        res.getProduct().add(parseConceptMapOtherElementComponent(array.get(i).getAsJsonObject(), owner));
7012      }
7013    };
7014  }
7015
7016  protected ConceptMap.OtherElementComponent parseConceptMapOtherElementComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7017    ConceptMap.OtherElementComponent res = new ConceptMap.OtherElementComponent();
7018    parseConceptMapOtherElementComponentProperties(json, owner, res);
7019    return res;
7020  }
7021
7022  protected void parseConceptMapOtherElementComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.OtherElementComponent res) throws IOException, FHIRFormatError {
7023    parseBackboneElementProperties(json, res);
7024    if (json.has("property"))
7025      res.setPropertyElement(parseUri(json.get("property").getAsString()));
7026    if (json.has("_property"))
7027      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
7028    if (json.has("system"))
7029      res.setSystemElement(parseCanonical(json.get("system").getAsString()));
7030    if (json.has("_system"))
7031      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
7032    if (json.has("value"))
7033      res.setValueElement(parseString(json.get("value").getAsString()));
7034    if (json.has("_value"))
7035      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
7036    if (json.has("display"))
7037      res.setDisplayElement(parseString(json.get("display").getAsString()));
7038    if (json.has("_display"))
7039      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7040  }
7041
7042  protected ConceptMap.ConceptMapGroupUnmappedComponent parseConceptMapConceptMapGroupUnmappedComponent(JsonObject json, ConceptMap owner) throws IOException, FHIRFormatError {
7043    ConceptMap.ConceptMapGroupUnmappedComponent res = new ConceptMap.ConceptMapGroupUnmappedComponent();
7044    parseConceptMapConceptMapGroupUnmappedComponentProperties(json, owner, res);
7045    return res;
7046  }
7047
7048  protected void parseConceptMapConceptMapGroupUnmappedComponentProperties(JsonObject json, ConceptMap owner, ConceptMap.ConceptMapGroupUnmappedComponent res) throws IOException, FHIRFormatError {
7049    parseBackboneElementProperties(json, res);
7050    if (json.has("mode"))
7051      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ConceptMap.ConceptMapGroupUnmappedMode.NULL, new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory()));
7052    if (json.has("_mode"))
7053      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
7054    if (json.has("code"))
7055      res.setCodeElement(parseCode(json.get("code").getAsString()));
7056    if (json.has("_code"))
7057      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
7058    if (json.has("display"))
7059      res.setDisplayElement(parseString(json.get("display").getAsString()));
7060    if (json.has("_display"))
7061      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
7062    if (json.has("url"))
7063      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
7064    if (json.has("_url"))
7065      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7066  }
7067
7068  protected Condition parseCondition(JsonObject json) throws IOException, FHIRFormatError {
7069    Condition res = new Condition();
7070    parseConditionProperties(json, res);
7071    return res;
7072  }
7073
7074  protected void parseConditionProperties(JsonObject json, Condition res) throws IOException, FHIRFormatError {
7075    parseDomainResourceProperties(json, res);
7076    if (json.has("identifier")) {
7077      JsonArray array = json.getAsJsonArray("identifier");
7078      for (int i = 0; i < array.size(); i++) {
7079        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7080      }
7081    };
7082    if (json.has("clinicalStatus"))
7083      res.setClinicalStatus(parseCodeableConcept(json.getAsJsonObject("clinicalStatus")));
7084    if (json.has("verificationStatus"))
7085      res.setVerificationStatus(parseCodeableConcept(json.getAsJsonObject("verificationStatus")));
7086    if (json.has("category")) {
7087      JsonArray array = json.getAsJsonArray("category");
7088      for (int i = 0; i < array.size(); i++) {
7089        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7090      }
7091    };
7092    if (json.has("severity"))
7093      res.setSeverity(parseCodeableConcept(json.getAsJsonObject("severity")));
7094    if (json.has("code"))
7095      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
7096    if (json.has("bodySite")) {
7097      JsonArray array = json.getAsJsonArray("bodySite");
7098      for (int i = 0; i < array.size(); i++) {
7099        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7100      }
7101    };
7102    if (json.has("subject"))
7103      res.setSubject(parseReference(json.getAsJsonObject("subject")));
7104    if (json.has("context"))
7105      res.setContext(parseReference(json.getAsJsonObject("context")));
7106    Type onset = parseType("onset", json);
7107    if (onset != null)
7108      res.setOnset(onset);
7109    Type abatement = parseType("abatement", json);
7110    if (abatement != null)
7111      res.setAbatement(abatement);
7112    if (json.has("recordedDate"))
7113      res.setRecordedDateElement(parseDateTime(json.get("recordedDate").getAsString()));
7114    if (json.has("_recordedDate"))
7115      parseElementProperties(json.getAsJsonObject("_recordedDate"), res.getRecordedDateElement());
7116    if (json.has("recorder"))
7117      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
7118    if (json.has("asserter"))
7119      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
7120    if (json.has("stage")) {
7121      JsonArray array = json.getAsJsonArray("stage");
7122      for (int i = 0; i < array.size(); i++) {
7123        res.getStage().add(parseConditionConditionStageComponent(array.get(i).getAsJsonObject(), res));
7124      }
7125    };
7126    if (json.has("evidence")) {
7127      JsonArray array = json.getAsJsonArray("evidence");
7128      for (int i = 0; i < array.size(); i++) {
7129        res.getEvidence().add(parseConditionConditionEvidenceComponent(array.get(i).getAsJsonObject(), res));
7130      }
7131    };
7132    if (json.has("note")) {
7133      JsonArray array = json.getAsJsonArray("note");
7134      for (int i = 0; i < array.size(); i++) {
7135        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
7136      }
7137    };
7138  }
7139
7140  protected Condition.ConditionStageComponent parseConditionConditionStageComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
7141    Condition.ConditionStageComponent res = new Condition.ConditionStageComponent();
7142    parseConditionConditionStageComponentProperties(json, owner, res);
7143    return res;
7144  }
7145
7146  protected void parseConditionConditionStageComponentProperties(JsonObject json, Condition owner, Condition.ConditionStageComponent res) throws IOException, FHIRFormatError {
7147    parseBackboneElementProperties(json, res);
7148    if (json.has("summary"))
7149      res.setSummary(parseCodeableConcept(json.getAsJsonObject("summary")));
7150    if (json.has("assessment")) {
7151      JsonArray array = json.getAsJsonArray("assessment");
7152      for (int i = 0; i < array.size(); i++) {
7153        res.getAssessment().add(parseReference(array.get(i).getAsJsonObject()));
7154      }
7155    };
7156    if (json.has("type"))
7157      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7158  }
7159
7160  protected Condition.ConditionEvidenceComponent parseConditionConditionEvidenceComponent(JsonObject json, Condition owner) throws IOException, FHIRFormatError {
7161    Condition.ConditionEvidenceComponent res = new Condition.ConditionEvidenceComponent();
7162    parseConditionConditionEvidenceComponentProperties(json, owner, res);
7163    return res;
7164  }
7165
7166  protected void parseConditionConditionEvidenceComponentProperties(JsonObject json, Condition owner, Condition.ConditionEvidenceComponent res) throws IOException, FHIRFormatError {
7167    parseBackboneElementProperties(json, res);
7168    if (json.has("code")) {
7169      JsonArray array = json.getAsJsonArray("code");
7170      for (int i = 0; i < array.size(); i++) {
7171        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7172      }
7173    };
7174    if (json.has("detail")) {
7175      JsonArray array = json.getAsJsonArray("detail");
7176      for (int i = 0; i < array.size(); i++) {
7177        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
7178      }
7179    };
7180  }
7181
7182  protected Consent parseConsent(JsonObject json) throws IOException, FHIRFormatError {
7183    Consent res = new Consent();
7184    parseConsentProperties(json, res);
7185    return res;
7186  }
7187
7188  protected void parseConsentProperties(JsonObject json, Consent res) throws IOException, FHIRFormatError {
7189    parseDomainResourceProperties(json, res);
7190    if (json.has("identifier")) {
7191      JsonArray array = json.getAsJsonArray("identifier");
7192      for (int i = 0; i < array.size(); i++) {
7193        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7194      }
7195    };
7196    if (json.has("status"))
7197      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Consent.ConsentState.NULL, new Consent.ConsentStateEnumFactory()));
7198    if (json.has("_status"))
7199      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7200    if (json.has("scope"))
7201      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
7202    if (json.has("category")) {
7203      JsonArray array = json.getAsJsonArray("category");
7204      for (int i = 0; i < array.size(); i++) {
7205        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7206      }
7207    };
7208    if (json.has("patient"))
7209      res.setPatient(parseReference(json.getAsJsonObject("patient")));
7210    if (json.has("dateTime"))
7211      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
7212    if (json.has("_dateTime"))
7213      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
7214    if (json.has("performer")) {
7215      JsonArray array = json.getAsJsonArray("performer");
7216      for (int i = 0; i < array.size(); i++) {
7217        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
7218      }
7219    };
7220    if (json.has("organization")) {
7221      JsonArray array = json.getAsJsonArray("organization");
7222      for (int i = 0; i < array.size(); i++) {
7223        res.getOrganization().add(parseReference(array.get(i).getAsJsonObject()));
7224      }
7225    };
7226    Type source = parseType("source", json);
7227    if (source != null)
7228      res.setSource(source);
7229    if (json.has("policy")) {
7230      JsonArray array = json.getAsJsonArray("policy");
7231      for (int i = 0; i < array.size(); i++) {
7232        res.getPolicy().add(parseConsentConsentPolicyComponent(array.get(i).getAsJsonObject(), res));
7233      }
7234    };
7235    if (json.has("policyRule"))
7236      res.setPolicyRule(parseCodeableConcept(json.getAsJsonObject("policyRule")));
7237    if (json.has("verification")) {
7238      JsonArray array = json.getAsJsonArray("verification");
7239      for (int i = 0; i < array.size(); i++) {
7240        res.getVerification().add(parseConsentConsentVerificationComponent(array.get(i).getAsJsonObject(), res));
7241      }
7242    };
7243    if (json.has("provision"))
7244      res.setProvision(parseConsentprovisionComponent(json.getAsJsonObject("provision"), res));
7245  }
7246
7247  protected Consent.ConsentPolicyComponent parseConsentConsentPolicyComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7248    Consent.ConsentPolicyComponent res = new Consent.ConsentPolicyComponent();
7249    parseConsentConsentPolicyComponentProperties(json, owner, res);
7250    return res;
7251  }
7252
7253  protected void parseConsentConsentPolicyComponentProperties(JsonObject json, Consent owner, Consent.ConsentPolicyComponent res) throws IOException, FHIRFormatError {
7254    parseBackboneElementProperties(json, res);
7255    if (json.has("authority"))
7256      res.setAuthorityElement(parseUri(json.get("authority").getAsString()));
7257    if (json.has("_authority"))
7258      parseElementProperties(json.getAsJsonObject("_authority"), res.getAuthorityElement());
7259    if (json.has("uri"))
7260      res.setUriElement(parseUri(json.get("uri").getAsString()));
7261    if (json.has("_uri"))
7262      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
7263  }
7264
7265  protected Consent.ConsentVerificationComponent parseConsentConsentVerificationComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7266    Consent.ConsentVerificationComponent res = new Consent.ConsentVerificationComponent();
7267    parseConsentConsentVerificationComponentProperties(json, owner, res);
7268    return res;
7269  }
7270
7271  protected void parseConsentConsentVerificationComponentProperties(JsonObject json, Consent owner, Consent.ConsentVerificationComponent res) throws IOException, FHIRFormatError {
7272    parseBackboneElementProperties(json, res);
7273    if (json.has("verified"))
7274      res.setVerifiedElement(parseBoolean(json.get("verified").getAsBoolean()));
7275    if (json.has("_verified"))
7276      parseElementProperties(json.getAsJsonObject("_verified"), res.getVerifiedElement());
7277    if (json.has("verifiedWith"))
7278      res.setVerifiedWith(parseReference(json.getAsJsonObject("verifiedWith")));
7279    if (json.has("verificationDate"))
7280      res.setVerificationDateElement(parseDateTime(json.get("verificationDate").getAsString()));
7281    if (json.has("_verificationDate"))
7282      parseElementProperties(json.getAsJsonObject("_verificationDate"), res.getVerificationDateElement());
7283  }
7284
7285  protected Consent.provisionComponent parseConsentprovisionComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7286    Consent.provisionComponent res = new Consent.provisionComponent();
7287    parseConsentprovisionComponentProperties(json, owner, res);
7288    return res;
7289  }
7290
7291  protected void parseConsentprovisionComponentProperties(JsonObject json, Consent owner, Consent.provisionComponent res) throws IOException, FHIRFormatError {
7292    parseBackboneElementProperties(json, res);
7293    if (json.has("type"))
7294      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Consent.ConsentProvisionType.NULL, new Consent.ConsentProvisionTypeEnumFactory()));
7295    if (json.has("_type"))
7296      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
7297    if (json.has("period"))
7298      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
7299    if (json.has("actor")) {
7300      JsonArray array = json.getAsJsonArray("actor");
7301      for (int i = 0; i < array.size(); i++) {
7302        res.getActor().add(parseConsentprovisionActorComponent(array.get(i).getAsJsonObject(), owner));
7303      }
7304    };
7305    if (json.has("action")) {
7306      JsonArray array = json.getAsJsonArray("action");
7307      for (int i = 0; i < array.size(); i++) {
7308        res.getAction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7309      }
7310    };
7311    if (json.has("securityLabel")) {
7312      JsonArray array = json.getAsJsonArray("securityLabel");
7313      for (int i = 0; i < array.size(); i++) {
7314        res.getSecurityLabel().add(parseCoding(array.get(i).getAsJsonObject()));
7315      }
7316    };
7317    if (json.has("purpose")) {
7318      JsonArray array = json.getAsJsonArray("purpose");
7319      for (int i = 0; i < array.size(); i++) {
7320        res.getPurpose().add(parseCoding(array.get(i).getAsJsonObject()));
7321      }
7322    };
7323    if (json.has("class")) {
7324      JsonArray array = json.getAsJsonArray("class");
7325      for (int i = 0; i < array.size(); i++) {
7326        res.getClass_().add(parseCoding(array.get(i).getAsJsonObject()));
7327      }
7328    };
7329    if (json.has("code")) {
7330      JsonArray array = json.getAsJsonArray("code");
7331      for (int i = 0; i < array.size(); i++) {
7332        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7333      }
7334    };
7335    if (json.has("dataPeriod"))
7336      res.setDataPeriod(parsePeriod(json.getAsJsonObject("dataPeriod")));
7337    if (json.has("data")) {
7338      JsonArray array = json.getAsJsonArray("data");
7339      for (int i = 0; i < array.size(); i++) {
7340        res.getData().add(parseConsentprovisionDataComponent(array.get(i).getAsJsonObject(), owner));
7341      }
7342    };
7343    if (json.has("provision")) {
7344      JsonArray array = json.getAsJsonArray("provision");
7345      for (int i = 0; i < array.size(); i++) {
7346        res.getProvision().add(parseConsentprovisionComponent(array.get(i).getAsJsonObject(), owner));
7347      }
7348    };
7349  }
7350
7351  protected Consent.provisionActorComponent parseConsentprovisionActorComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7352    Consent.provisionActorComponent res = new Consent.provisionActorComponent();
7353    parseConsentprovisionActorComponentProperties(json, owner, res);
7354    return res;
7355  }
7356
7357  protected void parseConsentprovisionActorComponentProperties(JsonObject json, Consent owner, Consent.provisionActorComponent res) throws IOException, FHIRFormatError {
7358    parseBackboneElementProperties(json, res);
7359    if (json.has("role"))
7360      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
7361    if (json.has("reference"))
7362      res.setReference(parseReference(json.getAsJsonObject("reference")));
7363  }
7364
7365  protected Consent.provisionDataComponent parseConsentprovisionDataComponent(JsonObject json, Consent owner) throws IOException, FHIRFormatError {
7366    Consent.provisionDataComponent res = new Consent.provisionDataComponent();
7367    parseConsentprovisionDataComponentProperties(json, owner, res);
7368    return res;
7369  }
7370
7371  protected void parseConsentprovisionDataComponentProperties(JsonObject json, Consent owner, Consent.provisionDataComponent res) throws IOException, FHIRFormatError {
7372    parseBackboneElementProperties(json, res);
7373    if (json.has("meaning"))
7374      res.setMeaningElement(parseEnumeration(json.get("meaning").getAsString(), Consent.ConsentDataMeaning.NULL, new Consent.ConsentDataMeaningEnumFactory()));
7375    if (json.has("_meaning"))
7376      parseElementProperties(json.getAsJsonObject("_meaning"), res.getMeaningElement());
7377    if (json.has("reference"))
7378      res.setReference(parseReference(json.getAsJsonObject("reference")));
7379  }
7380
7381  protected Contract parseContract(JsonObject json) throws IOException, FHIRFormatError {
7382    Contract res = new Contract();
7383    parseContractProperties(json, res);
7384    return res;
7385  }
7386
7387  protected void parseContractProperties(JsonObject json, Contract res) throws IOException, FHIRFormatError {
7388    parseDomainResourceProperties(json, res);
7389    if (json.has("identifier")) {
7390      JsonArray array = json.getAsJsonArray("identifier");
7391      for (int i = 0; i < array.size(); i++) {
7392        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7393      }
7394    };
7395    if (json.has("url"))
7396      res.setUrlElement(parseUri(json.get("url").getAsString()));
7397    if (json.has("_url"))
7398      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
7399    if (json.has("version"))
7400      res.setVersionElement(parseString(json.get("version").getAsString()));
7401    if (json.has("_version"))
7402      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
7403    if (json.has("status"))
7404      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Contract.ContractStatus.NULL, new Contract.ContractStatusEnumFactory()));
7405    if (json.has("_status"))
7406      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
7407    if (json.has("legalState"))
7408      res.setLegalState(parseCodeableConcept(json.getAsJsonObject("legalState")));
7409    if (json.has("instantiatesCanonical"))
7410      res.setInstantiatesCanonical(parseReference(json.getAsJsonObject("instantiatesCanonical")));
7411    if (json.has("instantiatesUri"))
7412      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
7413    if (json.has("_instantiatesUri"))
7414      parseElementProperties(json.getAsJsonObject("_instantiatesUri"), res.getInstantiatesUriElement());
7415    if (json.has("contentDerivative"))
7416      res.setContentDerivative(parseCodeableConcept(json.getAsJsonObject("contentDerivative")));
7417    if (json.has("issued"))
7418      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
7419    if (json.has("_issued"))
7420      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7421    if (json.has("applies"))
7422      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
7423    if (json.has("expirationType"))
7424      res.setExpirationType(parseCodeableConcept(json.getAsJsonObject("expirationType")));
7425    if (json.has("subject")) {
7426      JsonArray array = json.getAsJsonArray("subject");
7427      for (int i = 0; i < array.size(); i++) {
7428        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
7429      }
7430    };
7431    if (json.has("authority")) {
7432      JsonArray array = json.getAsJsonArray("authority");
7433      for (int i = 0; i < array.size(); i++) {
7434        res.getAuthority().add(parseReference(array.get(i).getAsJsonObject()));
7435      }
7436    };
7437    if (json.has("domain")) {
7438      JsonArray array = json.getAsJsonArray("domain");
7439      for (int i = 0; i < array.size(); i++) {
7440        res.getDomain().add(parseReference(array.get(i).getAsJsonObject()));
7441      }
7442    };
7443    if (json.has("site")) {
7444      JsonArray array = json.getAsJsonArray("site");
7445      for (int i = 0; i < array.size(); i++) {
7446        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
7447      }
7448    };
7449    if (json.has("name"))
7450      res.setNameElement(parseString(json.get("name").getAsString()));
7451    if (json.has("_name"))
7452      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
7453    if (json.has("title"))
7454      res.setTitleElement(parseString(json.get("title").getAsString()));
7455    if (json.has("_title"))
7456      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
7457    if (json.has("subtitle"))
7458      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
7459    if (json.has("_subtitle"))
7460      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
7461    if (json.has("alias")) {
7462      JsonArray array = json.getAsJsonArray("alias");
7463      for (int i = 0; i < array.size(); i++) {
7464        res.getAlias().add(parseString(array.get(i).getAsString()));
7465      }
7466    };
7467    if (json.has("_alias")) {
7468      JsonArray array = json.getAsJsonArray("_alias");
7469      for (int i = 0; i < array.size(); i++) {
7470        if (i == res.getAlias().size())
7471          res.getAlias().add(parseString(null));
7472        if (array.get(i) instanceof JsonObject) 
7473          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
7474      }
7475    };
7476    if (json.has("author"))
7477      res.setAuthor(parseReference(json.getAsJsonObject("author")));
7478    if (json.has("scope"))
7479      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
7480    Type topic = parseType("topic", json);
7481    if (topic != null)
7482      res.setTopic(topic);
7483    if (json.has("type"))
7484      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7485    if (json.has("subType")) {
7486      JsonArray array = json.getAsJsonArray("subType");
7487      for (int i = 0; i < array.size(); i++) {
7488        res.getSubType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7489      }
7490    };
7491    if (json.has("contentDefinition"))
7492      res.setContentDefinition(parseContractContentDefinitionComponent(json.getAsJsonObject("contentDefinition"), res));
7493    if (json.has("term")) {
7494      JsonArray array = json.getAsJsonArray("term");
7495      for (int i = 0; i < array.size(); i++) {
7496        res.getTerm().add(parseContractTermComponent(array.get(i).getAsJsonObject(), res));
7497      }
7498    };
7499    if (json.has("supportingInfo")) {
7500      JsonArray array = json.getAsJsonArray("supportingInfo");
7501      for (int i = 0; i < array.size(); i++) {
7502        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
7503      }
7504    };
7505    if (json.has("relevantHistory")) {
7506      JsonArray array = json.getAsJsonArray("relevantHistory");
7507      for (int i = 0; i < array.size(); i++) {
7508        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
7509      }
7510    };
7511    if (json.has("signer")) {
7512      JsonArray array = json.getAsJsonArray("signer");
7513      for (int i = 0; i < array.size(); i++) {
7514        res.getSigner().add(parseContractSignatoryComponent(array.get(i).getAsJsonObject(), res));
7515      }
7516    };
7517    if (json.has("friendly")) {
7518      JsonArray array = json.getAsJsonArray("friendly");
7519      for (int i = 0; i < array.size(); i++) {
7520        res.getFriendly().add(parseContractFriendlyLanguageComponent(array.get(i).getAsJsonObject(), res));
7521      }
7522    };
7523    if (json.has("legal")) {
7524      JsonArray array = json.getAsJsonArray("legal");
7525      for (int i = 0; i < array.size(); i++) {
7526        res.getLegal().add(parseContractLegalLanguageComponent(array.get(i).getAsJsonObject(), res));
7527      }
7528    };
7529    if (json.has("rule")) {
7530      JsonArray array = json.getAsJsonArray("rule");
7531      for (int i = 0; i < array.size(); i++) {
7532        res.getRule().add(parseContractComputableLanguageComponent(array.get(i).getAsJsonObject(), res));
7533      }
7534    };
7535    Type legallyBinding = parseType("legallyBinding", json);
7536    if (legallyBinding != null)
7537      res.setLegallyBinding(legallyBinding);
7538  }
7539
7540  protected Contract.ContentDefinitionComponent parseContractContentDefinitionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7541    Contract.ContentDefinitionComponent res = new Contract.ContentDefinitionComponent();
7542    parseContractContentDefinitionComponentProperties(json, owner, res);
7543    return res;
7544  }
7545
7546  protected void parseContractContentDefinitionComponentProperties(JsonObject json, Contract owner, Contract.ContentDefinitionComponent res) throws IOException, FHIRFormatError {
7547    parseBackboneElementProperties(json, res);
7548    if (json.has("type"))
7549      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7550    if (json.has("subType"))
7551      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
7552    if (json.has("publisher"))
7553      res.setPublisher(parseReference(json.getAsJsonObject("publisher")));
7554    if (json.has("publicationDate"))
7555      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
7556    if (json.has("_publicationDate"))
7557      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
7558    if (json.has("publicationStatus"))
7559      res.setPublicationStatusElement(parseEnumeration(json.get("publicationStatus").getAsString(), Contract.ContractPublicationStatus.NULL, new Contract.ContractPublicationStatusEnumFactory()));
7560    if (json.has("_publicationStatus"))
7561      parseElementProperties(json.getAsJsonObject("_publicationStatus"), res.getPublicationStatusElement());
7562    if (json.has("copyright"))
7563      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
7564    if (json.has("_copyright"))
7565      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
7566  }
7567
7568  protected Contract.TermComponent parseContractTermComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7569    Contract.TermComponent res = new Contract.TermComponent();
7570    parseContractTermComponentProperties(json, owner, res);
7571    return res;
7572  }
7573
7574  protected void parseContractTermComponentProperties(JsonObject json, Contract owner, Contract.TermComponent res) throws IOException, FHIRFormatError {
7575    parseBackboneElementProperties(json, res);
7576    if (json.has("identifier"))
7577      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7578    if (json.has("issued"))
7579      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
7580    if (json.has("_issued"))
7581      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
7582    if (json.has("applies"))
7583      res.setApplies(parsePeriod(json.getAsJsonObject("applies")));
7584    Type topic = parseType("topic", json);
7585    if (topic != null)
7586      res.setTopic(topic);
7587    if (json.has("type"))
7588      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7589    if (json.has("subType"))
7590      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
7591    if (json.has("text"))
7592      res.setTextElement(parseString(json.get("text").getAsString()));
7593    if (json.has("_text"))
7594      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7595    if (json.has("securityLabel")) {
7596      JsonArray array = json.getAsJsonArray("securityLabel");
7597      for (int i = 0; i < array.size(); i++) {
7598        res.getSecurityLabel().add(parseContractSecurityLabelComponent(array.get(i).getAsJsonObject(), owner));
7599      }
7600    };
7601    if (json.has("offer"))
7602      res.setOffer(parseContractContractOfferComponent(json.getAsJsonObject("offer"), owner));
7603    if (json.has("asset")) {
7604      JsonArray array = json.getAsJsonArray("asset");
7605      for (int i = 0; i < array.size(); i++) {
7606        res.getAsset().add(parseContractContractAssetComponent(array.get(i).getAsJsonObject(), owner));
7607      }
7608    };
7609    if (json.has("action")) {
7610      JsonArray array = json.getAsJsonArray("action");
7611      for (int i = 0; i < array.size(); i++) {
7612        res.getAction().add(parseContractActionComponent(array.get(i).getAsJsonObject(), owner));
7613      }
7614    };
7615    if (json.has("group")) {
7616      JsonArray array = json.getAsJsonArray("group");
7617      for (int i = 0; i < array.size(); i++) {
7618        res.getGroup().add(parseContractTermComponent(array.get(i).getAsJsonObject(), owner));
7619      }
7620    };
7621  }
7622
7623  protected Contract.SecurityLabelComponent parseContractSecurityLabelComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7624    Contract.SecurityLabelComponent res = new Contract.SecurityLabelComponent();
7625    parseContractSecurityLabelComponentProperties(json, owner, res);
7626    return res;
7627  }
7628
7629  protected void parseContractSecurityLabelComponentProperties(JsonObject json, Contract owner, Contract.SecurityLabelComponent res) throws IOException, FHIRFormatError {
7630    parseBackboneElementProperties(json, res);
7631    if (json.has("number")) {
7632      JsonArray array = json.getAsJsonArray("number");
7633      for (int i = 0; i < array.size(); i++) {
7634        res.getNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7635      }
7636    };
7637    if (json.has("_number")) {
7638      JsonArray array = json.getAsJsonArray("_number");
7639      for (int i = 0; i < array.size(); i++) {
7640        if (i == res.getNumber().size())
7641          res.getNumber().add(parseUnsignedInt(null));
7642        if (array.get(i) instanceof JsonObject) 
7643          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumber().get(i));
7644      }
7645    };
7646    if (json.has("classification"))
7647      res.setClassification(parseCoding(json.getAsJsonObject("classification")));
7648    if (json.has("category")) {
7649      JsonArray array = json.getAsJsonArray("category");
7650      for (int i = 0; i < array.size(); i++) {
7651        res.getCategory().add(parseCoding(array.get(i).getAsJsonObject()));
7652      }
7653    };
7654    if (json.has("control")) {
7655      JsonArray array = json.getAsJsonArray("control");
7656      for (int i = 0; i < array.size(); i++) {
7657        res.getControl().add(parseCoding(array.get(i).getAsJsonObject()));
7658      }
7659    };
7660  }
7661
7662  protected Contract.ContractOfferComponent parseContractContractOfferComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7663    Contract.ContractOfferComponent res = new Contract.ContractOfferComponent();
7664    parseContractContractOfferComponentProperties(json, owner, res);
7665    return res;
7666  }
7667
7668  protected void parseContractContractOfferComponentProperties(JsonObject json, Contract owner, Contract.ContractOfferComponent res) throws IOException, FHIRFormatError {
7669    parseBackboneElementProperties(json, res);
7670    if (json.has("identifier")) {
7671      JsonArray array = json.getAsJsonArray("identifier");
7672      for (int i = 0; i < array.size(); i++) {
7673        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
7674      }
7675    };
7676    if (json.has("party")) {
7677      JsonArray array = json.getAsJsonArray("party");
7678      for (int i = 0; i < array.size(); i++) {
7679        res.getParty().add(parseContractContractPartyComponent(array.get(i).getAsJsonObject(), owner));
7680      }
7681    };
7682    if (json.has("topic"))
7683      res.setTopic(parseReference(json.getAsJsonObject("topic")));
7684    if (json.has("type"))
7685      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7686    if (json.has("decision"))
7687      res.setDecision(parseCodeableConcept(json.getAsJsonObject("decision")));
7688    if (json.has("decisionMode")) {
7689      JsonArray array = json.getAsJsonArray("decisionMode");
7690      for (int i = 0; i < array.size(); i++) {
7691        res.getDecisionMode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7692      }
7693    };
7694    if (json.has("answer")) {
7695      JsonArray array = json.getAsJsonArray("answer");
7696      for (int i = 0; i < array.size(); i++) {
7697        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
7698      }
7699    };
7700    if (json.has("text"))
7701      res.setTextElement(parseString(json.get("text").getAsString()));
7702    if (json.has("_text"))
7703      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7704    if (json.has("linkId")) {
7705      JsonArray array = json.getAsJsonArray("linkId");
7706      for (int i = 0; i < array.size(); i++) {
7707        res.getLinkId().add(parseString(array.get(i).getAsString()));
7708      }
7709    };
7710    if (json.has("_linkId")) {
7711      JsonArray array = json.getAsJsonArray("_linkId");
7712      for (int i = 0; i < array.size(); i++) {
7713        if (i == res.getLinkId().size())
7714          res.getLinkId().add(parseString(null));
7715        if (array.get(i) instanceof JsonObject) 
7716          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7717      }
7718    };
7719    if (json.has("securityLabelNumber")) {
7720      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7721      for (int i = 0; i < array.size(); i++) {
7722        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7723      }
7724    };
7725    if (json.has("_securityLabelNumber")) {
7726      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7727      for (int i = 0; i < array.size(); i++) {
7728        if (i == res.getSecurityLabelNumber().size())
7729          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
7730        if (array.get(i) instanceof JsonObject) 
7731          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
7732      }
7733    };
7734  }
7735
7736  protected Contract.ContractPartyComponent parseContractContractPartyComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7737    Contract.ContractPartyComponent res = new Contract.ContractPartyComponent();
7738    parseContractContractPartyComponentProperties(json, owner, res);
7739    return res;
7740  }
7741
7742  protected void parseContractContractPartyComponentProperties(JsonObject json, Contract owner, Contract.ContractPartyComponent res) throws IOException, FHIRFormatError {
7743    parseBackboneElementProperties(json, res);
7744    if (json.has("reference")) {
7745      JsonArray array = json.getAsJsonArray("reference");
7746      for (int i = 0; i < array.size(); i++) {
7747        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
7748      }
7749    };
7750    if (json.has("role"))
7751      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
7752  }
7753
7754  protected Contract.AnswerComponent parseContractAnswerComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7755    Contract.AnswerComponent res = new Contract.AnswerComponent();
7756    parseContractAnswerComponentProperties(json, owner, res);
7757    return res;
7758  }
7759
7760  protected void parseContractAnswerComponentProperties(JsonObject json, Contract owner, Contract.AnswerComponent res) throws IOException, FHIRFormatError {
7761    parseBackboneElementProperties(json, res);
7762    Type value = parseType("value", json);
7763    if (value != null)
7764      res.setValue(value);
7765  }
7766
7767  protected Contract.ContractAssetComponent parseContractContractAssetComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7768    Contract.ContractAssetComponent res = new Contract.ContractAssetComponent();
7769    parseContractContractAssetComponentProperties(json, owner, res);
7770    return res;
7771  }
7772
7773  protected void parseContractContractAssetComponentProperties(JsonObject json, Contract owner, Contract.ContractAssetComponent res) throws IOException, FHIRFormatError {
7774    parseBackboneElementProperties(json, res);
7775    if (json.has("scope"))
7776      res.setScope(parseCodeableConcept(json.getAsJsonObject("scope")));
7777    if (json.has("type")) {
7778      JsonArray array = json.getAsJsonArray("type");
7779      for (int i = 0; i < array.size(); i++) {
7780        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7781      }
7782    };
7783    if (json.has("typeReference")) {
7784      JsonArray array = json.getAsJsonArray("typeReference");
7785      for (int i = 0; i < array.size(); i++) {
7786        res.getTypeReference().add(parseReference(array.get(i).getAsJsonObject()));
7787      }
7788    };
7789    if (json.has("subtype")) {
7790      JsonArray array = json.getAsJsonArray("subtype");
7791      for (int i = 0; i < array.size(); i++) {
7792        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7793      }
7794    };
7795    if (json.has("relationship"))
7796      res.setRelationship(parseCoding(json.getAsJsonObject("relationship")));
7797    if (json.has("context")) {
7798      JsonArray array = json.getAsJsonArray("context");
7799      for (int i = 0; i < array.size(); i++) {
7800        res.getContext().add(parseContractAssetContextComponent(array.get(i).getAsJsonObject(), owner));
7801      }
7802    };
7803    if (json.has("condition"))
7804      res.setConditionElement(parseString(json.get("condition").getAsString()));
7805    if (json.has("_condition"))
7806      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
7807    if (json.has("periodType")) {
7808      JsonArray array = json.getAsJsonArray("periodType");
7809      for (int i = 0; i < array.size(); i++) {
7810        res.getPeriodType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7811      }
7812    };
7813    if (json.has("period")) {
7814      JsonArray array = json.getAsJsonArray("period");
7815      for (int i = 0; i < array.size(); i++) {
7816        res.getPeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
7817      }
7818    };
7819    if (json.has("usePeriod")) {
7820      JsonArray array = json.getAsJsonArray("usePeriod");
7821      for (int i = 0; i < array.size(); i++) {
7822        res.getUsePeriod().add(parsePeriod(array.get(i).getAsJsonObject()));
7823      }
7824    };
7825    if (json.has("text"))
7826      res.setTextElement(parseString(json.get("text").getAsString()));
7827    if (json.has("_text"))
7828      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7829    if (json.has("linkId")) {
7830      JsonArray array = json.getAsJsonArray("linkId");
7831      for (int i = 0; i < array.size(); i++) {
7832        res.getLinkId().add(parseString(array.get(i).getAsString()));
7833      }
7834    };
7835    if (json.has("_linkId")) {
7836      JsonArray array = json.getAsJsonArray("_linkId");
7837      for (int i = 0; i < array.size(); i++) {
7838        if (i == res.getLinkId().size())
7839          res.getLinkId().add(parseString(null));
7840        if (array.get(i) instanceof JsonObject) 
7841          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7842      }
7843    };
7844    if (json.has("answer")) {
7845      JsonArray array = json.getAsJsonArray("answer");
7846      for (int i = 0; i < array.size(); i++) {
7847        res.getAnswer().add(parseContractAnswerComponent(array.get(i).getAsJsonObject(), owner));
7848      }
7849    };
7850    if (json.has("securityLabelNumber")) {
7851      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7852      for (int i = 0; i < array.size(); i++) {
7853        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7854      }
7855    };
7856    if (json.has("_securityLabelNumber")) {
7857      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7858      for (int i = 0; i < array.size(); i++) {
7859        if (i == res.getSecurityLabelNumber().size())
7860          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
7861        if (array.get(i) instanceof JsonObject) 
7862          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
7863      }
7864    };
7865    if (json.has("valuedItem")) {
7866      JsonArray array = json.getAsJsonArray("valuedItem");
7867      for (int i = 0; i < array.size(); i++) {
7868        res.getValuedItem().add(parseContractValuedItemComponent(array.get(i).getAsJsonObject(), owner));
7869      }
7870    };
7871  }
7872
7873  protected Contract.AssetContextComponent parseContractAssetContextComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7874    Contract.AssetContextComponent res = new Contract.AssetContextComponent();
7875    parseContractAssetContextComponentProperties(json, owner, res);
7876    return res;
7877  }
7878
7879  protected void parseContractAssetContextComponentProperties(JsonObject json, Contract owner, Contract.AssetContextComponent res) throws IOException, FHIRFormatError {
7880    parseBackboneElementProperties(json, res);
7881    if (json.has("reference"))
7882      res.setReference(parseReference(json.getAsJsonObject("reference")));
7883    if (json.has("code")) {
7884      JsonArray array = json.getAsJsonArray("code");
7885      for (int i = 0; i < array.size(); i++) {
7886        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
7887      }
7888    };
7889    if (json.has("text"))
7890      res.setTextElement(parseString(json.get("text").getAsString()));
7891    if (json.has("_text"))
7892      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
7893  }
7894
7895  protected Contract.ValuedItemComponent parseContractValuedItemComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7896    Contract.ValuedItemComponent res = new Contract.ValuedItemComponent();
7897    parseContractValuedItemComponentProperties(json, owner, res);
7898    return res;
7899  }
7900
7901  protected void parseContractValuedItemComponentProperties(JsonObject json, Contract owner, Contract.ValuedItemComponent res) throws IOException, FHIRFormatError {
7902    parseBackboneElementProperties(json, res);
7903    Type entity = parseType("entity", json);
7904    if (entity != null)
7905      res.setEntity(entity);
7906    if (json.has("identifier"))
7907      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
7908    if (json.has("effectiveTime"))
7909      res.setEffectiveTimeElement(parseDateTime(json.get("effectiveTime").getAsString()));
7910    if (json.has("_effectiveTime"))
7911      parseElementProperties(json.getAsJsonObject("_effectiveTime"), res.getEffectiveTimeElement());
7912    if (json.has("quantity"))
7913      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
7914    if (json.has("unitPrice"))
7915      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
7916    if (json.has("factor"))
7917      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
7918    if (json.has("_factor"))
7919      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
7920    if (json.has("points"))
7921      res.setPointsElement(parseDecimal(json.get("points").getAsBigDecimal()));
7922    if (json.has("_points"))
7923      parseElementProperties(json.getAsJsonObject("_points"), res.getPointsElement());
7924    if (json.has("net"))
7925      res.setNet(parseMoney(json.getAsJsonObject("net")));
7926    if (json.has("payment"))
7927      res.setPaymentElement(parseString(json.get("payment").getAsString()));
7928    if (json.has("_payment"))
7929      parseElementProperties(json.getAsJsonObject("_payment"), res.getPaymentElement());
7930    if (json.has("paymentDate"))
7931      res.setPaymentDateElement(parseDateTime(json.get("paymentDate").getAsString()));
7932    if (json.has("_paymentDate"))
7933      parseElementProperties(json.getAsJsonObject("_paymentDate"), res.getPaymentDateElement());
7934    if (json.has("responsible"))
7935      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
7936    if (json.has("recipient"))
7937      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
7938    if (json.has("linkId")) {
7939      JsonArray array = json.getAsJsonArray("linkId");
7940      for (int i = 0; i < array.size(); i++) {
7941        res.getLinkId().add(parseString(array.get(i).getAsString()));
7942      }
7943    };
7944    if (json.has("_linkId")) {
7945      JsonArray array = json.getAsJsonArray("_linkId");
7946      for (int i = 0; i < array.size(); i++) {
7947        if (i == res.getLinkId().size())
7948          res.getLinkId().add(parseString(null));
7949        if (array.get(i) instanceof JsonObject) 
7950          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
7951      }
7952    };
7953    if (json.has("securityLabelNumber")) {
7954      JsonArray array = json.getAsJsonArray("securityLabelNumber");
7955      for (int i = 0; i < array.size(); i++) {
7956        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
7957      }
7958    };
7959    if (json.has("_securityLabelNumber")) {
7960      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
7961      for (int i = 0; i < array.size(); i++) {
7962        if (i == res.getSecurityLabelNumber().size())
7963          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
7964        if (array.get(i) instanceof JsonObject) 
7965          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
7966      }
7967    };
7968  }
7969
7970  protected Contract.ActionComponent parseContractActionComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
7971    Contract.ActionComponent res = new Contract.ActionComponent();
7972    parseContractActionComponentProperties(json, owner, res);
7973    return res;
7974  }
7975
7976  protected void parseContractActionComponentProperties(JsonObject json, Contract owner, Contract.ActionComponent res) throws IOException, FHIRFormatError {
7977    parseBackboneElementProperties(json, res);
7978    if (json.has("doNotPerform"))
7979      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
7980    if (json.has("_doNotPerform"))
7981      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
7982    if (json.has("type"))
7983      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
7984    if (json.has("subject")) {
7985      JsonArray array = json.getAsJsonArray("subject");
7986      for (int i = 0; i < array.size(); i++) {
7987        res.getSubject().add(parseContractActionSubjectComponent(array.get(i).getAsJsonObject(), owner));
7988      }
7989    };
7990    if (json.has("intent"))
7991      res.setIntent(parseCodeableConcept(json.getAsJsonObject("intent")));
7992    if (json.has("linkId")) {
7993      JsonArray array = json.getAsJsonArray("linkId");
7994      for (int i = 0; i < array.size(); i++) {
7995        res.getLinkId().add(parseString(array.get(i).getAsString()));
7996      }
7997    };
7998    if (json.has("_linkId")) {
7999      JsonArray array = json.getAsJsonArray("_linkId");
8000      for (int i = 0; i < array.size(); i++) {
8001        if (i == res.getLinkId().size())
8002          res.getLinkId().add(parseString(null));
8003        if (array.get(i) instanceof JsonObject) 
8004          parseElementProperties(array.get(i).getAsJsonObject(), res.getLinkId().get(i));
8005      }
8006    };
8007    if (json.has("status"))
8008      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
8009    if (json.has("context"))
8010      res.setContext(parseReference(json.getAsJsonObject("context")));
8011    if (json.has("contextLinkId")) {
8012      JsonArray array = json.getAsJsonArray("contextLinkId");
8013      for (int i = 0; i < array.size(); i++) {
8014        res.getContextLinkId().add(parseString(array.get(i).getAsString()));
8015      }
8016    };
8017    if (json.has("_contextLinkId")) {
8018      JsonArray array = json.getAsJsonArray("_contextLinkId");
8019      for (int i = 0; i < array.size(); i++) {
8020        if (i == res.getContextLinkId().size())
8021          res.getContextLinkId().add(parseString(null));
8022        if (array.get(i) instanceof JsonObject) 
8023          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextLinkId().get(i));
8024      }
8025    };
8026    Type occurrence = parseType("occurrence", json);
8027    if (occurrence != null)
8028      res.setOccurrence(occurrence);
8029    if (json.has("requester")) {
8030      JsonArray array = json.getAsJsonArray("requester");
8031      for (int i = 0; i < array.size(); i++) {
8032        res.getRequester().add(parseReference(array.get(i).getAsJsonObject()));
8033      }
8034    };
8035    if (json.has("requesterLinkId")) {
8036      JsonArray array = json.getAsJsonArray("requesterLinkId");
8037      for (int i = 0; i < array.size(); i++) {
8038        res.getRequesterLinkId().add(parseString(array.get(i).getAsString()));
8039      }
8040    };
8041    if (json.has("_requesterLinkId")) {
8042      JsonArray array = json.getAsJsonArray("_requesterLinkId");
8043      for (int i = 0; i < array.size(); i++) {
8044        if (i == res.getRequesterLinkId().size())
8045          res.getRequesterLinkId().add(parseString(null));
8046        if (array.get(i) instanceof JsonObject) 
8047          parseElementProperties(array.get(i).getAsJsonObject(), res.getRequesterLinkId().get(i));
8048      }
8049    };
8050    if (json.has("performerType")) {
8051      JsonArray array = json.getAsJsonArray("performerType");
8052      for (int i = 0; i < array.size(); i++) {
8053        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8054      }
8055    };
8056    if (json.has("performerRole"))
8057      res.setPerformerRole(parseCodeableConcept(json.getAsJsonObject("performerRole")));
8058    if (json.has("performer"))
8059      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
8060    if (json.has("performerLinkId")) {
8061      JsonArray array = json.getAsJsonArray("performerLinkId");
8062      for (int i = 0; i < array.size(); i++) {
8063        res.getPerformerLinkId().add(parseString(array.get(i).getAsString()));
8064      }
8065    };
8066    if (json.has("_performerLinkId")) {
8067      JsonArray array = json.getAsJsonArray("_performerLinkId");
8068      for (int i = 0; i < array.size(); i++) {
8069        if (i == res.getPerformerLinkId().size())
8070          res.getPerformerLinkId().add(parseString(null));
8071        if (array.get(i) instanceof JsonObject) 
8072          parseElementProperties(array.get(i).getAsJsonObject(), res.getPerformerLinkId().get(i));
8073      }
8074    };
8075    if (json.has("reasonCode")) {
8076      JsonArray array = json.getAsJsonArray("reasonCode");
8077      for (int i = 0; i < array.size(); i++) {
8078        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8079      }
8080    };
8081    if (json.has("reasonReference")) {
8082      JsonArray array = json.getAsJsonArray("reasonReference");
8083      for (int i = 0; i < array.size(); i++) {
8084        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
8085      }
8086    };
8087    if (json.has("reason")) {
8088      JsonArray array = json.getAsJsonArray("reason");
8089      for (int i = 0; i < array.size(); i++) {
8090        res.getReason().add(parseString(array.get(i).getAsString()));
8091      }
8092    };
8093    if (json.has("_reason")) {
8094      JsonArray array = json.getAsJsonArray("_reason");
8095      for (int i = 0; i < array.size(); i++) {
8096        if (i == res.getReason().size())
8097          res.getReason().add(parseString(null));
8098        if (array.get(i) instanceof JsonObject) 
8099          parseElementProperties(array.get(i).getAsJsonObject(), res.getReason().get(i));
8100      }
8101    };
8102    if (json.has("reasonLinkId")) {
8103      JsonArray array = json.getAsJsonArray("reasonLinkId");
8104      for (int i = 0; i < array.size(); i++) {
8105        res.getReasonLinkId().add(parseString(array.get(i).getAsString()));
8106      }
8107    };
8108    if (json.has("_reasonLinkId")) {
8109      JsonArray array = json.getAsJsonArray("_reasonLinkId");
8110      for (int i = 0; i < array.size(); i++) {
8111        if (i == res.getReasonLinkId().size())
8112          res.getReasonLinkId().add(parseString(null));
8113        if (array.get(i) instanceof JsonObject) 
8114          parseElementProperties(array.get(i).getAsJsonObject(), res.getReasonLinkId().get(i));
8115      }
8116    };
8117    if (json.has("note")) {
8118      JsonArray array = json.getAsJsonArray("note");
8119      for (int i = 0; i < array.size(); i++) {
8120        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8121      }
8122    };
8123    if (json.has("securityLabelNumber")) {
8124      JsonArray array = json.getAsJsonArray("securityLabelNumber");
8125      for (int i = 0; i < array.size(); i++) {
8126        res.getSecurityLabelNumber().add(parseUnsignedInt(array.get(i).getAsString()));
8127      }
8128    };
8129    if (json.has("_securityLabelNumber")) {
8130      JsonArray array = json.getAsJsonArray("_securityLabelNumber");
8131      for (int i = 0; i < array.size(); i++) {
8132        if (i == res.getSecurityLabelNumber().size())
8133          res.getSecurityLabelNumber().add(parseUnsignedInt(null));
8134        if (array.get(i) instanceof JsonObject) 
8135          parseElementProperties(array.get(i).getAsJsonObject(), res.getSecurityLabelNumber().get(i));
8136      }
8137    };
8138  }
8139
8140  protected Contract.ActionSubjectComponent parseContractActionSubjectComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8141    Contract.ActionSubjectComponent res = new Contract.ActionSubjectComponent();
8142    parseContractActionSubjectComponentProperties(json, owner, res);
8143    return res;
8144  }
8145
8146  protected void parseContractActionSubjectComponentProperties(JsonObject json, Contract owner, Contract.ActionSubjectComponent res) throws IOException, FHIRFormatError {
8147    parseBackboneElementProperties(json, res);
8148    if (json.has("reference")) {
8149      JsonArray array = json.getAsJsonArray("reference");
8150      for (int i = 0; i < array.size(); i++) {
8151        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
8152      }
8153    };
8154    if (json.has("role"))
8155      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
8156  }
8157
8158  protected Contract.SignatoryComponent parseContractSignatoryComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8159    Contract.SignatoryComponent res = new Contract.SignatoryComponent();
8160    parseContractSignatoryComponentProperties(json, owner, res);
8161    return res;
8162  }
8163
8164  protected void parseContractSignatoryComponentProperties(JsonObject json, Contract owner, Contract.SignatoryComponent res) throws IOException, FHIRFormatError {
8165    parseBackboneElementProperties(json, res);
8166    if (json.has("type"))
8167      res.setType(parseCoding(json.getAsJsonObject("type")));
8168    if (json.has("party"))
8169      res.setParty(parseReference(json.getAsJsonObject("party")));
8170    if (json.has("signature")) {
8171      JsonArray array = json.getAsJsonArray("signature");
8172      for (int i = 0; i < array.size(); i++) {
8173        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
8174      }
8175    };
8176  }
8177
8178  protected Contract.FriendlyLanguageComponent parseContractFriendlyLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8179    Contract.FriendlyLanguageComponent res = new Contract.FriendlyLanguageComponent();
8180    parseContractFriendlyLanguageComponentProperties(json, owner, res);
8181    return res;
8182  }
8183
8184  protected void parseContractFriendlyLanguageComponentProperties(JsonObject json, Contract owner, Contract.FriendlyLanguageComponent res) throws IOException, FHIRFormatError {
8185    parseBackboneElementProperties(json, res);
8186    Type content = parseType("content", json);
8187    if (content != null)
8188      res.setContent(content);
8189  }
8190
8191  protected Contract.LegalLanguageComponent parseContractLegalLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8192    Contract.LegalLanguageComponent res = new Contract.LegalLanguageComponent();
8193    parseContractLegalLanguageComponentProperties(json, owner, res);
8194    return res;
8195  }
8196
8197  protected void parseContractLegalLanguageComponentProperties(JsonObject json, Contract owner, Contract.LegalLanguageComponent res) throws IOException, FHIRFormatError {
8198    parseBackboneElementProperties(json, res);
8199    Type content = parseType("content", json);
8200    if (content != null)
8201      res.setContent(content);
8202  }
8203
8204  protected Contract.ComputableLanguageComponent parseContractComputableLanguageComponent(JsonObject json, Contract owner) throws IOException, FHIRFormatError {
8205    Contract.ComputableLanguageComponent res = new Contract.ComputableLanguageComponent();
8206    parseContractComputableLanguageComponentProperties(json, owner, res);
8207    return res;
8208  }
8209
8210  protected void parseContractComputableLanguageComponentProperties(JsonObject json, Contract owner, Contract.ComputableLanguageComponent res) throws IOException, FHIRFormatError {
8211    parseBackboneElementProperties(json, res);
8212    Type content = parseType("content", json);
8213    if (content != null)
8214      res.setContent(content);
8215  }
8216
8217  protected Coverage parseCoverage(JsonObject json) throws IOException, FHIRFormatError {
8218    Coverage res = new Coverage();
8219    parseCoverageProperties(json, res);
8220    return res;
8221  }
8222
8223  protected void parseCoverageProperties(JsonObject json, Coverage res) throws IOException, FHIRFormatError {
8224    parseDomainResourceProperties(json, res);
8225    if (json.has("identifier")) {
8226      JsonArray array = json.getAsJsonArray("identifier");
8227      for (int i = 0; i < array.size(); i++) {
8228        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8229      }
8230    };
8231    if (json.has("status"))
8232      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Coverage.CoverageStatus.NULL, new Coverage.CoverageStatusEnumFactory()));
8233    if (json.has("_status"))
8234      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8235    if (json.has("type"))
8236      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8237    if (json.has("policyHolder"))
8238      res.setPolicyHolder(parseReference(json.getAsJsonObject("policyHolder")));
8239    if (json.has("subscriber"))
8240      res.setSubscriber(parseReference(json.getAsJsonObject("subscriber")));
8241    if (json.has("subscriberId"))
8242      res.setSubscriberIdElement(parseString(json.get("subscriberId").getAsString()));
8243    if (json.has("_subscriberId"))
8244      parseElementProperties(json.getAsJsonObject("_subscriberId"), res.getSubscriberIdElement());
8245    if (json.has("beneficiary"))
8246      res.setBeneficiary(parseReference(json.getAsJsonObject("beneficiary")));
8247    if (json.has("dependent"))
8248      res.setDependentElement(parseString(json.get("dependent").getAsString()));
8249    if (json.has("_dependent"))
8250      parseElementProperties(json.getAsJsonObject("_dependent"), res.getDependentElement());
8251    if (json.has("relationship"))
8252      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
8253    if (json.has("period"))
8254      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
8255    if (json.has("payor")) {
8256      JsonArray array = json.getAsJsonArray("payor");
8257      for (int i = 0; i < array.size(); i++) {
8258        res.getPayor().add(parseReference(array.get(i).getAsJsonObject()));
8259      }
8260    };
8261    if (json.has("class")) {
8262      JsonArray array = json.getAsJsonArray("class");
8263      for (int i = 0; i < array.size(); i++) {
8264        res.getClass_().add(parseCoverageClassComponent(array.get(i).getAsJsonObject(), res));
8265      }
8266    };
8267    if (json.has("order"))
8268      res.setOrderElement(parsePositiveInt(json.get("order").getAsString()));
8269    if (json.has("_order"))
8270      parseElementProperties(json.getAsJsonObject("_order"), res.getOrderElement());
8271    if (json.has("network"))
8272      res.setNetworkElement(parseString(json.get("network").getAsString()));
8273    if (json.has("_network"))
8274      parseElementProperties(json.getAsJsonObject("_network"), res.getNetworkElement());
8275    if (json.has("copay")) {
8276      JsonArray array = json.getAsJsonArray("copay");
8277      for (int i = 0; i < array.size(); i++) {
8278        res.getCopay().add(parseCoverageCoPayComponent(array.get(i).getAsJsonObject(), res));
8279      }
8280    };
8281    if (json.has("contract")) {
8282      JsonArray array = json.getAsJsonArray("contract");
8283      for (int i = 0; i < array.size(); i++) {
8284        res.getContract().add(parseReference(array.get(i).getAsJsonObject()));
8285      }
8286    };
8287  }
8288
8289  protected Coverage.ClassComponent parseCoverageClassComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8290    Coverage.ClassComponent res = new Coverage.ClassComponent();
8291    parseCoverageClassComponentProperties(json, owner, res);
8292    return res;
8293  }
8294
8295  protected void parseCoverageClassComponentProperties(JsonObject json, Coverage owner, Coverage.ClassComponent res) throws IOException, FHIRFormatError {
8296    parseBackboneElementProperties(json, res);
8297    if (json.has("type"))
8298      res.setType(parseCoding(json.getAsJsonObject("type")));
8299    if (json.has("value"))
8300      res.setValueElement(parseString(json.get("value").getAsString()));
8301    if (json.has("_value"))
8302      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
8303    if (json.has("name"))
8304      res.setNameElement(parseString(json.get("name").getAsString()));
8305    if (json.has("_name"))
8306      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8307  }
8308
8309  protected Coverage.CoPayComponent parseCoverageCoPayComponent(JsonObject json, Coverage owner) throws IOException, FHIRFormatError {
8310    Coverage.CoPayComponent res = new Coverage.CoPayComponent();
8311    parseCoverageCoPayComponentProperties(json, owner, res);
8312    return res;
8313  }
8314
8315  protected void parseCoverageCoPayComponentProperties(JsonObject json, Coverage owner, Coverage.CoPayComponent res) throws IOException, FHIRFormatError {
8316    parseBackboneElementProperties(json, res);
8317    if (json.has("type"))
8318      res.setType(parseCoding(json.getAsJsonObject("type")));
8319    if (json.has("value"))
8320      res.setValue(parseQuantity(json.getAsJsonObject("value")));
8321  }
8322
8323  protected CoverageEligibilityRequest parseCoverageEligibilityRequest(JsonObject json) throws IOException, FHIRFormatError {
8324    CoverageEligibilityRequest res = new CoverageEligibilityRequest();
8325    parseCoverageEligibilityRequestProperties(json, res);
8326    return res;
8327  }
8328
8329  protected void parseCoverageEligibilityRequestProperties(JsonObject json, CoverageEligibilityRequest res) throws IOException, FHIRFormatError {
8330    parseDomainResourceProperties(json, res);
8331    if (json.has("identifier")) {
8332      JsonArray array = json.getAsJsonArray("identifier");
8333      for (int i = 0; i < array.size(); i++) {
8334        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8335      }
8336    };
8337    if (json.has("status"))
8338      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityRequest.EligibilityRequestStatus.NULL, new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory()));
8339    if (json.has("_status"))
8340      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8341    if (json.has("priority"))
8342      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
8343    if (json.has("purpose")) {
8344      JsonArray array = json.getAsJsonArray("purpose");
8345      for (int i = 0; i < array.size(); i++) {
8346        res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
8347      }
8348    };
8349    if (json.has("_purpose")) {
8350      JsonArray array = json.getAsJsonArray("_purpose");
8351      for (int i = 0; i < array.size(); i++) {
8352        if (i == res.getPurpose().size())
8353          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityRequest.EligibilityRequestPurpose.NULL, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory()));
8354        if (array.get(i) instanceof JsonObject) 
8355          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
8356      }
8357    };
8358    if (json.has("patient"))
8359      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8360    Type serviced = parseType("serviced", json);
8361    if (serviced != null)
8362      res.setServiced(serviced);
8363    if (json.has("created"))
8364      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8365    if (json.has("_created"))
8366      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8367    if (json.has("enterer"))
8368      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
8369    if (json.has("provider"))
8370      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8371    if (json.has("insurer"))
8372      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8373    if (json.has("facility"))
8374      res.setFacility(parseReference(json.getAsJsonObject("facility")));
8375    if (json.has("supportingInformation")) {
8376      JsonArray array = json.getAsJsonArray("supportingInformation");
8377      for (int i = 0; i < array.size(); i++) {
8378        res.getSupportingInformation().add(parseCoverageEligibilityRequestInformationComponent(array.get(i).getAsJsonObject(), res));
8379      }
8380    };
8381    if (json.has("insurance")) {
8382      JsonArray array = json.getAsJsonArray("insurance");
8383      for (int i = 0; i < array.size(); i++) {
8384        res.getInsurance().add(parseCoverageEligibilityRequestInsuranceComponent(array.get(i).getAsJsonObject(), res));
8385      }
8386    };
8387    if (json.has("item")) {
8388      JsonArray array = json.getAsJsonArray("item");
8389      for (int i = 0; i < array.size(); i++) {
8390        res.getItem().add(parseCoverageEligibilityRequestDetailsComponent(array.get(i).getAsJsonObject(), res));
8391      }
8392    };
8393  }
8394
8395  protected CoverageEligibilityRequest.InformationComponent parseCoverageEligibilityRequestInformationComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8396    CoverageEligibilityRequest.InformationComponent res = new CoverageEligibilityRequest.InformationComponent();
8397    parseCoverageEligibilityRequestInformationComponentProperties(json, owner, res);
8398    return res;
8399  }
8400
8401  protected void parseCoverageEligibilityRequestInformationComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.InformationComponent res) throws IOException, FHIRFormatError {
8402    parseBackboneElementProperties(json, res);
8403    if (json.has("sequence"))
8404      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
8405    if (json.has("_sequence"))
8406      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
8407    if (json.has("information"))
8408      res.setInformation(parseReference(json.getAsJsonObject("information")));
8409    if (json.has("appliesToAll"))
8410      res.setAppliesToAllElement(parseBoolean(json.get("appliesToAll").getAsBoolean()));
8411    if (json.has("_appliesToAll"))
8412      parseElementProperties(json.getAsJsonObject("_appliesToAll"), res.getAppliesToAllElement());
8413  }
8414
8415  protected CoverageEligibilityRequest.InsuranceComponent parseCoverageEligibilityRequestInsuranceComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8416    CoverageEligibilityRequest.InsuranceComponent res = new CoverageEligibilityRequest.InsuranceComponent();
8417    parseCoverageEligibilityRequestInsuranceComponentProperties(json, owner, res);
8418    return res;
8419  }
8420
8421  protected void parseCoverageEligibilityRequestInsuranceComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.InsuranceComponent res) throws IOException, FHIRFormatError {
8422    parseBackboneElementProperties(json, res);
8423    if (json.has("focal"))
8424      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
8425    if (json.has("_focal"))
8426      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
8427    if (json.has("coverage"))
8428      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8429    if (json.has("businessArrangement"))
8430      res.setBusinessArrangementElement(parseString(json.get("businessArrangement").getAsString()));
8431    if (json.has("_businessArrangement"))
8432      parseElementProperties(json.getAsJsonObject("_businessArrangement"), res.getBusinessArrangementElement());
8433  }
8434
8435  protected CoverageEligibilityRequest.DetailsComponent parseCoverageEligibilityRequestDetailsComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8436    CoverageEligibilityRequest.DetailsComponent res = new CoverageEligibilityRequest.DetailsComponent();
8437    parseCoverageEligibilityRequestDetailsComponentProperties(json, owner, res);
8438    return res;
8439  }
8440
8441  protected void parseCoverageEligibilityRequestDetailsComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DetailsComponent res) throws IOException, FHIRFormatError {
8442    parseBackboneElementProperties(json, res);
8443    if (json.has("supportingInformationSequence")) {
8444      JsonArray array = json.getAsJsonArray("supportingInformationSequence");
8445      for (int i = 0; i < array.size(); i++) {
8446        res.getSupportingInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
8447      }
8448    };
8449    if (json.has("_supportingInformationSequence")) {
8450      JsonArray array = json.getAsJsonArray("_supportingInformationSequence");
8451      for (int i = 0; i < array.size(); i++) {
8452        if (i == res.getSupportingInformationSequence().size())
8453          res.getSupportingInformationSequence().add(parsePositiveInt(null));
8454        if (array.get(i) instanceof JsonObject) 
8455          parseElementProperties(array.get(i).getAsJsonObject(), res.getSupportingInformationSequence().get(i));
8456      }
8457    };
8458    if (json.has("category"))
8459      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8460    if (json.has("billcode"))
8461      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
8462    if (json.has("modifier")) {
8463      JsonArray array = json.getAsJsonArray("modifier");
8464      for (int i = 0; i < array.size(); i++) {
8465        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8466      }
8467    };
8468    if (json.has("provider"))
8469      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8470    if (json.has("quantity"))
8471      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
8472    if (json.has("unitPrice"))
8473      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
8474    if (json.has("facility"))
8475      res.setFacility(parseReference(json.getAsJsonObject("facility")));
8476    if (json.has("diagnosis")) {
8477      JsonArray array = json.getAsJsonArray("diagnosis");
8478      for (int i = 0; i < array.size(); i++) {
8479        res.getDiagnosis().add(parseCoverageEligibilityRequestDiagnosisComponent(array.get(i).getAsJsonObject(), owner));
8480      }
8481    };
8482    if (json.has("detail")) {
8483      JsonArray array = json.getAsJsonArray("detail");
8484      for (int i = 0; i < array.size(); i++) {
8485        res.getDetail().add(parseReference(array.get(i).getAsJsonObject()));
8486      }
8487    };
8488  }
8489
8490  protected CoverageEligibilityRequest.DiagnosisComponent parseCoverageEligibilityRequestDiagnosisComponent(JsonObject json, CoverageEligibilityRequest owner) throws IOException, FHIRFormatError {
8491    CoverageEligibilityRequest.DiagnosisComponent res = new CoverageEligibilityRequest.DiagnosisComponent();
8492    parseCoverageEligibilityRequestDiagnosisComponentProperties(json, owner, res);
8493    return res;
8494  }
8495
8496  protected void parseCoverageEligibilityRequestDiagnosisComponentProperties(JsonObject json, CoverageEligibilityRequest owner, CoverageEligibilityRequest.DiagnosisComponent res) throws IOException, FHIRFormatError {
8497    parseBackboneElementProperties(json, res);
8498    Type diagnosis = parseType("diagnosis", json);
8499    if (diagnosis != null)
8500      res.setDiagnosis(diagnosis);
8501  }
8502
8503  protected CoverageEligibilityResponse parseCoverageEligibilityResponse(JsonObject json) throws IOException, FHIRFormatError {
8504    CoverageEligibilityResponse res = new CoverageEligibilityResponse();
8505    parseCoverageEligibilityResponseProperties(json, res);
8506    return res;
8507  }
8508
8509  protected void parseCoverageEligibilityResponseProperties(JsonObject json, CoverageEligibilityResponse res) throws IOException, FHIRFormatError {
8510    parseDomainResourceProperties(json, res);
8511    if (json.has("identifier")) {
8512      JsonArray array = json.getAsJsonArray("identifier");
8513      for (int i = 0; i < array.size(); i++) {
8514        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8515      }
8516    };
8517    if (json.has("status"))
8518      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), CoverageEligibilityResponse.EligibilityResponseStatus.NULL, new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory()));
8519    if (json.has("_status"))
8520      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8521    if (json.has("purpose")) {
8522      JsonArray array = json.getAsJsonArray("purpose");
8523      for (int i = 0; i < array.size(); i++) {
8524        res.getPurpose().add(parseEnumeration(array.get(i).getAsString(), CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
8525      }
8526    };
8527    if (json.has("_purpose")) {
8528      JsonArray array = json.getAsJsonArray("_purpose");
8529      for (int i = 0; i < array.size(); i++) {
8530        if (i == res.getPurpose().size())
8531          res.getPurpose().add(parseEnumeration(null, CoverageEligibilityResponse.EligibilityResponsePurpose.NULL, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory()));
8532        if (array.get(i) instanceof JsonObject) 
8533          parseElementProperties(array.get(i).getAsJsonObject(), res.getPurpose().get(i));
8534      }
8535    };
8536    if (json.has("patient"))
8537      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8538    Type serviced = parseType("serviced", json);
8539    if (serviced != null)
8540      res.setServiced(serviced);
8541    if (json.has("created"))
8542      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
8543    if (json.has("_created"))
8544      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
8545    if (json.has("requestProvider"))
8546      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
8547    if (json.has("request"))
8548      res.setRequest(parseReference(json.getAsJsonObject("request")));
8549    if (json.has("outcome"))
8550      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
8551    if (json.has("_outcome"))
8552      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
8553    if (json.has("disposition"))
8554      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
8555    if (json.has("_disposition"))
8556      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
8557    if (json.has("insurer"))
8558      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
8559    if (json.has("insurance")) {
8560      JsonArray array = json.getAsJsonArray("insurance");
8561      for (int i = 0; i < array.size(); i++) {
8562        res.getInsurance().add(parseCoverageEligibilityResponseInsuranceComponent(array.get(i).getAsJsonObject(), res));
8563      }
8564    };
8565    if (json.has("preAuthRef"))
8566      res.setPreAuthRefElement(parseString(json.get("preAuthRef").getAsString()));
8567    if (json.has("_preAuthRef"))
8568      parseElementProperties(json.getAsJsonObject("_preAuthRef"), res.getPreAuthRefElement());
8569    if (json.has("form"))
8570      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
8571    if (json.has("error")) {
8572      JsonArray array = json.getAsJsonArray("error");
8573      for (int i = 0; i < array.size(); i++) {
8574        res.getError().add(parseCoverageEligibilityResponseErrorsComponent(array.get(i).getAsJsonObject(), res));
8575      }
8576    };
8577  }
8578
8579  protected CoverageEligibilityResponse.InsuranceComponent parseCoverageEligibilityResponseInsuranceComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8580    CoverageEligibilityResponse.InsuranceComponent res = new CoverageEligibilityResponse.InsuranceComponent();
8581    parseCoverageEligibilityResponseInsuranceComponentProperties(json, owner, res);
8582    return res;
8583  }
8584
8585  protected void parseCoverageEligibilityResponseInsuranceComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.InsuranceComponent res) throws IOException, FHIRFormatError {
8586    parseBackboneElementProperties(json, res);
8587    if (json.has("coverage"))
8588      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
8589    if (json.has("contract"))
8590      res.setContract(parseReference(json.getAsJsonObject("contract")));
8591    if (json.has("inforce"))
8592      res.setInforceElement(parseBoolean(json.get("inforce").getAsBoolean()));
8593    if (json.has("_inforce"))
8594      parseElementProperties(json.getAsJsonObject("_inforce"), res.getInforceElement());
8595    if (json.has("item")) {
8596      JsonArray array = json.getAsJsonArray("item");
8597      for (int i = 0; i < array.size(); i++) {
8598        res.getItem().add(parseCoverageEligibilityResponseItemsComponent(array.get(i).getAsJsonObject(), owner));
8599      }
8600    };
8601  }
8602
8603  protected CoverageEligibilityResponse.ItemsComponent parseCoverageEligibilityResponseItemsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8604    CoverageEligibilityResponse.ItemsComponent res = new CoverageEligibilityResponse.ItemsComponent();
8605    parseCoverageEligibilityResponseItemsComponentProperties(json, owner, res);
8606    return res;
8607  }
8608
8609  protected void parseCoverageEligibilityResponseItemsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ItemsComponent res) throws IOException, FHIRFormatError {
8610    parseBackboneElementProperties(json, res);
8611    if (json.has("category"))
8612      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8613    if (json.has("billcode"))
8614      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
8615    if (json.has("modifier")) {
8616      JsonArray array = json.getAsJsonArray("modifier");
8617      for (int i = 0; i < array.size(); i++) {
8618        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8619      }
8620    };
8621    if (json.has("provider"))
8622      res.setProvider(parseReference(json.getAsJsonObject("provider")));
8623    if (json.has("excluded"))
8624      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
8625    if (json.has("_excluded"))
8626      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
8627    if (json.has("name"))
8628      res.setNameElement(parseString(json.get("name").getAsString()));
8629    if (json.has("_name"))
8630      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8631    if (json.has("description"))
8632      res.setDescriptionElement(parseString(json.get("description").getAsString()));
8633    if (json.has("_description"))
8634      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
8635    if (json.has("network"))
8636      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
8637    if (json.has("unit"))
8638      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
8639    if (json.has("term"))
8640      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
8641    if (json.has("benefit")) {
8642      JsonArray array = json.getAsJsonArray("benefit");
8643      for (int i = 0; i < array.size(); i++) {
8644        res.getBenefit().add(parseCoverageEligibilityResponseBenefitComponent(array.get(i).getAsJsonObject(), owner));
8645      }
8646    };
8647    if (json.has("authorizationRequired"))
8648      res.setAuthorizationRequiredElement(parseBoolean(json.get("authorizationRequired").getAsBoolean()));
8649    if (json.has("_authorizationRequired"))
8650      parseElementProperties(json.getAsJsonObject("_authorizationRequired"), res.getAuthorizationRequiredElement());
8651    if (json.has("authorizationSupporting")) {
8652      JsonArray array = json.getAsJsonArray("authorizationSupporting");
8653      for (int i = 0; i < array.size(); i++) {
8654        res.getAuthorizationSupporting().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8655      }
8656    };
8657    if (json.has("authorizationUrl"))
8658      res.setAuthorizationUrlElement(parseUri(json.get("authorizationUrl").getAsString()));
8659    if (json.has("_authorizationUrl"))
8660      parseElementProperties(json.getAsJsonObject("_authorizationUrl"), res.getAuthorizationUrlElement());
8661  }
8662
8663  protected CoverageEligibilityResponse.BenefitComponent parseCoverageEligibilityResponseBenefitComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8664    CoverageEligibilityResponse.BenefitComponent res = new CoverageEligibilityResponse.BenefitComponent();
8665    parseCoverageEligibilityResponseBenefitComponentProperties(json, owner, res);
8666    return res;
8667  }
8668
8669  protected void parseCoverageEligibilityResponseBenefitComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.BenefitComponent res) throws IOException, FHIRFormatError {
8670    parseBackboneElementProperties(json, res);
8671    if (json.has("type"))
8672      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8673    Type allowed = parseType("allowed", json);
8674    if (allowed != null)
8675      res.setAllowed(allowed);
8676    Type used = parseType("used", json);
8677    if (used != null)
8678      res.setUsed(used);
8679  }
8680
8681  protected CoverageEligibilityResponse.ErrorsComponent parseCoverageEligibilityResponseErrorsComponent(JsonObject json, CoverageEligibilityResponse owner) throws IOException, FHIRFormatError {
8682    CoverageEligibilityResponse.ErrorsComponent res = new CoverageEligibilityResponse.ErrorsComponent();
8683    parseCoverageEligibilityResponseErrorsComponentProperties(json, owner, res);
8684    return res;
8685  }
8686
8687  protected void parseCoverageEligibilityResponseErrorsComponentProperties(JsonObject json, CoverageEligibilityResponse owner, CoverageEligibilityResponse.ErrorsComponent res) throws IOException, FHIRFormatError {
8688    parseBackboneElementProperties(json, res);
8689    if (json.has("code"))
8690      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
8691  }
8692
8693  protected DetectedIssue parseDetectedIssue(JsonObject json) throws IOException, FHIRFormatError {
8694    DetectedIssue res = new DetectedIssue();
8695    parseDetectedIssueProperties(json, res);
8696    return res;
8697  }
8698
8699  protected void parseDetectedIssueProperties(JsonObject json, DetectedIssue res) throws IOException, FHIRFormatError {
8700    parseDomainResourceProperties(json, res);
8701    if (json.has("identifier")) {
8702      JsonArray array = json.getAsJsonArray("identifier");
8703      for (int i = 0; i < array.size(); i++) {
8704        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8705      }
8706    };
8707    if (json.has("status"))
8708      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DetectedIssue.DetectedIssueStatus.NULL, new DetectedIssue.DetectedIssueStatusEnumFactory()));
8709    if (json.has("_status"))
8710      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8711    if (json.has("category"))
8712      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
8713    if (json.has("severity"))
8714      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), DetectedIssue.DetectedIssueSeverity.NULL, new DetectedIssue.DetectedIssueSeverityEnumFactory()));
8715    if (json.has("_severity"))
8716      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
8717    if (json.has("patient"))
8718      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8719    if (json.has("date"))
8720      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8721    if (json.has("_date"))
8722      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8723    if (json.has("author"))
8724      res.setAuthor(parseReference(json.getAsJsonObject("author")));
8725    if (json.has("implicated")) {
8726      JsonArray array = json.getAsJsonArray("implicated");
8727      for (int i = 0; i < array.size(); i++) {
8728        res.getImplicated().add(parseReference(array.get(i).getAsJsonObject()));
8729      }
8730    };
8731    if (json.has("detail"))
8732      res.setDetailElement(parseString(json.get("detail").getAsString()));
8733    if (json.has("_detail"))
8734      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
8735    if (json.has("reference"))
8736      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
8737    if (json.has("_reference"))
8738      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
8739    if (json.has("mitigation")) {
8740      JsonArray array = json.getAsJsonArray("mitigation");
8741      for (int i = 0; i < array.size(); i++) {
8742        res.getMitigation().add(parseDetectedIssueDetectedIssueMitigationComponent(array.get(i).getAsJsonObject(), res));
8743      }
8744    };
8745  }
8746
8747  protected DetectedIssue.DetectedIssueMitigationComponent parseDetectedIssueDetectedIssueMitigationComponent(JsonObject json, DetectedIssue owner) throws IOException, FHIRFormatError {
8748    DetectedIssue.DetectedIssueMitigationComponent res = new DetectedIssue.DetectedIssueMitigationComponent();
8749    parseDetectedIssueDetectedIssueMitigationComponentProperties(json, owner, res);
8750    return res;
8751  }
8752
8753  protected void parseDetectedIssueDetectedIssueMitigationComponentProperties(JsonObject json, DetectedIssue owner, DetectedIssue.DetectedIssueMitigationComponent res) throws IOException, FHIRFormatError {
8754    parseBackboneElementProperties(json, res);
8755    if (json.has("action"))
8756      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
8757    if (json.has("date"))
8758      res.setDateElement(parseDateTime(json.get("date").getAsString()));
8759    if (json.has("_date"))
8760      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
8761    if (json.has("author"))
8762      res.setAuthor(parseReference(json.getAsJsonObject("author")));
8763  }
8764
8765  protected Device parseDevice(JsonObject json) throws IOException, FHIRFormatError {
8766    Device res = new Device();
8767    parseDeviceProperties(json, res);
8768    return res;
8769  }
8770
8771  protected void parseDeviceProperties(JsonObject json, Device res) throws IOException, FHIRFormatError {
8772    parseDomainResourceProperties(json, res);
8773    if (json.has("identifier")) {
8774      JsonArray array = json.getAsJsonArray("identifier");
8775      for (int i = 0; i < array.size(); i++) {
8776        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
8777      }
8778    };
8779    if (json.has("definition"))
8780      res.setDefinition(parseReference(json.getAsJsonObject("definition")));
8781    if (json.has("udiCarrier")) {
8782      JsonArray array = json.getAsJsonArray("udiCarrier");
8783      for (int i = 0; i < array.size(); i++) {
8784        res.getUdiCarrier().add(parseDeviceDeviceUdiCarrierComponent(array.get(i).getAsJsonObject(), res));
8785      }
8786    };
8787    if (json.has("status"))
8788      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Device.FHIRDeviceStatus.NULL, new Device.FHIRDeviceStatusEnumFactory()));
8789    if (json.has("_status"))
8790      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
8791    if (json.has("statusReason")) {
8792      JsonArray array = json.getAsJsonArray("statusReason");
8793      for (int i = 0; i < array.size(); i++) {
8794        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8795      }
8796    };
8797    if (json.has("distinctIdentificationCode"))
8798      res.setDistinctIdentificationCodeElement(parseString(json.get("distinctIdentificationCode").getAsString()));
8799    if (json.has("_distinctIdentificationCode"))
8800      parseElementProperties(json.getAsJsonObject("_distinctIdentificationCode"), res.getDistinctIdentificationCodeElement());
8801    if (json.has("manufacturer"))
8802      res.setManufacturerElement(parseString(json.get("manufacturer").getAsString()));
8803    if (json.has("_manufacturer"))
8804      parseElementProperties(json.getAsJsonObject("_manufacturer"), res.getManufacturerElement());
8805    if (json.has("manufactureDate"))
8806      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
8807    if (json.has("_manufactureDate"))
8808      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
8809    if (json.has("expirationDate"))
8810      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
8811    if (json.has("_expirationDate"))
8812      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
8813    if (json.has("lotNumber"))
8814      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
8815    if (json.has("_lotNumber"))
8816      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
8817    if (json.has("serialNumber"))
8818      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
8819    if (json.has("_serialNumber"))
8820      parseElementProperties(json.getAsJsonObject("_serialNumber"), res.getSerialNumberElement());
8821    if (json.has("deviceName")) {
8822      JsonArray array = json.getAsJsonArray("deviceName");
8823      for (int i = 0; i < array.size(); i++) {
8824        res.getDeviceName().add(parseDeviceDeviceDeviceNameComponent(array.get(i).getAsJsonObject(), res));
8825      }
8826    };
8827    if (json.has("modelNumber"))
8828      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
8829    if (json.has("_modelNumber"))
8830      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
8831    if (json.has("partNumber"))
8832      res.setPartNumberElement(parseString(json.get("partNumber").getAsString()));
8833    if (json.has("_partNumber"))
8834      parseElementProperties(json.getAsJsonObject("_partNumber"), res.getPartNumberElement());
8835    if (json.has("type"))
8836      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8837    if (json.has("specialization")) {
8838      JsonArray array = json.getAsJsonArray("specialization");
8839      for (int i = 0; i < array.size(); i++) {
8840        res.getSpecialization().add(parseDeviceDeviceSpecializationComponent(array.get(i).getAsJsonObject(), res));
8841      }
8842    };
8843    if (json.has("version")) {
8844      JsonArray array = json.getAsJsonArray("version");
8845      for (int i = 0; i < array.size(); i++) {
8846        res.getVersion().add(parseDeviceDeviceVersionComponent(array.get(i).getAsJsonObject(), res));
8847      }
8848    };
8849    if (json.has("property")) {
8850      JsonArray array = json.getAsJsonArray("property");
8851      for (int i = 0; i < array.size(); i++) {
8852        res.getProperty().add(parseDeviceDevicePropertyComponent(array.get(i).getAsJsonObject(), res));
8853      }
8854    };
8855    if (json.has("patient"))
8856      res.setPatient(parseReference(json.getAsJsonObject("patient")));
8857    if (json.has("owner"))
8858      res.setOwner(parseReference(json.getAsJsonObject("owner")));
8859    if (json.has("contact")) {
8860      JsonArray array = json.getAsJsonArray("contact");
8861      for (int i = 0; i < array.size(); i++) {
8862        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
8863      }
8864    };
8865    if (json.has("location"))
8866      res.setLocation(parseReference(json.getAsJsonObject("location")));
8867    if (json.has("url"))
8868      res.setUrlElement(parseUri(json.get("url").getAsString()));
8869    if (json.has("_url"))
8870      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
8871    if (json.has("note")) {
8872      JsonArray array = json.getAsJsonArray("note");
8873      for (int i = 0; i < array.size(); i++) {
8874        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
8875      }
8876    };
8877    if (json.has("safety")) {
8878      JsonArray array = json.getAsJsonArray("safety");
8879      for (int i = 0; i < array.size(); i++) {
8880        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8881      }
8882    };
8883    if (json.has("parent"))
8884      res.setParent(parseReference(json.getAsJsonObject("parent")));
8885  }
8886
8887  protected Device.DeviceUdiCarrierComponent parseDeviceDeviceUdiCarrierComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
8888    Device.DeviceUdiCarrierComponent res = new Device.DeviceUdiCarrierComponent();
8889    parseDeviceDeviceUdiCarrierComponentProperties(json, owner, res);
8890    return res;
8891  }
8892
8893  protected void parseDeviceDeviceUdiCarrierComponentProperties(JsonObject json, Device owner, Device.DeviceUdiCarrierComponent res) throws IOException, FHIRFormatError {
8894    parseBackboneElementProperties(json, res);
8895    if (json.has("deviceIdentifier"))
8896      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
8897    if (json.has("_deviceIdentifier"))
8898      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
8899    if (json.has("issuer"))
8900      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
8901    if (json.has("_issuer"))
8902      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
8903    if (json.has("jurisdiction"))
8904      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
8905    if (json.has("_jurisdiction"))
8906      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
8907    if (json.has("carrierAIDC"))
8908      res.setCarrierAIDCElement(parseBase64Binary(json.get("carrierAIDC").getAsString()));
8909    if (json.has("_carrierAIDC"))
8910      parseElementProperties(json.getAsJsonObject("_carrierAIDC"), res.getCarrierAIDCElement());
8911    if (json.has("carrierHRF"))
8912      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
8913    if (json.has("_carrierHRF"))
8914      parseElementProperties(json.getAsJsonObject("_carrierHRF"), res.getCarrierHRFElement());
8915    if (json.has("entryType"))
8916      res.setEntryTypeElement(parseEnumeration(json.get("entryType").getAsString(), Device.UDIEntryType.NULL, new Device.UDIEntryTypeEnumFactory()));
8917    if (json.has("_entryType"))
8918      parseElementProperties(json.getAsJsonObject("_entryType"), res.getEntryTypeElement());
8919  }
8920
8921  protected Device.DeviceDeviceNameComponent parseDeviceDeviceDeviceNameComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
8922    Device.DeviceDeviceNameComponent res = new Device.DeviceDeviceNameComponent();
8923    parseDeviceDeviceDeviceNameComponentProperties(json, owner, res);
8924    return res;
8925  }
8926
8927  protected void parseDeviceDeviceDeviceNameComponentProperties(JsonObject json, Device owner, Device.DeviceDeviceNameComponent res) throws IOException, FHIRFormatError {
8928    parseBackboneElementProperties(json, res);
8929    if (json.has("name"))
8930      res.setNameElement(parseString(json.get("name").getAsString()));
8931    if (json.has("_name"))
8932      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
8933    if (json.has("type"))
8934      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Device.DeviceNameType.NULL, new Device.DeviceNameTypeEnumFactory()));
8935    if (json.has("_type"))
8936      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
8937  }
8938
8939  protected Device.DeviceSpecializationComponent parseDeviceDeviceSpecializationComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
8940    Device.DeviceSpecializationComponent res = new Device.DeviceSpecializationComponent();
8941    parseDeviceDeviceSpecializationComponentProperties(json, owner, res);
8942    return res;
8943  }
8944
8945  protected void parseDeviceDeviceSpecializationComponentProperties(JsonObject json, Device owner, Device.DeviceSpecializationComponent res) throws IOException, FHIRFormatError {
8946    parseBackboneElementProperties(json, res);
8947    if (json.has("systemType"))
8948      res.setSystemType(parseCodeableConcept(json.getAsJsonObject("systemType")));
8949    if (json.has("version"))
8950      res.setVersionElement(parseString(json.get("version").getAsString()));
8951    if (json.has("_version"))
8952      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
8953  }
8954
8955  protected Device.DeviceVersionComponent parseDeviceDeviceVersionComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
8956    Device.DeviceVersionComponent res = new Device.DeviceVersionComponent();
8957    parseDeviceDeviceVersionComponentProperties(json, owner, res);
8958    return res;
8959  }
8960
8961  protected void parseDeviceDeviceVersionComponentProperties(JsonObject json, Device owner, Device.DeviceVersionComponent res) throws IOException, FHIRFormatError {
8962    parseBackboneElementProperties(json, res);
8963    if (json.has("type"))
8964      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8965    if (json.has("component"))
8966      res.setComponent(parseIdentifier(json.getAsJsonObject("component")));
8967    if (json.has("value"))
8968      res.setValueElement(parseString(json.get("value").getAsString()));
8969    if (json.has("_value"))
8970      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
8971  }
8972
8973  protected Device.DevicePropertyComponent parseDeviceDevicePropertyComponent(JsonObject json, Device owner) throws IOException, FHIRFormatError {
8974    Device.DevicePropertyComponent res = new Device.DevicePropertyComponent();
8975    parseDeviceDevicePropertyComponentProperties(json, owner, res);
8976    return res;
8977  }
8978
8979  protected void parseDeviceDevicePropertyComponentProperties(JsonObject json, Device owner, Device.DevicePropertyComponent res) throws IOException, FHIRFormatError {
8980    parseBackboneElementProperties(json, res);
8981    if (json.has("type"))
8982      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
8983    if (json.has("valueQuanity")) {
8984      JsonArray array = json.getAsJsonArray("valueQuanity");
8985      for (int i = 0; i < array.size(); i++) {
8986        res.getValueQuanity().add(parseQuantity(array.get(i).getAsJsonObject()));
8987      }
8988    };
8989    if (json.has("valueCode")) {
8990      JsonArray array = json.getAsJsonArray("valueCode");
8991      for (int i = 0; i < array.size(); i++) {
8992        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
8993      }
8994    };
8995  }
8996
8997  protected DeviceDefinition parseDeviceDefinition(JsonObject json) throws IOException, FHIRFormatError {
8998    DeviceDefinition res = new DeviceDefinition();
8999    parseDeviceDefinitionProperties(json, res);
9000    return res;
9001  }
9002
9003  protected void parseDeviceDefinitionProperties(JsonObject json, DeviceDefinition res) throws IOException, FHIRFormatError {
9004    parseDomainResourceProperties(json, res);
9005    if (json.has("identifier")) {
9006      JsonArray array = json.getAsJsonArray("identifier");
9007      for (int i = 0; i < array.size(); i++) {
9008        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9009      }
9010    };
9011    if (json.has("udiDeviceIdentifier")) {
9012      JsonArray array = json.getAsJsonArray("udiDeviceIdentifier");
9013      for (int i = 0; i < array.size(); i++) {
9014        res.getUdiDeviceIdentifier().add(parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(array.get(i).getAsJsonObject(), res));
9015      }
9016    };
9017    Type manufacturer = parseType("manufacturer", json);
9018    if (manufacturer != null)
9019      res.setManufacturer(manufacturer);
9020    if (json.has("deviceName")) {
9021      JsonArray array = json.getAsJsonArray("deviceName");
9022      for (int i = 0; i < array.size(); i++) {
9023        res.getDeviceName().add(parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(array.get(i).getAsJsonObject(), res));
9024      }
9025    };
9026    if (json.has("modelNumber"))
9027      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
9028    if (json.has("_modelNumber"))
9029      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
9030    if (json.has("type"))
9031      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9032    if (json.has("specialization")) {
9033      JsonArray array = json.getAsJsonArray("specialization");
9034      for (int i = 0; i < array.size(); i++) {
9035        res.getSpecialization().add(parseDeviceDefinitionDeviceDefinitionSpecializationComponent(array.get(i).getAsJsonObject(), res));
9036      }
9037    };
9038    if (json.has("version")) {
9039      JsonArray array = json.getAsJsonArray("version");
9040      for (int i = 0; i < array.size(); i++) {
9041        res.getVersion().add(parseString(array.get(i).getAsString()));
9042      }
9043    };
9044    if (json.has("_version")) {
9045      JsonArray array = json.getAsJsonArray("_version");
9046      for (int i = 0; i < array.size(); i++) {
9047        if (i == res.getVersion().size())
9048          res.getVersion().add(parseString(null));
9049        if (array.get(i) instanceof JsonObject) 
9050          parseElementProperties(array.get(i).getAsJsonObject(), res.getVersion().get(i));
9051      }
9052    };
9053    if (json.has("safety")) {
9054      JsonArray array = json.getAsJsonArray("safety");
9055      for (int i = 0; i < array.size(); i++) {
9056        res.getSafety().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9057      }
9058    };
9059    if (json.has("shelfLifeStorage")) {
9060      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
9061      for (int i = 0; i < array.size(); i++) {
9062        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
9063      }
9064    };
9065    if (json.has("physicalCharacteristics"))
9066      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
9067    if (json.has("languageCode")) {
9068      JsonArray array = json.getAsJsonArray("languageCode");
9069      for (int i = 0; i < array.size(); i++) {
9070        res.getLanguageCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9071      }
9072    };
9073    if (json.has("capability")) {
9074      JsonArray array = json.getAsJsonArray("capability");
9075      for (int i = 0; i < array.size(); i++) {
9076        res.getCapability().add(parseDeviceDefinitionDeviceDefinitionCapabilityComponent(array.get(i).getAsJsonObject(), res));
9077      }
9078    };
9079    if (json.has("property")) {
9080      JsonArray array = json.getAsJsonArray("property");
9081      for (int i = 0; i < array.size(); i++) {
9082        res.getProperty().add(parseDeviceDefinitionDeviceDefinitionPropertyComponent(array.get(i).getAsJsonObject(), res));
9083      }
9084    };
9085    if (json.has("owner"))
9086      res.setOwner(parseReference(json.getAsJsonObject("owner")));
9087    if (json.has("contact")) {
9088      JsonArray array = json.getAsJsonArray("contact");
9089      for (int i = 0; i < array.size(); i++) {
9090        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
9091      }
9092    };
9093    if (json.has("url"))
9094      res.setUrlElement(parseUri(json.get("url").getAsString()));
9095    if (json.has("_url"))
9096      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
9097    if (json.has("onlineInformation"))
9098      res.setOnlineInformationElement(parseUri(json.get("onlineInformation").getAsString()));
9099    if (json.has("_onlineInformation"))
9100      parseElementProperties(json.getAsJsonObject("_onlineInformation"), res.getOnlineInformationElement());
9101    if (json.has("note")) {
9102      JsonArray array = json.getAsJsonArray("note");
9103      for (int i = 0; i < array.size(); i++) {
9104        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9105      }
9106    };
9107    if (json.has("quantity"))
9108      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
9109    if (json.has("parentDevice"))
9110      res.setParentDevice(parseReference(json.getAsJsonObject("parentDevice")));
9111    if (json.has("material")) {
9112      JsonArray array = json.getAsJsonArray("material");
9113      for (int i = 0; i < array.size(); i++) {
9114        res.getMaterial().add(parseDeviceDefinitionDeviceDefinitionMaterialComponent(array.get(i).getAsJsonObject(), res));
9115      }
9116    };
9117  }
9118
9119  protected DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9120    DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res = new DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent();
9121    parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(json, owner, res);
9122    return res;
9123  }
9124
9125  protected void parseDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent res) throws IOException, FHIRFormatError {
9126    parseBackboneElementProperties(json, res);
9127    if (json.has("deviceIdentifier"))
9128      res.setDeviceIdentifierElement(parseString(json.get("deviceIdentifier").getAsString()));
9129    if (json.has("_deviceIdentifier"))
9130      parseElementProperties(json.getAsJsonObject("_deviceIdentifier"), res.getDeviceIdentifierElement());
9131    if (json.has("issuer"))
9132      res.setIssuerElement(parseUri(json.get("issuer").getAsString()));
9133    if (json.has("_issuer"))
9134      parseElementProperties(json.getAsJsonObject("_issuer"), res.getIssuerElement());
9135    if (json.has("jurisdiction"))
9136      res.setJurisdictionElement(parseUri(json.get("jurisdiction").getAsString()));
9137    if (json.has("_jurisdiction"))
9138      parseElementProperties(json.getAsJsonObject("_jurisdiction"), res.getJurisdictionElement());
9139  }
9140
9141  protected DeviceDefinition.DeviceDefinitionDeviceNameComponent parseDeviceDefinitionDeviceDefinitionDeviceNameComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9142    DeviceDefinition.DeviceDefinitionDeviceNameComponent res = new DeviceDefinition.DeviceDefinitionDeviceNameComponent();
9143    parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(json, owner, res);
9144    return res;
9145  }
9146
9147  protected void parseDeviceDefinitionDeviceDefinitionDeviceNameComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionDeviceNameComponent res) throws IOException, FHIRFormatError {
9148    parseBackboneElementProperties(json, res);
9149    if (json.has("name"))
9150      res.setNameElement(parseString(json.get("name").getAsString()));
9151    if (json.has("_name"))
9152      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
9153    if (json.has("type"))
9154      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceDefinition.DeviceNameType.NULL, new DeviceDefinition.DeviceNameTypeEnumFactory()));
9155    if (json.has("_type"))
9156      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9157  }
9158
9159  protected DeviceDefinition.DeviceDefinitionSpecializationComponent parseDeviceDefinitionDeviceDefinitionSpecializationComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9160    DeviceDefinition.DeviceDefinitionSpecializationComponent res = new DeviceDefinition.DeviceDefinitionSpecializationComponent();
9161    parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(json, owner, res);
9162    return res;
9163  }
9164
9165  protected void parseDeviceDefinitionDeviceDefinitionSpecializationComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionSpecializationComponent res) throws IOException, FHIRFormatError {
9166    parseBackboneElementProperties(json, res);
9167    if (json.has("systemType"))
9168      res.setSystemTypeElement(parseString(json.get("systemType").getAsString()));
9169    if (json.has("_systemType"))
9170      parseElementProperties(json.getAsJsonObject("_systemType"), res.getSystemTypeElement());
9171    if (json.has("version"))
9172      res.setVersionElement(parseString(json.get("version").getAsString()));
9173    if (json.has("_version"))
9174      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
9175  }
9176
9177  protected DeviceDefinition.DeviceDefinitionCapabilityComponent parseDeviceDefinitionDeviceDefinitionCapabilityComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9178    DeviceDefinition.DeviceDefinitionCapabilityComponent res = new DeviceDefinition.DeviceDefinitionCapabilityComponent();
9179    parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(json, owner, res);
9180    return res;
9181  }
9182
9183  protected void parseDeviceDefinitionDeviceDefinitionCapabilityComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionCapabilityComponent res) throws IOException, FHIRFormatError {
9184    parseBackboneElementProperties(json, res);
9185    if (json.has("type"))
9186      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9187    if (json.has("description")) {
9188      JsonArray array = json.getAsJsonArray("description");
9189      for (int i = 0; i < array.size(); i++) {
9190        res.getDescription().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9191      }
9192    };
9193  }
9194
9195  protected DeviceDefinition.DeviceDefinitionPropertyComponent parseDeviceDefinitionDeviceDefinitionPropertyComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9196    DeviceDefinition.DeviceDefinitionPropertyComponent res = new DeviceDefinition.DeviceDefinitionPropertyComponent();
9197    parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(json, owner, res);
9198    return res;
9199  }
9200
9201  protected void parseDeviceDefinitionDeviceDefinitionPropertyComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionPropertyComponent res) throws IOException, FHIRFormatError {
9202    parseBackboneElementProperties(json, res);
9203    if (json.has("type"))
9204      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9205    if (json.has("valueQuanity")) {
9206      JsonArray array = json.getAsJsonArray("valueQuanity");
9207      for (int i = 0; i < array.size(); i++) {
9208        res.getValueQuanity().add(parseQuantity(array.get(i).getAsJsonObject()));
9209      }
9210    };
9211    if (json.has("valueCode")) {
9212      JsonArray array = json.getAsJsonArray("valueCode");
9213      for (int i = 0; i < array.size(); i++) {
9214        res.getValueCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9215      }
9216    };
9217  }
9218
9219  protected DeviceDefinition.DeviceDefinitionMaterialComponent parseDeviceDefinitionDeviceDefinitionMaterialComponent(JsonObject json, DeviceDefinition owner) throws IOException, FHIRFormatError {
9220    DeviceDefinition.DeviceDefinitionMaterialComponent res = new DeviceDefinition.DeviceDefinitionMaterialComponent();
9221    parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(json, owner, res);
9222    return res;
9223  }
9224
9225  protected void parseDeviceDefinitionDeviceDefinitionMaterialComponentProperties(JsonObject json, DeviceDefinition owner, DeviceDefinition.DeviceDefinitionMaterialComponent res) throws IOException, FHIRFormatError {
9226    parseBackboneElementProperties(json, res);
9227    if (json.has("substance"))
9228      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
9229    if (json.has("alternate"))
9230      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
9231    if (json.has("_alternate"))
9232      parseElementProperties(json.getAsJsonObject("_alternate"), res.getAlternateElement());
9233    if (json.has("allergenicIndicator"))
9234      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
9235    if (json.has("_allergenicIndicator"))
9236      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
9237  }
9238
9239  protected DeviceMetric parseDeviceMetric(JsonObject json) throws IOException, FHIRFormatError {
9240    DeviceMetric res = new DeviceMetric();
9241    parseDeviceMetricProperties(json, res);
9242    return res;
9243  }
9244
9245  protected void parseDeviceMetricProperties(JsonObject json, DeviceMetric res) throws IOException, FHIRFormatError {
9246    parseDomainResourceProperties(json, res);
9247    if (json.has("identifier")) {
9248      JsonArray array = json.getAsJsonArray("identifier");
9249      for (int i = 0; i < array.size(); i++) {
9250        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9251      }
9252    };
9253    if (json.has("type"))
9254      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9255    if (json.has("unit"))
9256      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
9257    if (json.has("source"))
9258      res.setSource(parseReference(json.getAsJsonObject("source")));
9259    if (json.has("parent"))
9260      res.setParent(parseReference(json.getAsJsonObject("parent")));
9261    if (json.has("operationalStatus"))
9262      res.setOperationalStatusElement(parseEnumeration(json.get("operationalStatus").getAsString(), DeviceMetric.DeviceMetricOperationalStatus.NULL, new DeviceMetric.DeviceMetricOperationalStatusEnumFactory()));
9263    if (json.has("_operationalStatus"))
9264      parseElementProperties(json.getAsJsonObject("_operationalStatus"), res.getOperationalStatusElement());
9265    if (json.has("color"))
9266      res.setColorElement(parseEnumeration(json.get("color").getAsString(), DeviceMetric.DeviceMetricColor.NULL, new DeviceMetric.DeviceMetricColorEnumFactory()));
9267    if (json.has("_color"))
9268      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
9269    if (json.has("category"))
9270      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), DeviceMetric.DeviceMetricCategory.NULL, new DeviceMetric.DeviceMetricCategoryEnumFactory()));
9271    if (json.has("_category"))
9272      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
9273    if (json.has("measurementPeriod"))
9274      res.setMeasurementPeriod(parseTiming(json.getAsJsonObject("measurementPeriod")));
9275    if (json.has("calibration")) {
9276      JsonArray array = json.getAsJsonArray("calibration");
9277      for (int i = 0; i < array.size(); i++) {
9278        res.getCalibration().add(parseDeviceMetricDeviceMetricCalibrationComponent(array.get(i).getAsJsonObject(), res));
9279      }
9280    };
9281  }
9282
9283  protected DeviceMetric.DeviceMetricCalibrationComponent parseDeviceMetricDeviceMetricCalibrationComponent(JsonObject json, DeviceMetric owner) throws IOException, FHIRFormatError {
9284    DeviceMetric.DeviceMetricCalibrationComponent res = new DeviceMetric.DeviceMetricCalibrationComponent();
9285    parseDeviceMetricDeviceMetricCalibrationComponentProperties(json, owner, res);
9286    return res;
9287  }
9288
9289  protected void parseDeviceMetricDeviceMetricCalibrationComponentProperties(JsonObject json, DeviceMetric owner, DeviceMetric.DeviceMetricCalibrationComponent res) throws IOException, FHIRFormatError {
9290    parseBackboneElementProperties(json, res);
9291    if (json.has("type"))
9292      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), DeviceMetric.DeviceMetricCalibrationType.NULL, new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory()));
9293    if (json.has("_type"))
9294      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
9295    if (json.has("state"))
9296      res.setStateElement(parseEnumeration(json.get("state").getAsString(), DeviceMetric.DeviceMetricCalibrationState.NULL, new DeviceMetric.DeviceMetricCalibrationStateEnumFactory()));
9297    if (json.has("_state"))
9298      parseElementProperties(json.getAsJsonObject("_state"), res.getStateElement());
9299    if (json.has("time"))
9300      res.setTimeElement(parseInstant(json.get("time").getAsString()));
9301    if (json.has("_time"))
9302      parseElementProperties(json.getAsJsonObject("_time"), res.getTimeElement());
9303  }
9304
9305  protected DeviceRequest parseDeviceRequest(JsonObject json) throws IOException, FHIRFormatError {
9306    DeviceRequest res = new DeviceRequest();
9307    parseDeviceRequestProperties(json, res);
9308    return res;
9309  }
9310
9311  protected void parseDeviceRequestProperties(JsonObject json, DeviceRequest res) throws IOException, FHIRFormatError {
9312    parseDomainResourceProperties(json, res);
9313    if (json.has("identifier")) {
9314      JsonArray array = json.getAsJsonArray("identifier");
9315      for (int i = 0; i < array.size(); i++) {
9316        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9317      }
9318    };
9319    if (json.has("instantiatesCanonical")) {
9320      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
9321      for (int i = 0; i < array.size(); i++) {
9322        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
9323      }
9324    };
9325    if (json.has("_instantiatesCanonical")) {
9326      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
9327      for (int i = 0; i < array.size(); i++) {
9328        if (i == res.getInstantiatesCanonical().size())
9329          res.getInstantiatesCanonical().add(parseCanonical(null));
9330        if (array.get(i) instanceof JsonObject) 
9331          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
9332      }
9333    };
9334    if (json.has("instantiatesUri")) {
9335      JsonArray array = json.getAsJsonArray("instantiatesUri");
9336      for (int i = 0; i < array.size(); i++) {
9337        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
9338      }
9339    };
9340    if (json.has("_instantiatesUri")) {
9341      JsonArray array = json.getAsJsonArray("_instantiatesUri");
9342      for (int i = 0; i < array.size(); i++) {
9343        if (i == res.getInstantiatesUri().size())
9344          res.getInstantiatesUri().add(parseUri(null));
9345        if (array.get(i) instanceof JsonObject) 
9346          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
9347      }
9348    };
9349    if (json.has("basedOn")) {
9350      JsonArray array = json.getAsJsonArray("basedOn");
9351      for (int i = 0; i < array.size(); i++) {
9352        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9353      }
9354    };
9355    if (json.has("priorRequest")) {
9356      JsonArray array = json.getAsJsonArray("priorRequest");
9357      for (int i = 0; i < array.size(); i++) {
9358        res.getPriorRequest().add(parseReference(array.get(i).getAsJsonObject()));
9359      }
9360    };
9361    if (json.has("groupIdentifier"))
9362      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
9363    if (json.has("status"))
9364      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceRequest.DeviceRequestStatus.NULL, new DeviceRequest.DeviceRequestStatusEnumFactory()));
9365    if (json.has("_status"))
9366      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9367    if (json.has("intent"))
9368      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), DeviceRequest.RequestIntent.NULL, new DeviceRequest.RequestIntentEnumFactory()));
9369    if (json.has("_intent"))
9370      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
9371    if (json.has("priority"))
9372      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), DeviceRequest.RequestPriority.NULL, new DeviceRequest.RequestPriorityEnumFactory()));
9373    if (json.has("_priority"))
9374      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
9375    Type code = parseType("code", json);
9376    if (code != null)
9377      res.setCode(code);
9378    if (json.has("parameter")) {
9379      JsonArray array = json.getAsJsonArray("parameter");
9380      for (int i = 0; i < array.size(); i++) {
9381        res.getParameter().add(parseDeviceRequestDeviceRequestParameterComponent(array.get(i).getAsJsonObject(), res));
9382      }
9383    };
9384    if (json.has("subject"))
9385      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9386    if (json.has("context"))
9387      res.setContext(parseReference(json.getAsJsonObject("context")));
9388    Type occurrence = parseType("occurrence", json);
9389    if (occurrence != null)
9390      res.setOccurrence(occurrence);
9391    if (json.has("authoredOn"))
9392      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
9393    if (json.has("_authoredOn"))
9394      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
9395    if (json.has("requester"))
9396      res.setRequester(parseReference(json.getAsJsonObject("requester")));
9397    if (json.has("performerType"))
9398      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
9399    if (json.has("performer"))
9400      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
9401    if (json.has("reasonCode")) {
9402      JsonArray array = json.getAsJsonArray("reasonCode");
9403      for (int i = 0; i < array.size(); i++) {
9404        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9405      }
9406    };
9407    if (json.has("reasonReference")) {
9408      JsonArray array = json.getAsJsonArray("reasonReference");
9409      for (int i = 0; i < array.size(); i++) {
9410        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9411      }
9412    };
9413    if (json.has("insurance")) {
9414      JsonArray array = json.getAsJsonArray("insurance");
9415      for (int i = 0; i < array.size(); i++) {
9416        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
9417      }
9418    };
9419    if (json.has("supportingInfo")) {
9420      JsonArray array = json.getAsJsonArray("supportingInfo");
9421      for (int i = 0; i < array.size(); i++) {
9422        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
9423      }
9424    };
9425    if (json.has("note")) {
9426      JsonArray array = json.getAsJsonArray("note");
9427      for (int i = 0; i < array.size(); i++) {
9428        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9429      }
9430    };
9431    if (json.has("relevantHistory")) {
9432      JsonArray array = json.getAsJsonArray("relevantHistory");
9433      for (int i = 0; i < array.size(); i++) {
9434        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
9435      }
9436    };
9437  }
9438
9439  protected DeviceRequest.DeviceRequestParameterComponent parseDeviceRequestDeviceRequestParameterComponent(JsonObject json, DeviceRequest owner) throws IOException, FHIRFormatError {
9440    DeviceRequest.DeviceRequestParameterComponent res = new DeviceRequest.DeviceRequestParameterComponent();
9441    parseDeviceRequestDeviceRequestParameterComponentProperties(json, owner, res);
9442    return res;
9443  }
9444
9445  protected void parseDeviceRequestDeviceRequestParameterComponentProperties(JsonObject json, DeviceRequest owner, DeviceRequest.DeviceRequestParameterComponent res) throws IOException, FHIRFormatError {
9446    parseBackboneElementProperties(json, res);
9447    if (json.has("code"))
9448      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9449    Type value = parseType("value", json);
9450    if (value != null)
9451      res.setValue(value);
9452  }
9453
9454  protected DeviceUseStatement parseDeviceUseStatement(JsonObject json) throws IOException, FHIRFormatError {
9455    DeviceUseStatement res = new DeviceUseStatement();
9456    parseDeviceUseStatementProperties(json, res);
9457    return res;
9458  }
9459
9460  protected void parseDeviceUseStatementProperties(JsonObject json, DeviceUseStatement res) throws IOException, FHIRFormatError {
9461    parseDomainResourceProperties(json, res);
9462    if (json.has("identifier")) {
9463      JsonArray array = json.getAsJsonArray("identifier");
9464      for (int i = 0; i < array.size(); i++) {
9465        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9466      }
9467    };
9468    if (json.has("basedOn")) {
9469      JsonArray array = json.getAsJsonArray("basedOn");
9470      for (int i = 0; i < array.size(); i++) {
9471        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9472      }
9473    };
9474    if (json.has("status"))
9475      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DeviceUseStatement.DeviceUseStatementStatus.NULL, new DeviceUseStatement.DeviceUseStatementStatusEnumFactory()));
9476    if (json.has("_status"))
9477      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9478    if (json.has("subject"))
9479      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9480    if (json.has("derivedFrom")) {
9481      JsonArray array = json.getAsJsonArray("derivedFrom");
9482      for (int i = 0; i < array.size(); i++) {
9483        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
9484      }
9485    };
9486    Type timing = parseType("timing", json);
9487    if (timing != null)
9488      res.setTiming(timing);
9489    if (json.has("recordedOn"))
9490      res.setRecordedOnElement(parseDateTime(json.get("recordedOn").getAsString()));
9491    if (json.has("_recordedOn"))
9492      parseElementProperties(json.getAsJsonObject("_recordedOn"), res.getRecordedOnElement());
9493    if (json.has("source"))
9494      res.setSource(parseReference(json.getAsJsonObject("source")));
9495    if (json.has("device"))
9496      res.setDevice(parseReference(json.getAsJsonObject("device")));
9497    if (json.has("reasonCode")) {
9498      JsonArray array = json.getAsJsonArray("reasonCode");
9499      for (int i = 0; i < array.size(); i++) {
9500        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9501      }
9502    };
9503    if (json.has("reasonReference")) {
9504      JsonArray array = json.getAsJsonArray("reasonReference");
9505      for (int i = 0; i < array.size(); i++) {
9506        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
9507      }
9508    };
9509    if (json.has("bodySite"))
9510      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
9511    if (json.has("note")) {
9512      JsonArray array = json.getAsJsonArray("note");
9513      for (int i = 0; i < array.size(); i++) {
9514        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
9515      }
9516    };
9517  }
9518
9519  protected DiagnosticReport parseDiagnosticReport(JsonObject json) throws IOException, FHIRFormatError {
9520    DiagnosticReport res = new DiagnosticReport();
9521    parseDiagnosticReportProperties(json, res);
9522    return res;
9523  }
9524
9525  protected void parseDiagnosticReportProperties(JsonObject json, DiagnosticReport res) throws IOException, FHIRFormatError {
9526    parseDomainResourceProperties(json, res);
9527    if (json.has("identifier")) {
9528      JsonArray array = json.getAsJsonArray("identifier");
9529      for (int i = 0; i < array.size(); i++) {
9530        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9531      }
9532    };
9533    if (json.has("basedOn")) {
9534      JsonArray array = json.getAsJsonArray("basedOn");
9535      for (int i = 0; i < array.size(); i++) {
9536        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9537      }
9538    };
9539    if (json.has("status"))
9540      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), DiagnosticReport.DiagnosticReportStatus.NULL, new DiagnosticReport.DiagnosticReportStatusEnumFactory()));
9541    if (json.has("_status"))
9542      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9543    if (json.has("category"))
9544      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
9545    if (json.has("code"))
9546      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
9547    if (json.has("subject"))
9548      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9549    if (json.has("context"))
9550      res.setContext(parseReference(json.getAsJsonObject("context")));
9551    Type effective = parseType("effective", json);
9552    if (effective != null)
9553      res.setEffective(effective);
9554    if (json.has("issued"))
9555      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
9556    if (json.has("_issued"))
9557      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
9558    if (json.has("performer")) {
9559      JsonArray array = json.getAsJsonArray("performer");
9560      for (int i = 0; i < array.size(); i++) {
9561        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
9562      }
9563    };
9564    if (json.has("resultsInterpreter")) {
9565      JsonArray array = json.getAsJsonArray("resultsInterpreter");
9566      for (int i = 0; i < array.size(); i++) {
9567        res.getResultsInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
9568      }
9569    };
9570    if (json.has("specimen")) {
9571      JsonArray array = json.getAsJsonArray("specimen");
9572      for (int i = 0; i < array.size(); i++) {
9573        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
9574      }
9575    };
9576    if (json.has("result")) {
9577      JsonArray array = json.getAsJsonArray("result");
9578      for (int i = 0; i < array.size(); i++) {
9579        res.getResult().add(parseReference(array.get(i).getAsJsonObject()));
9580      }
9581    };
9582    if (json.has("imagingStudy")) {
9583      JsonArray array = json.getAsJsonArray("imagingStudy");
9584      for (int i = 0; i < array.size(); i++) {
9585        res.getImagingStudy().add(parseReference(array.get(i).getAsJsonObject()));
9586      }
9587    };
9588    if (json.has("media")) {
9589      JsonArray array = json.getAsJsonArray("media");
9590      for (int i = 0; i < array.size(); i++) {
9591        res.getMedia().add(parseDiagnosticReportDiagnosticReportMediaComponent(array.get(i).getAsJsonObject(), res));
9592      }
9593    };
9594    if (json.has("conclusion"))
9595      res.setConclusionElement(parseString(json.get("conclusion").getAsString()));
9596    if (json.has("_conclusion"))
9597      parseElementProperties(json.getAsJsonObject("_conclusion"), res.getConclusionElement());
9598    if (json.has("conclusionCode")) {
9599      JsonArray array = json.getAsJsonArray("conclusionCode");
9600      for (int i = 0; i < array.size(); i++) {
9601        res.getConclusionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9602      }
9603    };
9604    if (json.has("presentedForm")) {
9605      JsonArray array = json.getAsJsonArray("presentedForm");
9606      for (int i = 0; i < array.size(); i++) {
9607        res.getPresentedForm().add(parseAttachment(array.get(i).getAsJsonObject()));
9608      }
9609    };
9610  }
9611
9612  protected DiagnosticReport.DiagnosticReportMediaComponent parseDiagnosticReportDiagnosticReportMediaComponent(JsonObject json, DiagnosticReport owner) throws IOException, FHIRFormatError {
9613    DiagnosticReport.DiagnosticReportMediaComponent res = new DiagnosticReport.DiagnosticReportMediaComponent();
9614    parseDiagnosticReportDiagnosticReportMediaComponentProperties(json, owner, res);
9615    return res;
9616  }
9617
9618  protected void parseDiagnosticReportDiagnosticReportMediaComponentProperties(JsonObject json, DiagnosticReport owner, DiagnosticReport.DiagnosticReportMediaComponent res) throws IOException, FHIRFormatError {
9619    parseBackboneElementProperties(json, res);
9620    if (json.has("comment"))
9621      res.setCommentElement(parseString(json.get("comment").getAsString()));
9622    if (json.has("_comment"))
9623      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
9624    if (json.has("link"))
9625      res.setLink(parseReference(json.getAsJsonObject("link")));
9626  }
9627
9628  protected DocumentManifest parseDocumentManifest(JsonObject json) throws IOException, FHIRFormatError {
9629    DocumentManifest res = new DocumentManifest();
9630    parseDocumentManifestProperties(json, res);
9631    return res;
9632  }
9633
9634  protected void parseDocumentManifestProperties(JsonObject json, DocumentManifest res) throws IOException, FHIRFormatError {
9635    parseDomainResourceProperties(json, res);
9636    if (json.has("masterIdentifier"))
9637      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
9638    if (json.has("identifier")) {
9639      JsonArray array = json.getAsJsonArray("identifier");
9640      for (int i = 0; i < array.size(); i++) {
9641        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9642      }
9643    };
9644    if (json.has("status"))
9645      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
9646    if (json.has("_status"))
9647      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9648    if (json.has("type"))
9649      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9650    if (json.has("subject"))
9651      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9652    if (json.has("created"))
9653      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
9654    if (json.has("_created"))
9655      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
9656    if (json.has("agent")) {
9657      JsonArray array = json.getAsJsonArray("agent");
9658      for (int i = 0; i < array.size(); i++) {
9659        res.getAgent().add(parseDocumentManifestDocumentManifestAgentComponent(array.get(i).getAsJsonObject(), res));
9660      }
9661    };
9662    if (json.has("recipient")) {
9663      JsonArray array = json.getAsJsonArray("recipient");
9664      for (int i = 0; i < array.size(); i++) {
9665        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
9666      }
9667    };
9668    if (json.has("source"))
9669      res.setSourceElement(parseUri(json.get("source").getAsString()));
9670    if (json.has("_source"))
9671      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
9672    if (json.has("description"))
9673      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9674    if (json.has("_description"))
9675      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9676    if (json.has("content")) {
9677      JsonArray array = json.getAsJsonArray("content");
9678      for (int i = 0; i < array.size(); i++) {
9679        res.getContent().add(parseReference(array.get(i).getAsJsonObject()));
9680      }
9681    };
9682    if (json.has("related")) {
9683      JsonArray array = json.getAsJsonArray("related");
9684      for (int i = 0; i < array.size(); i++) {
9685        res.getRelated().add(parseDocumentManifestDocumentManifestRelatedComponent(array.get(i).getAsJsonObject(), res));
9686      }
9687    };
9688  }
9689
9690  protected DocumentManifest.DocumentManifestAgentComponent parseDocumentManifestDocumentManifestAgentComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
9691    DocumentManifest.DocumentManifestAgentComponent res = new DocumentManifest.DocumentManifestAgentComponent();
9692    parseDocumentManifestDocumentManifestAgentComponentProperties(json, owner, res);
9693    return res;
9694  }
9695
9696  protected void parseDocumentManifestDocumentManifestAgentComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestAgentComponent res) throws IOException, FHIRFormatError {
9697    parseBackboneElementProperties(json, res);
9698    if (json.has("type"))
9699      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9700    if (json.has("who"))
9701      res.setWho(parseReference(json.getAsJsonObject("who")));
9702  }
9703
9704  protected DocumentManifest.DocumentManifestRelatedComponent parseDocumentManifestDocumentManifestRelatedComponent(JsonObject json, DocumentManifest owner) throws IOException, FHIRFormatError {
9705    DocumentManifest.DocumentManifestRelatedComponent res = new DocumentManifest.DocumentManifestRelatedComponent();
9706    parseDocumentManifestDocumentManifestRelatedComponentProperties(json, owner, res);
9707    return res;
9708  }
9709
9710  protected void parseDocumentManifestDocumentManifestRelatedComponentProperties(JsonObject json, DocumentManifest owner, DocumentManifest.DocumentManifestRelatedComponent res) throws IOException, FHIRFormatError {
9711    parseBackboneElementProperties(json, res);
9712    if (json.has("identifier"))
9713      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
9714    if (json.has("ref"))
9715      res.setRef(parseReference(json.getAsJsonObject("ref")));
9716  }
9717
9718  protected DocumentReference parseDocumentReference(JsonObject json) throws IOException, FHIRFormatError {
9719    DocumentReference res = new DocumentReference();
9720    parseDocumentReferenceProperties(json, res);
9721    return res;
9722  }
9723
9724  protected void parseDocumentReferenceProperties(JsonObject json, DocumentReference res) throws IOException, FHIRFormatError {
9725    parseDomainResourceProperties(json, res);
9726    if (json.has("masterIdentifier"))
9727      res.setMasterIdentifier(parseIdentifier(json.getAsJsonObject("masterIdentifier")));
9728    if (json.has("identifier")) {
9729      JsonArray array = json.getAsJsonArray("identifier");
9730      for (int i = 0; i < array.size(); i++) {
9731        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9732      }
9733    };
9734    if (json.has("status"))
9735      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.DocumentReferenceStatus.NULL, new Enumerations.DocumentReferenceStatusEnumFactory()));
9736    if (json.has("_status"))
9737      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9738    if (json.has("docStatus"))
9739      res.setDocStatusElement(parseEnumeration(json.get("docStatus").getAsString(), DocumentReference.ReferredDocumentStatus.NULL, new DocumentReference.ReferredDocumentStatusEnumFactory()));
9740    if (json.has("_docStatus"))
9741      parseElementProperties(json.getAsJsonObject("_docStatus"), res.getDocStatusElement());
9742    if (json.has("type"))
9743      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9744    if (json.has("category")) {
9745      JsonArray array = json.getAsJsonArray("category");
9746      for (int i = 0; i < array.size(); i++) {
9747        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9748      }
9749    };
9750    if (json.has("subject"))
9751      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9752    if (json.has("date"))
9753      res.setDateElement(parseInstant(json.get("date").getAsString()));
9754    if (json.has("_date"))
9755      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
9756    if (json.has("agent")) {
9757      JsonArray array = json.getAsJsonArray("agent");
9758      for (int i = 0; i < array.size(); i++) {
9759        res.getAgent().add(parseDocumentReferenceDocumentReferenceAgentComponent(array.get(i).getAsJsonObject(), res));
9760      }
9761    };
9762    if (json.has("authenticator"))
9763      res.setAuthenticator(parseReference(json.getAsJsonObject("authenticator")));
9764    if (json.has("custodian"))
9765      res.setCustodian(parseReference(json.getAsJsonObject("custodian")));
9766    if (json.has("relatesTo")) {
9767      JsonArray array = json.getAsJsonArray("relatesTo");
9768      for (int i = 0; i < array.size(); i++) {
9769        res.getRelatesTo().add(parseDocumentReferenceDocumentReferenceRelatesToComponent(array.get(i).getAsJsonObject(), res));
9770      }
9771    };
9772    if (json.has("description"))
9773      res.setDescriptionElement(parseString(json.get("description").getAsString()));
9774    if (json.has("_description"))
9775      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
9776    if (json.has("securityLabel")) {
9777      JsonArray array = json.getAsJsonArray("securityLabel");
9778      for (int i = 0; i < array.size(); i++) {
9779        res.getSecurityLabel().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9780      }
9781    };
9782    if (json.has("content")) {
9783      JsonArray array = json.getAsJsonArray("content");
9784      for (int i = 0; i < array.size(); i++) {
9785        res.getContent().add(parseDocumentReferenceDocumentReferenceContentComponent(array.get(i).getAsJsonObject(), res));
9786      }
9787    };
9788    if (json.has("context"))
9789      res.setContext(parseDocumentReferenceDocumentReferenceContextComponent(json.getAsJsonObject("context"), res));
9790  }
9791
9792  protected DocumentReference.DocumentReferenceAgentComponent parseDocumentReferenceDocumentReferenceAgentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9793    DocumentReference.DocumentReferenceAgentComponent res = new DocumentReference.DocumentReferenceAgentComponent();
9794    parseDocumentReferenceDocumentReferenceAgentComponentProperties(json, owner, res);
9795    return res;
9796  }
9797
9798  protected void parseDocumentReferenceDocumentReferenceAgentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceAgentComponent res) throws IOException, FHIRFormatError {
9799    parseBackboneElementProperties(json, res);
9800    if (json.has("type"))
9801      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
9802    if (json.has("who"))
9803      res.setWho(parseReference(json.getAsJsonObject("who")));
9804  }
9805
9806  protected DocumentReference.DocumentReferenceRelatesToComponent parseDocumentReferenceDocumentReferenceRelatesToComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9807    DocumentReference.DocumentReferenceRelatesToComponent res = new DocumentReference.DocumentReferenceRelatesToComponent();
9808    parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(json, owner, res);
9809    return res;
9810  }
9811
9812  protected void parseDocumentReferenceDocumentReferenceRelatesToComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceRelatesToComponent res) throws IOException, FHIRFormatError {
9813    parseBackboneElementProperties(json, res);
9814    if (json.has("code"))
9815      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), DocumentReference.DocumentRelationshipType.NULL, new DocumentReference.DocumentRelationshipTypeEnumFactory()));
9816    if (json.has("_code"))
9817      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
9818    if (json.has("target"))
9819      res.setTarget(parseReference(json.getAsJsonObject("target")));
9820  }
9821
9822  protected DocumentReference.DocumentReferenceContentComponent parseDocumentReferenceDocumentReferenceContentComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9823    DocumentReference.DocumentReferenceContentComponent res = new DocumentReference.DocumentReferenceContentComponent();
9824    parseDocumentReferenceDocumentReferenceContentComponentProperties(json, owner, res);
9825    return res;
9826  }
9827
9828  protected void parseDocumentReferenceDocumentReferenceContentComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContentComponent res) throws IOException, FHIRFormatError {
9829    parseBackboneElementProperties(json, res);
9830    if (json.has("attachment"))
9831      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
9832    if (json.has("format"))
9833      res.setFormat(parseCoding(json.getAsJsonObject("format")));
9834  }
9835
9836  protected DocumentReference.DocumentReferenceContextComponent parseDocumentReferenceDocumentReferenceContextComponent(JsonObject json, DocumentReference owner) throws IOException, FHIRFormatError {
9837    DocumentReference.DocumentReferenceContextComponent res = new DocumentReference.DocumentReferenceContextComponent();
9838    parseDocumentReferenceDocumentReferenceContextComponentProperties(json, owner, res);
9839    return res;
9840  }
9841
9842  protected void parseDocumentReferenceDocumentReferenceContextComponentProperties(JsonObject json, DocumentReference owner, DocumentReference.DocumentReferenceContextComponent res) throws IOException, FHIRFormatError {
9843    parseBackboneElementProperties(json, res);
9844    if (json.has("encounter")) {
9845      JsonArray array = json.getAsJsonArray("encounter");
9846      for (int i = 0; i < array.size(); i++) {
9847        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
9848      }
9849    };
9850    if (json.has("event")) {
9851      JsonArray array = json.getAsJsonArray("event");
9852      for (int i = 0; i < array.size(); i++) {
9853        res.getEvent().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9854      }
9855    };
9856    if (json.has("period"))
9857      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9858    if (json.has("facilityType"))
9859      res.setFacilityType(parseCodeableConcept(json.getAsJsonObject("facilityType")));
9860    if (json.has("practiceSetting"))
9861      res.setPracticeSetting(parseCodeableConcept(json.getAsJsonObject("practiceSetting")));
9862    if (json.has("sourcePatientInfo"))
9863      res.setSourcePatientInfo(parseReference(json.getAsJsonObject("sourcePatientInfo")));
9864    if (json.has("related")) {
9865      JsonArray array = json.getAsJsonArray("related");
9866      for (int i = 0; i < array.size(); i++) {
9867        res.getRelated().add(parseReference(array.get(i).getAsJsonObject()));
9868      }
9869    };
9870  }
9871
9872  protected Encounter parseEncounter(JsonObject json) throws IOException, FHIRFormatError {
9873    Encounter res = new Encounter();
9874    parseEncounterProperties(json, res);
9875    return res;
9876  }
9877
9878  protected void parseEncounterProperties(JsonObject json, Encounter res) throws IOException, FHIRFormatError {
9879    parseDomainResourceProperties(json, res);
9880    if (json.has("identifier")) {
9881      JsonArray array = json.getAsJsonArray("identifier");
9882      for (int i = 0; i < array.size(); i++) {
9883        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
9884      }
9885    };
9886    if (json.has("status"))
9887      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
9888    if (json.has("_status"))
9889      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9890    if (json.has("statusHistory")) {
9891      JsonArray array = json.getAsJsonArray("statusHistory");
9892      for (int i = 0; i < array.size(); i++) {
9893        res.getStatusHistory().add(parseEncounterStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
9894      }
9895    };
9896    if (json.has("class"))
9897      res.setClass_(parseCoding(json.getAsJsonObject("class")));
9898    if (json.has("classHistory")) {
9899      JsonArray array = json.getAsJsonArray("classHistory");
9900      for (int i = 0; i < array.size(); i++) {
9901        res.getClassHistory().add(parseEncounterClassHistoryComponent(array.get(i).getAsJsonObject(), res));
9902      }
9903    };
9904    if (json.has("type")) {
9905      JsonArray array = json.getAsJsonArray("type");
9906      for (int i = 0; i < array.size(); i++) {
9907        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9908      }
9909    };
9910    if (json.has("serviceType"))
9911      res.setServiceType(parseCodeableConcept(json.getAsJsonObject("serviceType")));
9912    if (json.has("priority"))
9913      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
9914    if (json.has("subject"))
9915      res.setSubject(parseReference(json.getAsJsonObject("subject")));
9916    if (json.has("episodeOfCare")) {
9917      JsonArray array = json.getAsJsonArray("episodeOfCare");
9918      for (int i = 0; i < array.size(); i++) {
9919        res.getEpisodeOfCare().add(parseReference(array.get(i).getAsJsonObject()));
9920      }
9921    };
9922    if (json.has("basedOn")) {
9923      JsonArray array = json.getAsJsonArray("basedOn");
9924      for (int i = 0; i < array.size(); i++) {
9925        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
9926      }
9927    };
9928    if (json.has("participant")) {
9929      JsonArray array = json.getAsJsonArray("participant");
9930      for (int i = 0; i < array.size(); i++) {
9931        res.getParticipant().add(parseEncounterEncounterParticipantComponent(array.get(i).getAsJsonObject(), res));
9932      }
9933    };
9934    if (json.has("appointment"))
9935      res.setAppointment(parseReference(json.getAsJsonObject("appointment")));
9936    if (json.has("period"))
9937      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9938    if (json.has("length"))
9939      res.setLength(parseDuration(json.getAsJsonObject("length")));
9940    if (json.has("reason")) {
9941      JsonArray array = json.getAsJsonArray("reason");
9942      for (int i = 0; i < array.size(); i++) {
9943        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
9944      }
9945    };
9946    if (json.has("diagnosis")) {
9947      JsonArray array = json.getAsJsonArray("diagnosis");
9948      for (int i = 0; i < array.size(); i++) {
9949        res.getDiagnosis().add(parseEncounterDiagnosisComponent(array.get(i).getAsJsonObject(), res));
9950      }
9951    };
9952    if (json.has("account")) {
9953      JsonArray array = json.getAsJsonArray("account");
9954      for (int i = 0; i < array.size(); i++) {
9955        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
9956      }
9957    };
9958    if (json.has("hospitalization"))
9959      res.setHospitalization(parseEncounterEncounterHospitalizationComponent(json.getAsJsonObject("hospitalization"), res));
9960    if (json.has("location")) {
9961      JsonArray array = json.getAsJsonArray("location");
9962      for (int i = 0; i < array.size(); i++) {
9963        res.getLocation().add(parseEncounterEncounterLocationComponent(array.get(i).getAsJsonObject(), res));
9964      }
9965    };
9966    if (json.has("serviceProvider"))
9967      res.setServiceProvider(parseReference(json.getAsJsonObject("serviceProvider")));
9968    if (json.has("partOf"))
9969      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
9970  }
9971
9972  protected Encounter.StatusHistoryComponent parseEncounterStatusHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
9973    Encounter.StatusHistoryComponent res = new Encounter.StatusHistoryComponent();
9974    parseEncounterStatusHistoryComponentProperties(json, owner, res);
9975    return res;
9976  }
9977
9978  protected void parseEncounterStatusHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.StatusHistoryComponent res) throws IOException, FHIRFormatError {
9979    parseBackboneElementProperties(json, res);
9980    if (json.has("status"))
9981      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterStatus.NULL, new Encounter.EncounterStatusEnumFactory()));
9982    if (json.has("_status"))
9983      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
9984    if (json.has("period"))
9985      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
9986  }
9987
9988  protected Encounter.ClassHistoryComponent parseEncounterClassHistoryComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
9989    Encounter.ClassHistoryComponent res = new Encounter.ClassHistoryComponent();
9990    parseEncounterClassHistoryComponentProperties(json, owner, res);
9991    return res;
9992  }
9993
9994  protected void parseEncounterClassHistoryComponentProperties(JsonObject json, Encounter owner, Encounter.ClassHistoryComponent res) throws IOException, FHIRFormatError {
9995    parseBackboneElementProperties(json, res);
9996    if (json.has("class"))
9997      res.setClass_(parseCoding(json.getAsJsonObject("class")));
9998    if (json.has("period"))
9999      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10000  }
10001
10002  protected Encounter.EncounterParticipantComponent parseEncounterEncounterParticipantComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10003    Encounter.EncounterParticipantComponent res = new Encounter.EncounterParticipantComponent();
10004    parseEncounterEncounterParticipantComponentProperties(json, owner, res);
10005    return res;
10006  }
10007
10008  protected void parseEncounterEncounterParticipantComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterParticipantComponent res) throws IOException, FHIRFormatError {
10009    parseBackboneElementProperties(json, res);
10010    if (json.has("type")) {
10011      JsonArray array = json.getAsJsonArray("type");
10012      for (int i = 0; i < array.size(); i++) {
10013        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10014      }
10015    };
10016    if (json.has("period"))
10017      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10018    if (json.has("individual"))
10019      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
10020  }
10021
10022  protected Encounter.DiagnosisComponent parseEncounterDiagnosisComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10023    Encounter.DiagnosisComponent res = new Encounter.DiagnosisComponent();
10024    parseEncounterDiagnosisComponentProperties(json, owner, res);
10025    return res;
10026  }
10027
10028  protected void parseEncounterDiagnosisComponentProperties(JsonObject json, Encounter owner, Encounter.DiagnosisComponent res) throws IOException, FHIRFormatError {
10029    parseBackboneElementProperties(json, res);
10030    if (json.has("condition"))
10031      res.setCondition(parseReference(json.getAsJsonObject("condition")));
10032    if (json.has("role"))
10033      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
10034    if (json.has("rank"))
10035      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
10036    if (json.has("_rank"))
10037      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
10038  }
10039
10040  protected Encounter.EncounterHospitalizationComponent parseEncounterEncounterHospitalizationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10041    Encounter.EncounterHospitalizationComponent res = new Encounter.EncounterHospitalizationComponent();
10042    parseEncounterEncounterHospitalizationComponentProperties(json, owner, res);
10043    return res;
10044  }
10045
10046  protected void parseEncounterEncounterHospitalizationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterHospitalizationComponent res) throws IOException, FHIRFormatError {
10047    parseBackboneElementProperties(json, res);
10048    if (json.has("preAdmissionIdentifier"))
10049      res.setPreAdmissionIdentifier(parseIdentifier(json.getAsJsonObject("preAdmissionIdentifier")));
10050    if (json.has("origin"))
10051      res.setOrigin(parseReference(json.getAsJsonObject("origin")));
10052    if (json.has("admitSource"))
10053      res.setAdmitSource(parseCodeableConcept(json.getAsJsonObject("admitSource")));
10054    if (json.has("reAdmission"))
10055      res.setReAdmission(parseCodeableConcept(json.getAsJsonObject("reAdmission")));
10056    if (json.has("dietPreference")) {
10057      JsonArray array = json.getAsJsonArray("dietPreference");
10058      for (int i = 0; i < array.size(); i++) {
10059        res.getDietPreference().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10060      }
10061    };
10062    if (json.has("specialCourtesy")) {
10063      JsonArray array = json.getAsJsonArray("specialCourtesy");
10064      for (int i = 0; i < array.size(); i++) {
10065        res.getSpecialCourtesy().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10066      }
10067    };
10068    if (json.has("specialArrangement")) {
10069      JsonArray array = json.getAsJsonArray("specialArrangement");
10070      for (int i = 0; i < array.size(); i++) {
10071        res.getSpecialArrangement().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10072      }
10073    };
10074    if (json.has("destination"))
10075      res.setDestination(parseReference(json.getAsJsonObject("destination")));
10076    if (json.has("dischargeDisposition"))
10077      res.setDischargeDisposition(parseCodeableConcept(json.getAsJsonObject("dischargeDisposition")));
10078  }
10079
10080  protected Encounter.EncounterLocationComponent parseEncounterEncounterLocationComponent(JsonObject json, Encounter owner) throws IOException, FHIRFormatError {
10081    Encounter.EncounterLocationComponent res = new Encounter.EncounterLocationComponent();
10082    parseEncounterEncounterLocationComponentProperties(json, owner, res);
10083    return res;
10084  }
10085
10086  protected void parseEncounterEncounterLocationComponentProperties(JsonObject json, Encounter owner, Encounter.EncounterLocationComponent res) throws IOException, FHIRFormatError {
10087    parseBackboneElementProperties(json, res);
10088    if (json.has("location"))
10089      res.setLocation(parseReference(json.getAsJsonObject("location")));
10090    if (json.has("status"))
10091      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Encounter.EncounterLocationStatus.NULL, new Encounter.EncounterLocationStatusEnumFactory()));
10092    if (json.has("_status"))
10093      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10094    if (json.has("period"))
10095      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10096  }
10097
10098  protected Endpoint parseEndpoint(JsonObject json) throws IOException, FHIRFormatError {
10099    Endpoint res = new Endpoint();
10100    parseEndpointProperties(json, res);
10101    return res;
10102  }
10103
10104  protected void parseEndpointProperties(JsonObject json, Endpoint res) throws IOException, FHIRFormatError {
10105    parseDomainResourceProperties(json, res);
10106    if (json.has("identifier")) {
10107      JsonArray array = json.getAsJsonArray("identifier");
10108      for (int i = 0; i < array.size(); i++) {
10109        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10110      }
10111    };
10112    if (json.has("status"))
10113      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Endpoint.EndpointStatus.NULL, new Endpoint.EndpointStatusEnumFactory()));
10114    if (json.has("_status"))
10115      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10116    if (json.has("connectionType"))
10117      res.setConnectionType(parseCoding(json.getAsJsonObject("connectionType")));
10118    if (json.has("name"))
10119      res.setNameElement(parseString(json.get("name").getAsString()));
10120    if (json.has("_name"))
10121      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10122    if (json.has("managingOrganization"))
10123      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
10124    if (json.has("contact")) {
10125      JsonArray array = json.getAsJsonArray("contact");
10126      for (int i = 0; i < array.size(); i++) {
10127        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
10128      }
10129    };
10130    if (json.has("period"))
10131      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10132    if (json.has("payloadType")) {
10133      JsonArray array = json.getAsJsonArray("payloadType");
10134      for (int i = 0; i < array.size(); i++) {
10135        res.getPayloadType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10136      }
10137    };
10138    if (json.has("payloadMimeType")) {
10139      JsonArray array = json.getAsJsonArray("payloadMimeType");
10140      for (int i = 0; i < array.size(); i++) {
10141        res.getPayloadMimeType().add(parseCode(array.get(i).getAsString()));
10142      }
10143    };
10144    if (json.has("_payloadMimeType")) {
10145      JsonArray array = json.getAsJsonArray("_payloadMimeType");
10146      for (int i = 0; i < array.size(); i++) {
10147        if (i == res.getPayloadMimeType().size())
10148          res.getPayloadMimeType().add(parseCode(null));
10149        if (array.get(i) instanceof JsonObject) 
10150          parseElementProperties(array.get(i).getAsJsonObject(), res.getPayloadMimeType().get(i));
10151      }
10152    };
10153    if (json.has("address"))
10154      res.setAddressElement(parseUrl(json.get("address").getAsString()));
10155    if (json.has("_address"))
10156      parseElementProperties(json.getAsJsonObject("_address"), res.getAddressElement());
10157    if (json.has("header")) {
10158      JsonArray array = json.getAsJsonArray("header");
10159      for (int i = 0; i < array.size(); i++) {
10160        res.getHeader().add(parseString(array.get(i).getAsString()));
10161      }
10162    };
10163    if (json.has("_header")) {
10164      JsonArray array = json.getAsJsonArray("_header");
10165      for (int i = 0; i < array.size(); i++) {
10166        if (i == res.getHeader().size())
10167          res.getHeader().add(parseString(null));
10168        if (array.get(i) instanceof JsonObject) 
10169          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
10170      }
10171    };
10172  }
10173
10174  protected EnrollmentRequest parseEnrollmentRequest(JsonObject json) throws IOException, FHIRFormatError {
10175    EnrollmentRequest res = new EnrollmentRequest();
10176    parseEnrollmentRequestProperties(json, res);
10177    return res;
10178  }
10179
10180  protected void parseEnrollmentRequestProperties(JsonObject json, EnrollmentRequest res) throws IOException, FHIRFormatError {
10181    parseDomainResourceProperties(json, res);
10182    if (json.has("identifier")) {
10183      JsonArray array = json.getAsJsonArray("identifier");
10184      for (int i = 0; i < array.size(); i++) {
10185        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10186      }
10187    };
10188    if (json.has("status"))
10189      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentRequest.EnrollmentRequestStatus.NULL, new EnrollmentRequest.EnrollmentRequestStatusEnumFactory()));
10190    if (json.has("_status"))
10191      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10192    if (json.has("created"))
10193      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10194    if (json.has("_created"))
10195      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
10196    if (json.has("insurer"))
10197      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
10198    if (json.has("provider"))
10199      res.setProvider(parseReference(json.getAsJsonObject("provider")));
10200    if (json.has("candidate"))
10201      res.setCandidate(parseReference(json.getAsJsonObject("candidate")));
10202    if (json.has("coverage"))
10203      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
10204  }
10205
10206  protected EnrollmentResponse parseEnrollmentResponse(JsonObject json) throws IOException, FHIRFormatError {
10207    EnrollmentResponse res = new EnrollmentResponse();
10208    parseEnrollmentResponseProperties(json, res);
10209    return res;
10210  }
10211
10212  protected void parseEnrollmentResponseProperties(JsonObject json, EnrollmentResponse res) throws IOException, FHIRFormatError {
10213    parseDomainResourceProperties(json, res);
10214    if (json.has("identifier")) {
10215      JsonArray array = json.getAsJsonArray("identifier");
10216      for (int i = 0; i < array.size(); i++) {
10217        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10218      }
10219    };
10220    if (json.has("status"))
10221      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EnrollmentResponse.EnrollmentResponseStatus.NULL, new EnrollmentResponse.EnrollmentResponseStatusEnumFactory()));
10222    if (json.has("_status"))
10223      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10224    if (json.has("request"))
10225      res.setRequest(parseReference(json.getAsJsonObject("request")));
10226    if (json.has("outcome"))
10227      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
10228    if (json.has("_outcome"))
10229      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
10230    if (json.has("disposition"))
10231      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
10232    if (json.has("_disposition"))
10233      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
10234    if (json.has("created"))
10235      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10236    if (json.has("_created"))
10237      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
10238    if (json.has("organization"))
10239      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
10240    if (json.has("requestProvider"))
10241      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
10242  }
10243
10244  protected EpisodeOfCare parseEpisodeOfCare(JsonObject json) throws IOException, FHIRFormatError {
10245    EpisodeOfCare res = new EpisodeOfCare();
10246    parseEpisodeOfCareProperties(json, res);
10247    return res;
10248  }
10249
10250  protected void parseEpisodeOfCareProperties(JsonObject json, EpisodeOfCare res) throws IOException, FHIRFormatError {
10251    parseDomainResourceProperties(json, res);
10252    if (json.has("identifier")) {
10253      JsonArray array = json.getAsJsonArray("identifier");
10254      for (int i = 0; i < array.size(); i++) {
10255        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10256      }
10257    };
10258    if (json.has("status"))
10259      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
10260    if (json.has("_status"))
10261      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10262    if (json.has("statusHistory")) {
10263      JsonArray array = json.getAsJsonArray("statusHistory");
10264      for (int i = 0; i < array.size(); i++) {
10265        res.getStatusHistory().add(parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(array.get(i).getAsJsonObject(), res));
10266      }
10267    };
10268    if (json.has("type")) {
10269      JsonArray array = json.getAsJsonArray("type");
10270      for (int i = 0; i < array.size(); i++) {
10271        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10272      }
10273    };
10274    if (json.has("diagnosis")) {
10275      JsonArray array = json.getAsJsonArray("diagnosis");
10276      for (int i = 0; i < array.size(); i++) {
10277        res.getDiagnosis().add(parseEpisodeOfCareDiagnosisComponent(array.get(i).getAsJsonObject(), res));
10278      }
10279    };
10280    if (json.has("patient"))
10281      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10282    if (json.has("managingOrganization"))
10283      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
10284    if (json.has("period"))
10285      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10286    if (json.has("referralRequest")) {
10287      JsonArray array = json.getAsJsonArray("referralRequest");
10288      for (int i = 0; i < array.size(); i++) {
10289        res.getReferralRequest().add(parseReference(array.get(i).getAsJsonObject()));
10290      }
10291    };
10292    if (json.has("careManager"))
10293      res.setCareManager(parseReference(json.getAsJsonObject("careManager")));
10294    if (json.has("team")) {
10295      JsonArray array = json.getAsJsonArray("team");
10296      for (int i = 0; i < array.size(); i++) {
10297        res.getTeam().add(parseReference(array.get(i).getAsJsonObject()));
10298      }
10299    };
10300    if (json.has("account")) {
10301      JsonArray array = json.getAsJsonArray("account");
10302      for (int i = 0; i < array.size(); i++) {
10303        res.getAccount().add(parseReference(array.get(i).getAsJsonObject()));
10304      }
10305    };
10306  }
10307
10308  protected EpisodeOfCare.EpisodeOfCareStatusHistoryComponent parseEpisodeOfCareEpisodeOfCareStatusHistoryComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
10309    EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res = new EpisodeOfCare.EpisodeOfCareStatusHistoryComponent();
10310    parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(json, owner, res);
10311    return res;
10312  }
10313
10314  protected void parseEpisodeOfCareEpisodeOfCareStatusHistoryComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent res) throws IOException, FHIRFormatError {
10315    parseBackboneElementProperties(json, res);
10316    if (json.has("status"))
10317      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), EpisodeOfCare.EpisodeOfCareStatus.NULL, new EpisodeOfCare.EpisodeOfCareStatusEnumFactory()));
10318    if (json.has("_status"))
10319      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10320    if (json.has("period"))
10321      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
10322  }
10323
10324  protected EpisodeOfCare.DiagnosisComponent parseEpisodeOfCareDiagnosisComponent(JsonObject json, EpisodeOfCare owner) throws IOException, FHIRFormatError {
10325    EpisodeOfCare.DiagnosisComponent res = new EpisodeOfCare.DiagnosisComponent();
10326    parseEpisodeOfCareDiagnosisComponentProperties(json, owner, res);
10327    return res;
10328  }
10329
10330  protected void parseEpisodeOfCareDiagnosisComponentProperties(JsonObject json, EpisodeOfCare owner, EpisodeOfCare.DiagnosisComponent res) throws IOException, FHIRFormatError {
10331    parseBackboneElementProperties(json, res);
10332    if (json.has("condition"))
10333      res.setCondition(parseReference(json.getAsJsonObject("condition")));
10334    if (json.has("role"))
10335      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
10336    if (json.has("rank"))
10337      res.setRankElement(parsePositiveInt(json.get("rank").getAsString()));
10338    if (json.has("_rank"))
10339      parseElementProperties(json.getAsJsonObject("_rank"), res.getRankElement());
10340  }
10341
10342  protected EventDefinition parseEventDefinition(JsonObject json) throws IOException, FHIRFormatError {
10343    EventDefinition res = new EventDefinition();
10344    parseEventDefinitionProperties(json, res);
10345    return res;
10346  }
10347
10348  protected void parseEventDefinitionProperties(JsonObject json, EventDefinition res) throws IOException, FHIRFormatError {
10349    parseDomainResourceProperties(json, res);
10350    if (json.has("url"))
10351      res.setUrlElement(parseUri(json.get("url").getAsString()));
10352    if (json.has("_url"))
10353      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10354    if (json.has("identifier")) {
10355      JsonArray array = json.getAsJsonArray("identifier");
10356      for (int i = 0; i < array.size(); i++) {
10357        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10358      }
10359    };
10360    if (json.has("version"))
10361      res.setVersionElement(parseString(json.get("version").getAsString()));
10362    if (json.has("_version"))
10363      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10364    if (json.has("name"))
10365      res.setNameElement(parseString(json.get("name").getAsString()));
10366    if (json.has("_name"))
10367      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10368    if (json.has("title"))
10369      res.setTitleElement(parseString(json.get("title").getAsString()));
10370    if (json.has("_title"))
10371      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
10372    if (json.has("subtitle"))
10373      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
10374    if (json.has("_subtitle"))
10375      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
10376    if (json.has("status"))
10377      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10378    if (json.has("_status"))
10379      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10380    if (json.has("experimental"))
10381      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10382    if (json.has("_experimental"))
10383      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10384    Type subject = parseType("subject", json);
10385    if (subject != null)
10386      res.setSubject(subject);
10387    if (json.has("date"))
10388      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10389    if (json.has("_date"))
10390      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10391    if (json.has("publisher"))
10392      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10393    if (json.has("_publisher"))
10394      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10395    if (json.has("contact")) {
10396      JsonArray array = json.getAsJsonArray("contact");
10397      for (int i = 0; i < array.size(); i++) {
10398        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10399      }
10400    };
10401    if (json.has("description"))
10402      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10403    if (json.has("_description"))
10404      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10405    if (json.has("useContext")) {
10406      JsonArray array = json.getAsJsonArray("useContext");
10407      for (int i = 0; i < array.size(); i++) {
10408        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10409      }
10410    };
10411    if (json.has("jurisdiction")) {
10412      JsonArray array = json.getAsJsonArray("jurisdiction");
10413      for (int i = 0; i < array.size(); i++) {
10414        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10415      }
10416    };
10417    if (json.has("purpose"))
10418      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
10419    if (json.has("_purpose"))
10420      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
10421    if (json.has("usage"))
10422      res.setUsageElement(parseString(json.get("usage").getAsString()));
10423    if (json.has("_usage"))
10424      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
10425    if (json.has("copyright"))
10426      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10427    if (json.has("_copyright"))
10428      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10429    if (json.has("approvalDate"))
10430      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
10431    if (json.has("_approvalDate"))
10432      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
10433    if (json.has("lastReviewDate"))
10434      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
10435    if (json.has("_lastReviewDate"))
10436      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
10437    if (json.has("effectivePeriod"))
10438      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
10439    if (json.has("topic")) {
10440      JsonArray array = json.getAsJsonArray("topic");
10441      for (int i = 0; i < array.size(); i++) {
10442        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10443      }
10444    };
10445    if (json.has("author")) {
10446      JsonArray array = json.getAsJsonArray("author");
10447      for (int i = 0; i < array.size(); i++) {
10448        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10449      }
10450    };
10451    if (json.has("editor")) {
10452      JsonArray array = json.getAsJsonArray("editor");
10453      for (int i = 0; i < array.size(); i++) {
10454        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
10455      }
10456    };
10457    if (json.has("reviewer")) {
10458      JsonArray array = json.getAsJsonArray("reviewer");
10459      for (int i = 0; i < array.size(); i++) {
10460        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
10461      }
10462    };
10463    if (json.has("endorser")) {
10464      JsonArray array = json.getAsJsonArray("endorser");
10465      for (int i = 0; i < array.size(); i++) {
10466        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
10467      }
10468    };
10469    if (json.has("relatedArtifact")) {
10470      JsonArray array = json.getAsJsonArray("relatedArtifact");
10471      for (int i = 0; i < array.size(); i++) {
10472        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
10473      }
10474    };
10475    if (json.has("trigger"))
10476      res.setTrigger(parseTriggerDefinition(json.getAsJsonObject("trigger")));
10477  }
10478
10479  protected ExampleScenario parseExampleScenario(JsonObject json) throws IOException, FHIRFormatError {
10480    ExampleScenario res = new ExampleScenario();
10481    parseExampleScenarioProperties(json, res);
10482    return res;
10483  }
10484
10485  protected void parseExampleScenarioProperties(JsonObject json, ExampleScenario res) throws IOException, FHIRFormatError {
10486    parseDomainResourceProperties(json, res);
10487    if (json.has("url"))
10488      res.setUrlElement(parseUri(json.get("url").getAsString()));
10489    if (json.has("_url"))
10490      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
10491    if (json.has("identifier")) {
10492      JsonArray array = json.getAsJsonArray("identifier");
10493      for (int i = 0; i < array.size(); i++) {
10494        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10495      }
10496    };
10497    if (json.has("version"))
10498      res.setVersionElement(parseString(json.get("version").getAsString()));
10499    if (json.has("_version"))
10500      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
10501    if (json.has("name"))
10502      res.setNameElement(parseString(json.get("name").getAsString()));
10503    if (json.has("_name"))
10504      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10505    if (json.has("status"))
10506      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
10507    if (json.has("_status"))
10508      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10509    if (json.has("experimental"))
10510      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
10511    if (json.has("_experimental"))
10512      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
10513    if (json.has("date"))
10514      res.setDateElement(parseDateTime(json.get("date").getAsString()));
10515    if (json.has("_date"))
10516      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
10517    if (json.has("publisher"))
10518      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
10519    if (json.has("_publisher"))
10520      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
10521    if (json.has("contact")) {
10522      JsonArray array = json.getAsJsonArray("contact");
10523      for (int i = 0; i < array.size(); i++) {
10524        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
10525      }
10526    };
10527    if (json.has("useContext")) {
10528      JsonArray array = json.getAsJsonArray("useContext");
10529      for (int i = 0; i < array.size(); i++) {
10530        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
10531      }
10532    };
10533    if (json.has("jurisdiction")) {
10534      JsonArray array = json.getAsJsonArray("jurisdiction");
10535      for (int i = 0; i < array.size(); i++) {
10536        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
10537      }
10538    };
10539    if (json.has("copyright"))
10540      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
10541    if (json.has("_copyright"))
10542      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
10543    if (json.has("purpose"))
10544      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
10545    if (json.has("_purpose"))
10546      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
10547    if (json.has("actor")) {
10548      JsonArray array = json.getAsJsonArray("actor");
10549      for (int i = 0; i < array.size(); i++) {
10550        res.getActor().add(parseExampleScenarioExampleScenarioActorComponent(array.get(i).getAsJsonObject(), res));
10551      }
10552    };
10553    if (json.has("instance")) {
10554      JsonArray array = json.getAsJsonArray("instance");
10555      for (int i = 0; i < array.size(); i++) {
10556        res.getInstance().add(parseExampleScenarioExampleScenarioInstanceComponent(array.get(i).getAsJsonObject(), res));
10557      }
10558    };
10559    if (json.has("process")) {
10560      JsonArray array = json.getAsJsonArray("process");
10561      for (int i = 0; i < array.size(); i++) {
10562        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), res));
10563      }
10564    };
10565    if (json.has("workflow")) {
10566      JsonArray array = json.getAsJsonArray("workflow");
10567      for (int i = 0; i < array.size(); i++) {
10568        res.getWorkflow().add(parseCanonical(array.get(i).getAsString()));
10569      }
10570    };
10571    if (json.has("_workflow")) {
10572      JsonArray array = json.getAsJsonArray("_workflow");
10573      for (int i = 0; i < array.size(); i++) {
10574        if (i == res.getWorkflow().size())
10575          res.getWorkflow().add(parseCanonical(null));
10576        if (array.get(i) instanceof JsonObject) 
10577          parseElementProperties(array.get(i).getAsJsonObject(), res.getWorkflow().get(i));
10578      }
10579    };
10580  }
10581
10582  protected ExampleScenario.ExampleScenarioActorComponent parseExampleScenarioExampleScenarioActorComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
10583    ExampleScenario.ExampleScenarioActorComponent res = new ExampleScenario.ExampleScenarioActorComponent();
10584    parseExampleScenarioExampleScenarioActorComponentProperties(json, owner, res);
10585    return res;
10586  }
10587
10588  protected void parseExampleScenarioExampleScenarioActorComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioActorComponent res) throws IOException, FHIRFormatError {
10589    parseBackboneElementProperties(json, res);
10590    if (json.has("actorId"))
10591      res.setActorIdElement(parseString(json.get("actorId").getAsString()));
10592    if (json.has("_actorId"))
10593      parseElementProperties(json.getAsJsonObject("_actorId"), res.getActorIdElement());
10594    if (json.has("type"))
10595      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), ExampleScenario.ExampleScenarioActorType.NULL, new ExampleScenario.ExampleScenarioActorTypeEnumFactory()));
10596    if (json.has("_type"))
10597      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10598    if (json.has("name"))
10599      res.setNameElement(parseString(json.get("name").getAsString()));
10600    if (json.has("_name"))
10601      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10602    if (json.has("description"))
10603      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10604    if (json.has("_description"))
10605      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10606  }
10607
10608  protected ExampleScenario.ExampleScenarioInstanceComponent parseExampleScenarioExampleScenarioInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
10609    ExampleScenario.ExampleScenarioInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceComponent();
10610    parseExampleScenarioExampleScenarioInstanceComponentProperties(json, owner, res);
10611    return res;
10612  }
10613
10614  protected void parseExampleScenarioExampleScenarioInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceComponent res) throws IOException, FHIRFormatError {
10615    parseBackboneElementProperties(json, res);
10616    if (json.has("resourceId"))
10617      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
10618    if (json.has("_resourceId"))
10619      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
10620    if (json.has("resourceType"))
10621      res.setResourceTypeElement(parseEnumeration(json.get("resourceType").getAsString(), ExampleScenario.FHIRResourceType.NULL, new ExampleScenario.FHIRResourceTypeEnumFactory()));
10622    if (json.has("_resourceType"))
10623      parseElementProperties(json.getAsJsonObject("_resourceType"), res.getResourceTypeElement());
10624    if (json.has("name"))
10625      res.setNameElement(parseString(json.get("name").getAsString()));
10626    if (json.has("_name"))
10627      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10628    if (json.has("description"))
10629      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10630    if (json.has("_description"))
10631      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10632    if (json.has("version")) {
10633      JsonArray array = json.getAsJsonArray("version");
10634      for (int i = 0; i < array.size(); i++) {
10635        res.getVersion().add(parseExampleScenarioExampleScenarioInstanceVersionComponent(array.get(i).getAsJsonObject(), owner));
10636      }
10637    };
10638    if (json.has("containedInstance")) {
10639      JsonArray array = json.getAsJsonArray("containedInstance");
10640      for (int i = 0; i < array.size(); i++) {
10641        res.getContainedInstance().add(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(array.get(i).getAsJsonObject(), owner));
10642      }
10643    };
10644  }
10645
10646  protected ExampleScenario.ExampleScenarioInstanceVersionComponent parseExampleScenarioExampleScenarioInstanceVersionComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
10647    ExampleScenario.ExampleScenarioInstanceVersionComponent res = new ExampleScenario.ExampleScenarioInstanceVersionComponent();
10648    parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(json, owner, res);
10649    return res;
10650  }
10651
10652  protected void parseExampleScenarioExampleScenarioInstanceVersionComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceVersionComponent res) throws IOException, FHIRFormatError {
10653    parseBackboneElementProperties(json, res);
10654    if (json.has("versionId"))
10655      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
10656    if (json.has("_versionId"))
10657      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
10658    if (json.has("description"))
10659      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10660    if (json.has("_description"))
10661      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10662  }
10663
10664  protected ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
10665    ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res = new ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent();
10666    parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(json, owner, res);
10667    return res;
10668  }
10669
10670  protected void parseExampleScenarioExampleScenarioInstanceContainedInstanceComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent res) throws IOException, FHIRFormatError {
10671    parseBackboneElementProperties(json, res);
10672    if (json.has("resourceId"))
10673      res.setResourceIdElement(parseString(json.get("resourceId").getAsString()));
10674    if (json.has("_resourceId"))
10675      parseElementProperties(json.getAsJsonObject("_resourceId"), res.getResourceIdElement());
10676    if (json.has("versionId"))
10677      res.setVersionIdElement(parseString(json.get("versionId").getAsString()));
10678    if (json.has("_versionId"))
10679      parseElementProperties(json.getAsJsonObject("_versionId"), res.getVersionIdElement());
10680  }
10681
10682  protected ExampleScenario.ExampleScenarioProcessComponent parseExampleScenarioExampleScenarioProcessComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
10683    ExampleScenario.ExampleScenarioProcessComponent res = new ExampleScenario.ExampleScenarioProcessComponent();
10684    parseExampleScenarioExampleScenarioProcessComponentProperties(json, owner, res);
10685    return res;
10686  }
10687
10688  protected void parseExampleScenarioExampleScenarioProcessComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessComponent res) throws IOException, FHIRFormatError {
10689    parseBackboneElementProperties(json, res);
10690    if (json.has("title"))
10691      res.setTitleElement(parseString(json.get("title").getAsString()));
10692    if (json.has("_title"))
10693      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
10694    if (json.has("description"))
10695      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10696    if (json.has("_description"))
10697      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10698    if (json.has("preConditions"))
10699      res.setPreConditionsElement(parseMarkdown(json.get("preConditions").getAsString()));
10700    if (json.has("_preConditions"))
10701      parseElementProperties(json.getAsJsonObject("_preConditions"), res.getPreConditionsElement());
10702    if (json.has("postConditions"))
10703      res.setPostConditionsElement(parseMarkdown(json.get("postConditions").getAsString()));
10704    if (json.has("_postConditions"))
10705      parseElementProperties(json.getAsJsonObject("_postConditions"), res.getPostConditionsElement());
10706    if (json.has("step")) {
10707      JsonArray array = json.getAsJsonArray("step");
10708      for (int i = 0; i < array.size(); i++) {
10709        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
10710      }
10711    };
10712  }
10713
10714  protected ExampleScenario.ExampleScenarioProcessStepComponent parseExampleScenarioExampleScenarioProcessStepComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
10715    ExampleScenario.ExampleScenarioProcessStepComponent res = new ExampleScenario.ExampleScenarioProcessStepComponent();
10716    parseExampleScenarioExampleScenarioProcessStepComponentProperties(json, owner, res);
10717    return res;
10718  }
10719
10720  protected void parseExampleScenarioExampleScenarioProcessStepComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepComponent res) throws IOException, FHIRFormatError {
10721    parseBackboneElementProperties(json, res);
10722    if (json.has("process")) {
10723      JsonArray array = json.getAsJsonArray("process");
10724      for (int i = 0; i < array.size(); i++) {
10725        res.getProcess().add(parseExampleScenarioExampleScenarioProcessComponent(array.get(i).getAsJsonObject(), owner));
10726      }
10727    };
10728    if (json.has("pause"))
10729      res.setPauseElement(parseBoolean(json.get("pause").getAsBoolean()));
10730    if (json.has("_pause"))
10731      parseElementProperties(json.getAsJsonObject("_pause"), res.getPauseElement());
10732    if (json.has("operation"))
10733      res.setOperation(parseExampleScenarioExampleScenarioProcessStepOperationComponent(json.getAsJsonObject("operation"), owner));
10734    if (json.has("alternative"))
10735      res.setAlternative(parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(json.getAsJsonObject("alternative"), owner));
10736  }
10737
10738  protected ExampleScenario.ExampleScenarioProcessStepOperationComponent parseExampleScenarioExampleScenarioProcessStepOperationComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
10739    ExampleScenario.ExampleScenarioProcessStepOperationComponent res = new ExampleScenario.ExampleScenarioProcessStepOperationComponent();
10740    parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(json, owner, res);
10741    return res;
10742  }
10743
10744  protected void parseExampleScenarioExampleScenarioProcessStepOperationComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepOperationComponent res) throws IOException, FHIRFormatError {
10745    parseBackboneElementProperties(json, res);
10746    if (json.has("number"))
10747      res.setNumberElement(parseString(json.get("number").getAsString()));
10748    if (json.has("_number"))
10749      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
10750    if (json.has("type"))
10751      res.setTypeElement(parseString(json.get("type").getAsString()));
10752    if (json.has("_type"))
10753      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
10754    if (json.has("name"))
10755      res.setNameElement(parseString(json.get("name").getAsString()));
10756    if (json.has("_name"))
10757      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10758    if (json.has("initiator"))
10759      res.setInitiatorElement(parseString(json.get("initiator").getAsString()));
10760    if (json.has("_initiator"))
10761      parseElementProperties(json.getAsJsonObject("_initiator"), res.getInitiatorElement());
10762    if (json.has("receiver"))
10763      res.setReceiverElement(parseString(json.get("receiver").getAsString()));
10764    if (json.has("_receiver"))
10765      parseElementProperties(json.getAsJsonObject("_receiver"), res.getReceiverElement());
10766    if (json.has("description"))
10767      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10768    if (json.has("_description"))
10769      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10770    if (json.has("initiatorActive"))
10771      res.setInitiatorActiveElement(parseBoolean(json.get("initiatorActive").getAsBoolean()));
10772    if (json.has("_initiatorActive"))
10773      parseElementProperties(json.getAsJsonObject("_initiatorActive"), res.getInitiatorActiveElement());
10774    if (json.has("receiverActive"))
10775      res.setReceiverActiveElement(parseBoolean(json.get("receiverActive").getAsBoolean()));
10776    if (json.has("_receiverActive"))
10777      parseElementProperties(json.getAsJsonObject("_receiverActive"), res.getReceiverActiveElement());
10778    if (json.has("request"))
10779      res.setRequest(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("request"), owner));
10780    if (json.has("response"))
10781      res.setResponse(parseExampleScenarioExampleScenarioInstanceContainedInstanceComponent(json.getAsJsonObject("response"), owner));
10782  }
10783
10784  protected ExampleScenario.ExampleScenarioProcessStepAlternativeComponent parseExampleScenarioExampleScenarioProcessStepAlternativeComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
10785    ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeComponent();
10786    parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(json, owner, res);
10787    return res;
10788  }
10789
10790  protected void parseExampleScenarioExampleScenarioProcessStepAlternativeComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent res) throws IOException, FHIRFormatError {
10791    parseBackboneElementProperties(json, res);
10792    if (json.has("name"))
10793      res.setNameElement(parseString(json.get("name").getAsString()));
10794    if (json.has("_name"))
10795      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
10796    if (json.has("option")) {
10797      JsonArray array = json.getAsJsonArray("option");
10798      for (int i = 0; i < array.size(); i++) {
10799        res.getOption().add(parseExampleScenarioExampleScenarioProcessStepAlternativeOptionComponent(array.get(i).getAsJsonObject(), owner));
10800      }
10801    };
10802  }
10803
10804  protected ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent parseExampleScenarioExampleScenarioProcessStepAlternativeOptionComponent(JsonObject json, ExampleScenario owner) throws IOException, FHIRFormatError {
10805    ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent res = new ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent();
10806    parseExampleScenarioExampleScenarioProcessStepAlternativeOptionComponentProperties(json, owner, res);
10807    return res;
10808  }
10809
10810  protected void parseExampleScenarioExampleScenarioProcessStepAlternativeOptionComponentProperties(JsonObject json, ExampleScenario owner, ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent res) throws IOException, FHIRFormatError {
10811    parseBackboneElementProperties(json, res);
10812    if (json.has("description"))
10813      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
10814    if (json.has("_description"))
10815      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
10816    if (json.has("step")) {
10817      JsonArray array = json.getAsJsonArray("step");
10818      for (int i = 0; i < array.size(); i++) {
10819        res.getStep().add(parseExampleScenarioExampleScenarioProcessStepComponent(array.get(i).getAsJsonObject(), owner));
10820      }
10821    };
10822    if (json.has("pause")) {
10823      JsonArray array = json.getAsJsonArray("pause");
10824      for (int i = 0; i < array.size(); i++) {
10825        res.getPause().add(parseBoolean(array.get(i).getAsBoolean()));
10826      }
10827    };
10828    if (json.has("_pause")) {
10829      JsonArray array = json.getAsJsonArray("_pause");
10830      for (int i = 0; i < array.size(); i++) {
10831        if (i == res.getPause().size())
10832          res.getPause().add(parseBoolean(null));
10833        if (array.get(i) instanceof JsonObject) 
10834          parseElementProperties(array.get(i).getAsJsonObject(), res.getPause().get(i));
10835      }
10836    };
10837  }
10838
10839  protected ExplanationOfBenefit parseExplanationOfBenefit(JsonObject json) throws IOException, FHIRFormatError {
10840    ExplanationOfBenefit res = new ExplanationOfBenefit();
10841    parseExplanationOfBenefitProperties(json, res);
10842    return res;
10843  }
10844
10845  protected void parseExplanationOfBenefitProperties(JsonObject json, ExplanationOfBenefit res) throws IOException, FHIRFormatError {
10846    parseDomainResourceProperties(json, res);
10847    if (json.has("identifier")) {
10848      JsonArray array = json.getAsJsonArray("identifier");
10849      for (int i = 0; i < array.size(); i++) {
10850        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
10851      }
10852    };
10853    if (json.has("status"))
10854      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ExplanationOfBenefit.ExplanationOfBenefitStatus.NULL, new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory()));
10855    if (json.has("_status"))
10856      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
10857    if (json.has("type"))
10858      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
10859    if (json.has("subType"))
10860      res.setSubType(parseCodeableConcept(json.getAsJsonObject("subType")));
10861    if (json.has("use"))
10862      res.setUseElement(parseEnumeration(json.get("use").getAsString(), ExplanationOfBenefit.Use.NULL, new ExplanationOfBenefit.UseEnumFactory()));
10863    if (json.has("_use"))
10864      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
10865    if (json.has("patient"))
10866      res.setPatient(parseReference(json.getAsJsonObject("patient")));
10867    if (json.has("billablePeriod"))
10868      res.setBillablePeriod(parsePeriod(json.getAsJsonObject("billablePeriod")));
10869    if (json.has("created"))
10870      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
10871    if (json.has("_created"))
10872      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
10873    if (json.has("enterer"))
10874      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
10875    if (json.has("insurer"))
10876      res.setInsurer(parseReference(json.getAsJsonObject("insurer")));
10877    if (json.has("provider"))
10878      res.setProvider(parseReference(json.getAsJsonObject("provider")));
10879    if (json.has("referral"))
10880      res.setReferral(parseReference(json.getAsJsonObject("referral")));
10881    if (json.has("facility"))
10882      res.setFacility(parseReference(json.getAsJsonObject("facility")));
10883    if (json.has("claim"))
10884      res.setClaim(parseReference(json.getAsJsonObject("claim")));
10885    if (json.has("claimResponse"))
10886      res.setClaimResponse(parseReference(json.getAsJsonObject("claimResponse")));
10887    if (json.has("outcome"))
10888      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ExplanationOfBenefit.RemittanceOutcome.NULL, new ExplanationOfBenefit.RemittanceOutcomeEnumFactory()));
10889    if (json.has("_outcome"))
10890      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
10891    if (json.has("disposition"))
10892      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
10893    if (json.has("_disposition"))
10894      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
10895    if (json.has("related")) {
10896      JsonArray array = json.getAsJsonArray("related");
10897      for (int i = 0; i < array.size(); i++) {
10898        res.getRelated().add(parseExplanationOfBenefitRelatedClaimComponent(array.get(i).getAsJsonObject(), res));
10899      }
10900    };
10901    if (json.has("prescription"))
10902      res.setPrescription(parseReference(json.getAsJsonObject("prescription")));
10903    if (json.has("originalPrescription"))
10904      res.setOriginalPrescription(parseReference(json.getAsJsonObject("originalPrescription")));
10905    if (json.has("payee"))
10906      res.setPayee(parseExplanationOfBenefitPayeeComponent(json.getAsJsonObject("payee"), res));
10907    if (json.has("information")) {
10908      JsonArray array = json.getAsJsonArray("information");
10909      for (int i = 0; i < array.size(); i++) {
10910        res.getInformation().add(parseExplanationOfBenefitSupportingInformationComponent(array.get(i).getAsJsonObject(), res));
10911      }
10912    };
10913    if (json.has("careTeam")) {
10914      JsonArray array = json.getAsJsonArray("careTeam");
10915      for (int i = 0; i < array.size(); i++) {
10916        res.getCareTeam().add(parseExplanationOfBenefitCareTeamComponent(array.get(i).getAsJsonObject(), res));
10917      }
10918    };
10919    if (json.has("diagnosis")) {
10920      JsonArray array = json.getAsJsonArray("diagnosis");
10921      for (int i = 0; i < array.size(); i++) {
10922        res.getDiagnosis().add(parseExplanationOfBenefitDiagnosisComponent(array.get(i).getAsJsonObject(), res));
10923      }
10924    };
10925    if (json.has("procedure")) {
10926      JsonArray array = json.getAsJsonArray("procedure");
10927      for (int i = 0; i < array.size(); i++) {
10928        res.getProcedure().add(parseExplanationOfBenefitProcedureComponent(array.get(i).getAsJsonObject(), res));
10929      }
10930    };
10931    if (json.has("precedence"))
10932      res.setPrecedenceElement(parsePositiveInt(json.get("precedence").getAsString()));
10933    if (json.has("_precedence"))
10934      parseElementProperties(json.getAsJsonObject("_precedence"), res.getPrecedenceElement());
10935    if (json.has("insurance")) {
10936      JsonArray array = json.getAsJsonArray("insurance");
10937      for (int i = 0; i < array.size(); i++) {
10938        res.getInsurance().add(parseExplanationOfBenefitInsuranceComponent(array.get(i).getAsJsonObject(), res));
10939      }
10940    };
10941    if (json.has("accident"))
10942      res.setAccident(parseExplanationOfBenefitAccidentComponent(json.getAsJsonObject("accident"), res));
10943    if (json.has("item")) {
10944      JsonArray array = json.getAsJsonArray("item");
10945      for (int i = 0; i < array.size(); i++) {
10946        res.getItem().add(parseExplanationOfBenefitItemComponent(array.get(i).getAsJsonObject(), res));
10947      }
10948    };
10949    if (json.has("addItem")) {
10950      JsonArray array = json.getAsJsonArray("addItem");
10951      for (int i = 0; i < array.size(); i++) {
10952        res.getAddItem().add(parseExplanationOfBenefitAddedItemComponent(array.get(i).getAsJsonObject(), res));
10953      }
10954    };
10955    if (json.has("total")) {
10956      JsonArray array = json.getAsJsonArray("total");
10957      for (int i = 0; i < array.size(); i++) {
10958        res.getTotal().add(parseExplanationOfBenefitTotalComponent(array.get(i).getAsJsonObject(), res));
10959      }
10960    };
10961    if (json.has("payment"))
10962      res.setPayment(parseExplanationOfBenefitPaymentComponent(json.getAsJsonObject("payment"), res));
10963    if (json.has("form"))
10964      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
10965    if (json.has("processNote")) {
10966      JsonArray array = json.getAsJsonArray("processNote");
10967      for (int i = 0; i < array.size(); i++) {
10968        res.getProcessNote().add(parseExplanationOfBenefitNoteComponent(array.get(i).getAsJsonObject(), res));
10969      }
10970    };
10971    if (json.has("benefitBalance")) {
10972      JsonArray array = json.getAsJsonArray("benefitBalance");
10973      for (int i = 0; i < array.size(); i++) {
10974        res.getBenefitBalance().add(parseExplanationOfBenefitBenefitBalanceComponent(array.get(i).getAsJsonObject(), res));
10975      }
10976    };
10977  }
10978
10979  protected ExplanationOfBenefit.RelatedClaimComponent parseExplanationOfBenefitRelatedClaimComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10980    ExplanationOfBenefit.RelatedClaimComponent res = new ExplanationOfBenefit.RelatedClaimComponent();
10981    parseExplanationOfBenefitRelatedClaimComponentProperties(json, owner, res);
10982    return res;
10983  }
10984
10985  protected void parseExplanationOfBenefitRelatedClaimComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.RelatedClaimComponent res) throws IOException, FHIRFormatError {
10986    parseBackboneElementProperties(json, res);
10987    if (json.has("claim"))
10988      res.setClaim(parseReference(json.getAsJsonObject("claim")));
10989    if (json.has("relationship"))
10990      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
10991    if (json.has("reference"))
10992      res.setReference(parseIdentifier(json.getAsJsonObject("reference")));
10993  }
10994
10995  protected ExplanationOfBenefit.PayeeComponent parseExplanationOfBenefitPayeeComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
10996    ExplanationOfBenefit.PayeeComponent res = new ExplanationOfBenefit.PayeeComponent();
10997    parseExplanationOfBenefitPayeeComponentProperties(json, owner, res);
10998    return res;
10999  }
11000
11001  protected void parseExplanationOfBenefitPayeeComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PayeeComponent res) throws IOException, FHIRFormatError {
11002    parseBackboneElementProperties(json, res);
11003    if (json.has("type"))
11004      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11005    if (json.has("resource"))
11006      res.setResource(parseCoding(json.getAsJsonObject("resource")));
11007    if (json.has("party"))
11008      res.setParty(parseReference(json.getAsJsonObject("party")));
11009  }
11010
11011  protected ExplanationOfBenefit.SupportingInformationComponent parseExplanationOfBenefitSupportingInformationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11012    ExplanationOfBenefit.SupportingInformationComponent res = new ExplanationOfBenefit.SupportingInformationComponent();
11013    parseExplanationOfBenefitSupportingInformationComponentProperties(json, owner, res);
11014    return res;
11015  }
11016
11017  protected void parseExplanationOfBenefitSupportingInformationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SupportingInformationComponent res) throws IOException, FHIRFormatError {
11018    parseBackboneElementProperties(json, res);
11019    if (json.has("sequence"))
11020      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11021    if (json.has("_sequence"))
11022      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11023    if (json.has("category"))
11024      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11025    if (json.has("code"))
11026      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11027    Type timing = parseType("timing", json);
11028    if (timing != null)
11029      res.setTiming(timing);
11030    Type value = parseType("value", json);
11031    if (value != null)
11032      res.setValue(value);
11033    if (json.has("reason"))
11034      res.setReason(parseCoding(json.getAsJsonObject("reason")));
11035  }
11036
11037  protected ExplanationOfBenefit.CareTeamComponent parseExplanationOfBenefitCareTeamComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11038    ExplanationOfBenefit.CareTeamComponent res = new ExplanationOfBenefit.CareTeamComponent();
11039    parseExplanationOfBenefitCareTeamComponentProperties(json, owner, res);
11040    return res;
11041  }
11042
11043  protected void parseExplanationOfBenefitCareTeamComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.CareTeamComponent res) throws IOException, FHIRFormatError {
11044    parseBackboneElementProperties(json, res);
11045    if (json.has("sequence"))
11046      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11047    if (json.has("_sequence"))
11048      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11049    if (json.has("provider"))
11050      res.setProvider(parseReference(json.getAsJsonObject("provider")));
11051    if (json.has("responsible"))
11052      res.setResponsibleElement(parseBoolean(json.get("responsible").getAsBoolean()));
11053    if (json.has("_responsible"))
11054      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
11055    if (json.has("role"))
11056      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
11057    if (json.has("qualification"))
11058      res.setQualification(parseCodeableConcept(json.getAsJsonObject("qualification")));
11059  }
11060
11061  protected ExplanationOfBenefit.DiagnosisComponent parseExplanationOfBenefitDiagnosisComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11062    ExplanationOfBenefit.DiagnosisComponent res = new ExplanationOfBenefit.DiagnosisComponent();
11063    parseExplanationOfBenefitDiagnosisComponentProperties(json, owner, res);
11064    return res;
11065  }
11066
11067  protected void parseExplanationOfBenefitDiagnosisComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DiagnosisComponent res) throws IOException, FHIRFormatError {
11068    parseBackboneElementProperties(json, res);
11069    if (json.has("sequence"))
11070      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11071    if (json.has("_sequence"))
11072      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11073    Type diagnosis = parseType("diagnosis", json);
11074    if (diagnosis != null)
11075      res.setDiagnosis(diagnosis);
11076    if (json.has("type")) {
11077      JsonArray array = json.getAsJsonArray("type");
11078      for (int i = 0; i < array.size(); i++) {
11079        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11080      }
11081    };
11082    if (json.has("onAdmission"))
11083      res.setOnAdmission(parseCodeableConcept(json.getAsJsonObject("onAdmission")));
11084    if (json.has("packageCode"))
11085      res.setPackageCode(parseCodeableConcept(json.getAsJsonObject("packageCode")));
11086  }
11087
11088  protected ExplanationOfBenefit.ProcedureComponent parseExplanationOfBenefitProcedureComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11089    ExplanationOfBenefit.ProcedureComponent res = new ExplanationOfBenefit.ProcedureComponent();
11090    parseExplanationOfBenefitProcedureComponentProperties(json, owner, res);
11091    return res;
11092  }
11093
11094  protected void parseExplanationOfBenefitProcedureComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ProcedureComponent res) throws IOException, FHIRFormatError {
11095    parseBackboneElementProperties(json, res);
11096    if (json.has("sequence"))
11097      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11098    if (json.has("_sequence"))
11099      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11100    if (json.has("date"))
11101      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11102    if (json.has("_date"))
11103      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11104    Type procedure = parseType("procedure", json);
11105    if (procedure != null)
11106      res.setProcedure(procedure);
11107  }
11108
11109  protected ExplanationOfBenefit.InsuranceComponent parseExplanationOfBenefitInsuranceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11110    ExplanationOfBenefit.InsuranceComponent res = new ExplanationOfBenefit.InsuranceComponent();
11111    parseExplanationOfBenefitInsuranceComponentProperties(json, owner, res);
11112    return res;
11113  }
11114
11115  protected void parseExplanationOfBenefitInsuranceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.InsuranceComponent res) throws IOException, FHIRFormatError {
11116    parseBackboneElementProperties(json, res);
11117    if (json.has("focal"))
11118      res.setFocalElement(parseBoolean(json.get("focal").getAsBoolean()));
11119    if (json.has("_focal"))
11120      parseElementProperties(json.getAsJsonObject("_focal"), res.getFocalElement());
11121    if (json.has("coverage"))
11122      res.setCoverage(parseReference(json.getAsJsonObject("coverage")));
11123  }
11124
11125  protected ExplanationOfBenefit.AccidentComponent parseExplanationOfBenefitAccidentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11126    ExplanationOfBenefit.AccidentComponent res = new ExplanationOfBenefit.AccidentComponent();
11127    parseExplanationOfBenefitAccidentComponentProperties(json, owner, res);
11128    return res;
11129  }
11130
11131  protected void parseExplanationOfBenefitAccidentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AccidentComponent res) throws IOException, FHIRFormatError {
11132    parseBackboneElementProperties(json, res);
11133    if (json.has("date"))
11134      res.setDateElement(parseDate(json.get("date").getAsString()));
11135    if (json.has("_date"))
11136      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11137    if (json.has("type"))
11138      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11139    Type location = parseType("location", json);
11140    if (location != null)
11141      res.setLocation(location);
11142  }
11143
11144  protected ExplanationOfBenefit.ItemComponent parseExplanationOfBenefitItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11145    ExplanationOfBenefit.ItemComponent res = new ExplanationOfBenefit.ItemComponent();
11146    parseExplanationOfBenefitItemComponentProperties(json, owner, res);
11147    return res;
11148  }
11149
11150  protected void parseExplanationOfBenefitItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.ItemComponent res) throws IOException, FHIRFormatError {
11151    parseBackboneElementProperties(json, res);
11152    if (json.has("sequence"))
11153      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11154    if (json.has("_sequence"))
11155      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11156    if (json.has("careTeamSequence")) {
11157      JsonArray array = json.getAsJsonArray("careTeamSequence");
11158      for (int i = 0; i < array.size(); i++) {
11159        res.getCareTeamSequence().add(parsePositiveInt(array.get(i).getAsString()));
11160      }
11161    };
11162    if (json.has("_careTeamSequence")) {
11163      JsonArray array = json.getAsJsonArray("_careTeamSequence");
11164      for (int i = 0; i < array.size(); i++) {
11165        if (i == res.getCareTeamSequence().size())
11166          res.getCareTeamSequence().add(parsePositiveInt(null));
11167        if (array.get(i) instanceof JsonObject) 
11168          parseElementProperties(array.get(i).getAsJsonObject(), res.getCareTeamSequence().get(i));
11169      }
11170    };
11171    if (json.has("diagnosisSequence")) {
11172      JsonArray array = json.getAsJsonArray("diagnosisSequence");
11173      for (int i = 0; i < array.size(); i++) {
11174        res.getDiagnosisSequence().add(parsePositiveInt(array.get(i).getAsString()));
11175      }
11176    };
11177    if (json.has("_diagnosisSequence")) {
11178      JsonArray array = json.getAsJsonArray("_diagnosisSequence");
11179      for (int i = 0; i < array.size(); i++) {
11180        if (i == res.getDiagnosisSequence().size())
11181          res.getDiagnosisSequence().add(parsePositiveInt(null));
11182        if (array.get(i) instanceof JsonObject) 
11183          parseElementProperties(array.get(i).getAsJsonObject(), res.getDiagnosisSequence().get(i));
11184      }
11185    };
11186    if (json.has("procedureSequence")) {
11187      JsonArray array = json.getAsJsonArray("procedureSequence");
11188      for (int i = 0; i < array.size(); i++) {
11189        res.getProcedureSequence().add(parsePositiveInt(array.get(i).getAsString()));
11190      }
11191    };
11192    if (json.has("_procedureSequence")) {
11193      JsonArray array = json.getAsJsonArray("_procedureSequence");
11194      for (int i = 0; i < array.size(); i++) {
11195        if (i == res.getProcedureSequence().size())
11196          res.getProcedureSequence().add(parsePositiveInt(null));
11197        if (array.get(i) instanceof JsonObject) 
11198          parseElementProperties(array.get(i).getAsJsonObject(), res.getProcedureSequence().get(i));
11199      }
11200    };
11201    if (json.has("informationSequence")) {
11202      JsonArray array = json.getAsJsonArray("informationSequence");
11203      for (int i = 0; i < array.size(); i++) {
11204        res.getInformationSequence().add(parsePositiveInt(array.get(i).getAsString()));
11205      }
11206    };
11207    if (json.has("_informationSequence")) {
11208      JsonArray array = json.getAsJsonArray("_informationSequence");
11209      for (int i = 0; i < array.size(); i++) {
11210        if (i == res.getInformationSequence().size())
11211          res.getInformationSequence().add(parsePositiveInt(null));
11212        if (array.get(i) instanceof JsonObject) 
11213          parseElementProperties(array.get(i).getAsJsonObject(), res.getInformationSequence().get(i));
11214      }
11215    };
11216    if (json.has("revenue"))
11217      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
11218    if (json.has("category"))
11219      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11220    if (json.has("billcode"))
11221      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
11222    if (json.has("modifier")) {
11223      JsonArray array = json.getAsJsonArray("modifier");
11224      for (int i = 0; i < array.size(); i++) {
11225        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11226      }
11227    };
11228    if (json.has("programCode")) {
11229      JsonArray array = json.getAsJsonArray("programCode");
11230      for (int i = 0; i < array.size(); i++) {
11231        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11232      }
11233    };
11234    Type serviced = parseType("serviced", json);
11235    if (serviced != null)
11236      res.setServiced(serviced);
11237    Type location = parseType("location", json);
11238    if (location != null)
11239      res.setLocation(location);
11240    if (json.has("quantity"))
11241      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
11242    if (json.has("unitPrice"))
11243      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
11244    if (json.has("factor"))
11245      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
11246    if (json.has("_factor"))
11247      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
11248    if (json.has("net"))
11249      res.setNet(parseMoney(json.getAsJsonObject("net")));
11250    if (json.has("udi")) {
11251      JsonArray array = json.getAsJsonArray("udi");
11252      for (int i = 0; i < array.size(); i++) {
11253        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
11254      }
11255    };
11256    if (json.has("bodySite"))
11257      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
11258    if (json.has("subSite")) {
11259      JsonArray array = json.getAsJsonArray("subSite");
11260      for (int i = 0; i < array.size(); i++) {
11261        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11262      }
11263    };
11264    if (json.has("encounter")) {
11265      JsonArray array = json.getAsJsonArray("encounter");
11266      for (int i = 0; i < array.size(); i++) {
11267        res.getEncounter().add(parseReference(array.get(i).getAsJsonObject()));
11268      }
11269    };
11270    if (json.has("noteNumber")) {
11271      JsonArray array = json.getAsJsonArray("noteNumber");
11272      for (int i = 0; i < array.size(); i++) {
11273        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
11274      }
11275    };
11276    if (json.has("_noteNumber")) {
11277      JsonArray array = json.getAsJsonArray("_noteNumber");
11278      for (int i = 0; i < array.size(); i++) {
11279        if (i == res.getNoteNumber().size())
11280          res.getNoteNumber().add(parsePositiveInt(null));
11281        if (array.get(i) instanceof JsonObject) 
11282          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
11283      }
11284    };
11285    if (json.has("adjudication")) {
11286      JsonArray array = json.getAsJsonArray("adjudication");
11287      for (int i = 0; i < array.size(); i++) {
11288        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
11289      }
11290    };
11291    if (json.has("detail")) {
11292      JsonArray array = json.getAsJsonArray("detail");
11293      for (int i = 0; i < array.size(); i++) {
11294        res.getDetail().add(parseExplanationOfBenefitDetailComponent(array.get(i).getAsJsonObject(), owner));
11295      }
11296    };
11297  }
11298
11299  protected ExplanationOfBenefit.AdjudicationComponent parseExplanationOfBenefitAdjudicationComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11300    ExplanationOfBenefit.AdjudicationComponent res = new ExplanationOfBenefit.AdjudicationComponent();
11301    parseExplanationOfBenefitAdjudicationComponentProperties(json, owner, res);
11302    return res;
11303  }
11304
11305  protected void parseExplanationOfBenefitAdjudicationComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AdjudicationComponent res) throws IOException, FHIRFormatError {
11306    parseBackboneElementProperties(json, res);
11307    if (json.has("category"))
11308      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11309    if (json.has("reason"))
11310      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
11311    if (json.has("amount"))
11312      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
11313    if (json.has("value"))
11314      res.setValueElement(parseDecimal(json.get("value").getAsBigDecimal()));
11315    if (json.has("_value"))
11316      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
11317  }
11318
11319  protected ExplanationOfBenefit.DetailComponent parseExplanationOfBenefitDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11320    ExplanationOfBenefit.DetailComponent res = new ExplanationOfBenefit.DetailComponent();
11321    parseExplanationOfBenefitDetailComponentProperties(json, owner, res);
11322    return res;
11323  }
11324
11325  protected void parseExplanationOfBenefitDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.DetailComponent res) throws IOException, FHIRFormatError {
11326    parseBackboneElementProperties(json, res);
11327    if (json.has("sequence"))
11328      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11329    if (json.has("_sequence"))
11330      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11331    if (json.has("revenue"))
11332      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
11333    if (json.has("category"))
11334      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11335    if (json.has("billcode"))
11336      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
11337    if (json.has("modifier")) {
11338      JsonArray array = json.getAsJsonArray("modifier");
11339      for (int i = 0; i < array.size(); i++) {
11340        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11341      }
11342    };
11343    if (json.has("programCode")) {
11344      JsonArray array = json.getAsJsonArray("programCode");
11345      for (int i = 0; i < array.size(); i++) {
11346        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11347      }
11348    };
11349    if (json.has("quantity"))
11350      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
11351    if (json.has("unitPrice"))
11352      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
11353    if (json.has("factor"))
11354      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
11355    if (json.has("_factor"))
11356      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
11357    if (json.has("net"))
11358      res.setNet(parseMoney(json.getAsJsonObject("net")));
11359    if (json.has("udi")) {
11360      JsonArray array = json.getAsJsonArray("udi");
11361      for (int i = 0; i < array.size(); i++) {
11362        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
11363      }
11364    };
11365    if (json.has("noteNumber")) {
11366      JsonArray array = json.getAsJsonArray("noteNumber");
11367      for (int i = 0; i < array.size(); i++) {
11368        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
11369      }
11370    };
11371    if (json.has("_noteNumber")) {
11372      JsonArray array = json.getAsJsonArray("_noteNumber");
11373      for (int i = 0; i < array.size(); i++) {
11374        if (i == res.getNoteNumber().size())
11375          res.getNoteNumber().add(parsePositiveInt(null));
11376        if (array.get(i) instanceof JsonObject) 
11377          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
11378      }
11379    };
11380    if (json.has("adjudication")) {
11381      JsonArray array = json.getAsJsonArray("adjudication");
11382      for (int i = 0; i < array.size(); i++) {
11383        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
11384      }
11385    };
11386    if (json.has("subDetail")) {
11387      JsonArray array = json.getAsJsonArray("subDetail");
11388      for (int i = 0; i < array.size(); i++) {
11389        res.getSubDetail().add(parseExplanationOfBenefitSubDetailComponent(array.get(i).getAsJsonObject(), owner));
11390      }
11391    };
11392  }
11393
11394  protected ExplanationOfBenefit.SubDetailComponent parseExplanationOfBenefitSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11395    ExplanationOfBenefit.SubDetailComponent res = new ExplanationOfBenefit.SubDetailComponent();
11396    parseExplanationOfBenefitSubDetailComponentProperties(json, owner, res);
11397    return res;
11398  }
11399
11400  protected void parseExplanationOfBenefitSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.SubDetailComponent res) throws IOException, FHIRFormatError {
11401    parseBackboneElementProperties(json, res);
11402    if (json.has("sequence"))
11403      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
11404    if (json.has("_sequence"))
11405      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
11406    if (json.has("revenue"))
11407      res.setRevenue(parseCodeableConcept(json.getAsJsonObject("revenue")));
11408    if (json.has("category"))
11409      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11410    if (json.has("billcode"))
11411      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
11412    if (json.has("modifier")) {
11413      JsonArray array = json.getAsJsonArray("modifier");
11414      for (int i = 0; i < array.size(); i++) {
11415        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11416      }
11417    };
11418    if (json.has("programCode")) {
11419      JsonArray array = json.getAsJsonArray("programCode");
11420      for (int i = 0; i < array.size(); i++) {
11421        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11422      }
11423    };
11424    if (json.has("quantity"))
11425      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
11426    if (json.has("unitPrice"))
11427      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
11428    if (json.has("factor"))
11429      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
11430    if (json.has("_factor"))
11431      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
11432    if (json.has("net"))
11433      res.setNet(parseMoney(json.getAsJsonObject("net")));
11434    if (json.has("udi")) {
11435      JsonArray array = json.getAsJsonArray("udi");
11436      for (int i = 0; i < array.size(); i++) {
11437        res.getUdi().add(parseReference(array.get(i).getAsJsonObject()));
11438      }
11439    };
11440    if (json.has("noteNumber")) {
11441      JsonArray array = json.getAsJsonArray("noteNumber");
11442      for (int i = 0; i < array.size(); i++) {
11443        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
11444      }
11445    };
11446    if (json.has("_noteNumber")) {
11447      JsonArray array = json.getAsJsonArray("_noteNumber");
11448      for (int i = 0; i < array.size(); i++) {
11449        if (i == res.getNoteNumber().size())
11450          res.getNoteNumber().add(parsePositiveInt(null));
11451        if (array.get(i) instanceof JsonObject) 
11452          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
11453      }
11454    };
11455    if (json.has("adjudication")) {
11456      JsonArray array = json.getAsJsonArray("adjudication");
11457      for (int i = 0; i < array.size(); i++) {
11458        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
11459      }
11460    };
11461  }
11462
11463  protected ExplanationOfBenefit.AddedItemComponent parseExplanationOfBenefitAddedItemComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11464    ExplanationOfBenefit.AddedItemComponent res = new ExplanationOfBenefit.AddedItemComponent();
11465    parseExplanationOfBenefitAddedItemComponentProperties(json, owner, res);
11466    return res;
11467  }
11468
11469  protected void parseExplanationOfBenefitAddedItemComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemComponent res) throws IOException, FHIRFormatError {
11470    parseBackboneElementProperties(json, res);
11471    if (json.has("itemSequence")) {
11472      JsonArray array = json.getAsJsonArray("itemSequence");
11473      for (int i = 0; i < array.size(); i++) {
11474        res.getItemSequence().add(parsePositiveInt(array.get(i).getAsString()));
11475      }
11476    };
11477    if (json.has("_itemSequence")) {
11478      JsonArray array = json.getAsJsonArray("_itemSequence");
11479      for (int i = 0; i < array.size(); i++) {
11480        if (i == res.getItemSequence().size())
11481          res.getItemSequence().add(parsePositiveInt(null));
11482        if (array.get(i) instanceof JsonObject) 
11483          parseElementProperties(array.get(i).getAsJsonObject(), res.getItemSequence().get(i));
11484      }
11485    };
11486    if (json.has("detailSequence")) {
11487      JsonArray array = json.getAsJsonArray("detailSequence");
11488      for (int i = 0; i < array.size(); i++) {
11489        res.getDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
11490      }
11491    };
11492    if (json.has("_detailSequence")) {
11493      JsonArray array = json.getAsJsonArray("_detailSequence");
11494      for (int i = 0; i < array.size(); i++) {
11495        if (i == res.getDetailSequence().size())
11496          res.getDetailSequence().add(parsePositiveInt(null));
11497        if (array.get(i) instanceof JsonObject) 
11498          parseElementProperties(array.get(i).getAsJsonObject(), res.getDetailSequence().get(i));
11499      }
11500    };
11501    if (json.has("subDetailSequence")) {
11502      JsonArray array = json.getAsJsonArray("subDetailSequence");
11503      for (int i = 0; i < array.size(); i++) {
11504        res.getSubDetailSequence().add(parsePositiveInt(array.get(i).getAsString()));
11505      }
11506    };
11507    if (json.has("_subDetailSequence")) {
11508      JsonArray array = json.getAsJsonArray("_subDetailSequence");
11509      for (int i = 0; i < array.size(); i++) {
11510        if (i == res.getSubDetailSequence().size())
11511          res.getSubDetailSequence().add(parsePositiveInt(null));
11512        if (array.get(i) instanceof JsonObject) 
11513          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubDetailSequence().get(i));
11514      }
11515    };
11516    if (json.has("provider")) {
11517      JsonArray array = json.getAsJsonArray("provider");
11518      for (int i = 0; i < array.size(); i++) {
11519        res.getProvider().add(parseReference(array.get(i).getAsJsonObject()));
11520      }
11521    };
11522    if (json.has("billcode"))
11523      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
11524    if (json.has("modifier")) {
11525      JsonArray array = json.getAsJsonArray("modifier");
11526      for (int i = 0; i < array.size(); i++) {
11527        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11528      }
11529    };
11530    if (json.has("programCode")) {
11531      JsonArray array = json.getAsJsonArray("programCode");
11532      for (int i = 0; i < array.size(); i++) {
11533        res.getProgramCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11534      }
11535    };
11536    Type serviced = parseType("serviced", json);
11537    if (serviced != null)
11538      res.setServiced(serviced);
11539    Type location = parseType("location", json);
11540    if (location != null)
11541      res.setLocation(location);
11542    if (json.has("quantity"))
11543      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
11544    if (json.has("unitPrice"))
11545      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
11546    if (json.has("factor"))
11547      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
11548    if (json.has("_factor"))
11549      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
11550    if (json.has("net"))
11551      res.setNet(parseMoney(json.getAsJsonObject("net")));
11552    if (json.has("bodySite"))
11553      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
11554    if (json.has("subSite")) {
11555      JsonArray array = json.getAsJsonArray("subSite");
11556      for (int i = 0; i < array.size(); i++) {
11557        res.getSubSite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11558      }
11559    };
11560    if (json.has("noteNumber")) {
11561      JsonArray array = json.getAsJsonArray("noteNumber");
11562      for (int i = 0; i < array.size(); i++) {
11563        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
11564      }
11565    };
11566    if (json.has("_noteNumber")) {
11567      JsonArray array = json.getAsJsonArray("_noteNumber");
11568      for (int i = 0; i < array.size(); i++) {
11569        if (i == res.getNoteNumber().size())
11570          res.getNoteNumber().add(parsePositiveInt(null));
11571        if (array.get(i) instanceof JsonObject) 
11572          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
11573      }
11574    };
11575    if (json.has("adjudication")) {
11576      JsonArray array = json.getAsJsonArray("adjudication");
11577      for (int i = 0; i < array.size(); i++) {
11578        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
11579      }
11580    };
11581    if (json.has("detail")) {
11582      JsonArray array = json.getAsJsonArray("detail");
11583      for (int i = 0; i < array.size(); i++) {
11584        res.getDetail().add(parseExplanationOfBenefitAddedItemDetailComponent(array.get(i).getAsJsonObject(), owner));
11585      }
11586    };
11587  }
11588
11589  protected ExplanationOfBenefit.AddedItemDetailComponent parseExplanationOfBenefitAddedItemDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11590    ExplanationOfBenefit.AddedItemDetailComponent res = new ExplanationOfBenefit.AddedItemDetailComponent();
11591    parseExplanationOfBenefitAddedItemDetailComponentProperties(json, owner, res);
11592    return res;
11593  }
11594
11595  protected void parseExplanationOfBenefitAddedItemDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailComponent res) throws IOException, FHIRFormatError {
11596    parseBackboneElementProperties(json, res);
11597    if (json.has("billcode"))
11598      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
11599    if (json.has("modifier")) {
11600      JsonArray array = json.getAsJsonArray("modifier");
11601      for (int i = 0; i < array.size(); i++) {
11602        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11603      }
11604    };
11605    if (json.has("quantity"))
11606      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
11607    if (json.has("unitPrice"))
11608      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
11609    if (json.has("factor"))
11610      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
11611    if (json.has("_factor"))
11612      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
11613    if (json.has("net"))
11614      res.setNet(parseMoney(json.getAsJsonObject("net")));
11615    if (json.has("noteNumber")) {
11616      JsonArray array = json.getAsJsonArray("noteNumber");
11617      for (int i = 0; i < array.size(); i++) {
11618        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
11619      }
11620    };
11621    if (json.has("_noteNumber")) {
11622      JsonArray array = json.getAsJsonArray("_noteNumber");
11623      for (int i = 0; i < array.size(); i++) {
11624        if (i == res.getNoteNumber().size())
11625          res.getNoteNumber().add(parsePositiveInt(null));
11626        if (array.get(i) instanceof JsonObject) 
11627          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
11628      }
11629    };
11630    if (json.has("adjudication")) {
11631      JsonArray array = json.getAsJsonArray("adjudication");
11632      for (int i = 0; i < array.size(); i++) {
11633        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
11634      }
11635    };
11636    if (json.has("subDetail")) {
11637      JsonArray array = json.getAsJsonArray("subDetail");
11638      for (int i = 0; i < array.size(); i++) {
11639        res.getSubDetail().add(parseExplanationOfBenefitAddedItemDetailSubDetailComponent(array.get(i).getAsJsonObject(), owner));
11640      }
11641    };
11642  }
11643
11644  protected ExplanationOfBenefit.AddedItemDetailSubDetailComponent parseExplanationOfBenefitAddedItemDetailSubDetailComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11645    ExplanationOfBenefit.AddedItemDetailSubDetailComponent res = new ExplanationOfBenefit.AddedItemDetailSubDetailComponent();
11646    parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(json, owner, res);
11647    return res;
11648  }
11649
11650  protected void parseExplanationOfBenefitAddedItemDetailSubDetailComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.AddedItemDetailSubDetailComponent res) throws IOException, FHIRFormatError {
11651    parseBackboneElementProperties(json, res);
11652    if (json.has("billcode"))
11653      res.setBillcode(parseCodeableConcept(json.getAsJsonObject("billcode")));
11654    if (json.has("modifier")) {
11655      JsonArray array = json.getAsJsonArray("modifier");
11656      for (int i = 0; i < array.size(); i++) {
11657        res.getModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11658      }
11659    };
11660    if (json.has("quantity"))
11661      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
11662    if (json.has("unitPrice"))
11663      res.setUnitPrice(parseMoney(json.getAsJsonObject("unitPrice")));
11664    if (json.has("factor"))
11665      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
11666    if (json.has("_factor"))
11667      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
11668    if (json.has("net"))
11669      res.setNet(parseMoney(json.getAsJsonObject("net")));
11670    if (json.has("noteNumber")) {
11671      JsonArray array = json.getAsJsonArray("noteNumber");
11672      for (int i = 0; i < array.size(); i++) {
11673        res.getNoteNumber().add(parsePositiveInt(array.get(i).getAsString()));
11674      }
11675    };
11676    if (json.has("_noteNumber")) {
11677      JsonArray array = json.getAsJsonArray("_noteNumber");
11678      for (int i = 0; i < array.size(); i++) {
11679        if (i == res.getNoteNumber().size())
11680          res.getNoteNumber().add(parsePositiveInt(null));
11681        if (array.get(i) instanceof JsonObject) 
11682          parseElementProperties(array.get(i).getAsJsonObject(), res.getNoteNumber().get(i));
11683      }
11684    };
11685    if (json.has("adjudication")) {
11686      JsonArray array = json.getAsJsonArray("adjudication");
11687      for (int i = 0; i < array.size(); i++) {
11688        res.getAdjudication().add(parseExplanationOfBenefitAdjudicationComponent(array.get(i).getAsJsonObject(), owner));
11689      }
11690    };
11691  }
11692
11693  protected ExplanationOfBenefit.TotalComponent parseExplanationOfBenefitTotalComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11694    ExplanationOfBenefit.TotalComponent res = new ExplanationOfBenefit.TotalComponent();
11695    parseExplanationOfBenefitTotalComponentProperties(json, owner, res);
11696    return res;
11697  }
11698
11699  protected void parseExplanationOfBenefitTotalComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.TotalComponent res) throws IOException, FHIRFormatError {
11700    parseBackboneElementProperties(json, res);
11701    if (json.has("category"))
11702      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11703    if (json.has("amount"))
11704      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
11705  }
11706
11707  protected ExplanationOfBenefit.PaymentComponent parseExplanationOfBenefitPaymentComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11708    ExplanationOfBenefit.PaymentComponent res = new ExplanationOfBenefit.PaymentComponent();
11709    parseExplanationOfBenefitPaymentComponentProperties(json, owner, res);
11710    return res;
11711  }
11712
11713  protected void parseExplanationOfBenefitPaymentComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.PaymentComponent res) throws IOException, FHIRFormatError {
11714    parseBackboneElementProperties(json, res);
11715    if (json.has("type"))
11716      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11717    if (json.has("adjustment"))
11718      res.setAdjustment(parseMoney(json.getAsJsonObject("adjustment")));
11719    if (json.has("adjustmentReason"))
11720      res.setAdjustmentReason(parseCodeableConcept(json.getAsJsonObject("adjustmentReason")));
11721    if (json.has("date"))
11722      res.setDateElement(parseDate(json.get("date").getAsString()));
11723    if (json.has("_date"))
11724      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11725    if (json.has("amount"))
11726      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
11727    if (json.has("identifier"))
11728      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
11729  }
11730
11731  protected ExplanationOfBenefit.NoteComponent parseExplanationOfBenefitNoteComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11732    ExplanationOfBenefit.NoteComponent res = new ExplanationOfBenefit.NoteComponent();
11733    parseExplanationOfBenefitNoteComponentProperties(json, owner, res);
11734    return res;
11735  }
11736
11737  protected void parseExplanationOfBenefitNoteComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.NoteComponent res) throws IOException, FHIRFormatError {
11738    parseBackboneElementProperties(json, res);
11739    if (json.has("number"))
11740      res.setNumberElement(parsePositiveInt(json.get("number").getAsString()));
11741    if (json.has("_number"))
11742      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
11743    if (json.has("type"))
11744      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
11745    if (json.has("_type"))
11746      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
11747    if (json.has("text"))
11748      res.setTextElement(parseString(json.get("text").getAsString()));
11749    if (json.has("_text"))
11750      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
11751    if (json.has("language"))
11752      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
11753  }
11754
11755  protected ExplanationOfBenefit.BenefitBalanceComponent parseExplanationOfBenefitBenefitBalanceComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11756    ExplanationOfBenefit.BenefitBalanceComponent res = new ExplanationOfBenefit.BenefitBalanceComponent();
11757    parseExplanationOfBenefitBenefitBalanceComponentProperties(json, owner, res);
11758    return res;
11759  }
11760
11761  protected void parseExplanationOfBenefitBenefitBalanceComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitBalanceComponent res) throws IOException, FHIRFormatError {
11762    parseBackboneElementProperties(json, res);
11763    if (json.has("category"))
11764      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
11765    if (json.has("excluded"))
11766      res.setExcludedElement(parseBoolean(json.get("excluded").getAsBoolean()));
11767    if (json.has("_excluded"))
11768      parseElementProperties(json.getAsJsonObject("_excluded"), res.getExcludedElement());
11769    if (json.has("name"))
11770      res.setNameElement(parseString(json.get("name").getAsString()));
11771    if (json.has("_name"))
11772      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11773    if (json.has("description"))
11774      res.setDescriptionElement(parseString(json.get("description").getAsString()));
11775    if (json.has("_description"))
11776      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
11777    if (json.has("network"))
11778      res.setNetwork(parseCodeableConcept(json.getAsJsonObject("network")));
11779    if (json.has("unit"))
11780      res.setUnit(parseCodeableConcept(json.getAsJsonObject("unit")));
11781    if (json.has("term"))
11782      res.setTerm(parseCodeableConcept(json.getAsJsonObject("term")));
11783    if (json.has("financial")) {
11784      JsonArray array = json.getAsJsonArray("financial");
11785      for (int i = 0; i < array.size(); i++) {
11786        res.getFinancial().add(parseExplanationOfBenefitBenefitComponent(array.get(i).getAsJsonObject(), owner));
11787      }
11788    };
11789  }
11790
11791  protected ExplanationOfBenefit.BenefitComponent parseExplanationOfBenefitBenefitComponent(JsonObject json, ExplanationOfBenefit owner) throws IOException, FHIRFormatError {
11792    ExplanationOfBenefit.BenefitComponent res = new ExplanationOfBenefit.BenefitComponent();
11793    parseExplanationOfBenefitBenefitComponentProperties(json, owner, res);
11794    return res;
11795  }
11796
11797  protected void parseExplanationOfBenefitBenefitComponentProperties(JsonObject json, ExplanationOfBenefit owner, ExplanationOfBenefit.BenefitComponent res) throws IOException, FHIRFormatError {
11798    parseBackboneElementProperties(json, res);
11799    if (json.has("type"))
11800      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
11801    Type allowed = parseType("allowed", json);
11802    if (allowed != null)
11803      res.setAllowed(allowed);
11804    Type used = parseType("used", json);
11805    if (used != null)
11806      res.setUsed(used);
11807  }
11808
11809  protected FamilyMemberHistory parseFamilyMemberHistory(JsonObject json) throws IOException, FHIRFormatError {
11810    FamilyMemberHistory res = new FamilyMemberHistory();
11811    parseFamilyMemberHistoryProperties(json, res);
11812    return res;
11813  }
11814
11815  protected void parseFamilyMemberHistoryProperties(JsonObject json, FamilyMemberHistory res) throws IOException, FHIRFormatError {
11816    parseDomainResourceProperties(json, res);
11817    if (json.has("identifier")) {
11818      JsonArray array = json.getAsJsonArray("identifier");
11819      for (int i = 0; i < array.size(); i++) {
11820        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11821      }
11822    };
11823    if (json.has("instantiatesCanonical")) {
11824      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
11825      for (int i = 0; i < array.size(); i++) {
11826        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
11827      }
11828    };
11829    if (json.has("_instantiatesCanonical")) {
11830      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
11831      for (int i = 0; i < array.size(); i++) {
11832        if (i == res.getInstantiatesCanonical().size())
11833          res.getInstantiatesCanonical().add(parseCanonical(null));
11834        if (array.get(i) instanceof JsonObject) 
11835          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
11836      }
11837    };
11838    if (json.has("instantiatesUri")) {
11839      JsonArray array = json.getAsJsonArray("instantiatesUri");
11840      for (int i = 0; i < array.size(); i++) {
11841        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
11842      }
11843    };
11844    if (json.has("_instantiatesUri")) {
11845      JsonArray array = json.getAsJsonArray("_instantiatesUri");
11846      for (int i = 0; i < array.size(); i++) {
11847        if (i == res.getInstantiatesUri().size())
11848          res.getInstantiatesUri().add(parseUri(null));
11849        if (array.get(i) instanceof JsonObject) 
11850          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
11851      }
11852    };
11853    if (json.has("status"))
11854      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), FamilyMemberHistory.FamilyHistoryStatus.NULL, new FamilyMemberHistory.FamilyHistoryStatusEnumFactory()));
11855    if (json.has("_status"))
11856      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11857    if (json.has("dataAbsentReason"))
11858      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
11859    if (json.has("patient"))
11860      res.setPatient(parseReference(json.getAsJsonObject("patient")));
11861    if (json.has("date"))
11862      res.setDateElement(parseDateTime(json.get("date").getAsString()));
11863    if (json.has("_date"))
11864      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
11865    if (json.has("name"))
11866      res.setNameElement(parseString(json.get("name").getAsString()));
11867    if (json.has("_name"))
11868      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
11869    if (json.has("relationship"))
11870      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
11871    if (json.has("gender"))
11872      res.setGender(parseCodeableConcept(json.getAsJsonObject("gender")));
11873    Type born = parseType("born", json);
11874    if (born != null)
11875      res.setBorn(born);
11876    Type age = parseType("age", json);
11877    if (age != null)
11878      res.setAge(age);
11879    if (json.has("estimatedAge"))
11880      res.setEstimatedAgeElement(parseBoolean(json.get("estimatedAge").getAsBoolean()));
11881    if (json.has("_estimatedAge"))
11882      parseElementProperties(json.getAsJsonObject("_estimatedAge"), res.getEstimatedAgeElement());
11883    Type deceased = parseType("deceased", json);
11884    if (deceased != null)
11885      res.setDeceased(deceased);
11886    if (json.has("reasonCode")) {
11887      JsonArray array = json.getAsJsonArray("reasonCode");
11888      for (int i = 0; i < array.size(); i++) {
11889        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11890      }
11891    };
11892    if (json.has("reasonReference")) {
11893      JsonArray array = json.getAsJsonArray("reasonReference");
11894      for (int i = 0; i < array.size(); i++) {
11895        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
11896      }
11897    };
11898    if (json.has("note")) {
11899      JsonArray array = json.getAsJsonArray("note");
11900      for (int i = 0; i < array.size(); i++) {
11901        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11902      }
11903    };
11904    if (json.has("condition")) {
11905      JsonArray array = json.getAsJsonArray("condition");
11906      for (int i = 0; i < array.size(); i++) {
11907        res.getCondition().add(parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(array.get(i).getAsJsonObject(), res));
11908      }
11909    };
11910  }
11911
11912  protected FamilyMemberHistory.FamilyMemberHistoryConditionComponent parseFamilyMemberHistoryFamilyMemberHistoryConditionComponent(JsonObject json, FamilyMemberHistory owner) throws IOException, FHIRFormatError {
11913    FamilyMemberHistory.FamilyMemberHistoryConditionComponent res = new FamilyMemberHistory.FamilyMemberHistoryConditionComponent();
11914    parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(json, owner, res);
11915    return res;
11916  }
11917
11918  protected void parseFamilyMemberHistoryFamilyMemberHistoryConditionComponentProperties(JsonObject json, FamilyMemberHistory owner, FamilyMemberHistory.FamilyMemberHistoryConditionComponent res) throws IOException, FHIRFormatError {
11919    parseBackboneElementProperties(json, res);
11920    if (json.has("code"))
11921      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11922    if (json.has("outcome"))
11923      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
11924    Type onset = parseType("onset", json);
11925    if (onset != null)
11926      res.setOnset(onset);
11927    if (json.has("note")) {
11928      JsonArray array = json.getAsJsonArray("note");
11929      for (int i = 0; i < array.size(); i++) {
11930        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
11931      }
11932    };
11933  }
11934
11935  protected Flag parseFlag(JsonObject json) throws IOException, FHIRFormatError {
11936    Flag res = new Flag();
11937    parseFlagProperties(json, res);
11938    return res;
11939  }
11940
11941  protected void parseFlagProperties(JsonObject json, Flag res) throws IOException, FHIRFormatError {
11942    parseDomainResourceProperties(json, res);
11943    if (json.has("identifier")) {
11944      JsonArray array = json.getAsJsonArray("identifier");
11945      for (int i = 0; i < array.size(); i++) {
11946        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11947      }
11948    };
11949    if (json.has("status"))
11950      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Flag.FlagStatus.NULL, new Flag.FlagStatusEnumFactory()));
11951    if (json.has("_status"))
11952      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11953    if (json.has("category")) {
11954      JsonArray array = json.getAsJsonArray("category");
11955      for (int i = 0; i < array.size(); i++) {
11956        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11957      }
11958    };
11959    if (json.has("code"))
11960      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
11961    if (json.has("subject"))
11962      res.setSubject(parseReference(json.getAsJsonObject("subject")));
11963    if (json.has("period"))
11964      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
11965    if (json.has("encounter"))
11966      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
11967    if (json.has("author"))
11968      res.setAuthor(parseReference(json.getAsJsonObject("author")));
11969  }
11970
11971  protected Goal parseGoal(JsonObject json) throws IOException, FHIRFormatError {
11972    Goal res = new Goal();
11973    parseGoalProperties(json, res);
11974    return res;
11975  }
11976
11977  protected void parseGoalProperties(JsonObject json, Goal res) throws IOException, FHIRFormatError {
11978    parseDomainResourceProperties(json, res);
11979    if (json.has("identifier")) {
11980      JsonArray array = json.getAsJsonArray("identifier");
11981      for (int i = 0; i < array.size(); i++) {
11982        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
11983      }
11984    };
11985    if (json.has("status"))
11986      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Goal.GoalStatus.NULL, new Goal.GoalStatusEnumFactory()));
11987    if (json.has("_status"))
11988      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
11989    if (json.has("category")) {
11990      JsonArray array = json.getAsJsonArray("category");
11991      for (int i = 0; i < array.size(); i++) {
11992        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
11993      }
11994    };
11995    if (json.has("priority"))
11996      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
11997    if (json.has("description"))
11998      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
11999    if (json.has("subject"))
12000      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12001    Type start = parseType("start", json);
12002    if (start != null)
12003      res.setStart(start);
12004    if (json.has("target"))
12005      res.setTarget(parseGoalGoalTargetComponent(json.getAsJsonObject("target"), res));
12006    if (json.has("statusDate"))
12007      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
12008    if (json.has("_statusDate"))
12009      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
12010    if (json.has("statusReason"))
12011      res.setStatusReasonElement(parseString(json.get("statusReason").getAsString()));
12012    if (json.has("_statusReason"))
12013      parseElementProperties(json.getAsJsonObject("_statusReason"), res.getStatusReasonElement());
12014    if (json.has("expressedBy"))
12015      res.setExpressedBy(parseReference(json.getAsJsonObject("expressedBy")));
12016    if (json.has("addresses")) {
12017      JsonArray array = json.getAsJsonArray("addresses");
12018      for (int i = 0; i < array.size(); i++) {
12019        res.getAddresses().add(parseReference(array.get(i).getAsJsonObject()));
12020      }
12021    };
12022    if (json.has("note")) {
12023      JsonArray array = json.getAsJsonArray("note");
12024      for (int i = 0; i < array.size(); i++) {
12025        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12026      }
12027    };
12028    if (json.has("outcomeCode")) {
12029      JsonArray array = json.getAsJsonArray("outcomeCode");
12030      for (int i = 0; i < array.size(); i++) {
12031        res.getOutcomeCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12032      }
12033    };
12034    if (json.has("outcomeReference")) {
12035      JsonArray array = json.getAsJsonArray("outcomeReference");
12036      for (int i = 0; i < array.size(); i++) {
12037        res.getOutcomeReference().add(parseReference(array.get(i).getAsJsonObject()));
12038      }
12039    };
12040  }
12041
12042  protected Goal.GoalTargetComponent parseGoalGoalTargetComponent(JsonObject json, Goal owner) throws IOException, FHIRFormatError {
12043    Goal.GoalTargetComponent res = new Goal.GoalTargetComponent();
12044    parseGoalGoalTargetComponentProperties(json, owner, res);
12045    return res;
12046  }
12047
12048  protected void parseGoalGoalTargetComponentProperties(JsonObject json, Goal owner, Goal.GoalTargetComponent res) throws IOException, FHIRFormatError {
12049    parseBackboneElementProperties(json, res);
12050    if (json.has("measure"))
12051      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
12052    Type detail = parseType("detail", json);
12053    if (detail != null)
12054      res.setDetail(detail);
12055    Type due = parseType("due", json);
12056    if (due != null)
12057      res.setDue(due);
12058  }
12059
12060  protected GraphDefinition parseGraphDefinition(JsonObject json) throws IOException, FHIRFormatError {
12061    GraphDefinition res = new GraphDefinition();
12062    parseGraphDefinitionProperties(json, res);
12063    return res;
12064  }
12065
12066  protected void parseGraphDefinitionProperties(JsonObject json, GraphDefinition res) throws IOException, FHIRFormatError {
12067    parseDomainResourceProperties(json, res);
12068    if (json.has("url"))
12069      res.setUrlElement(parseUri(json.get("url").getAsString()));
12070    if (json.has("_url"))
12071      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
12072    if (json.has("version"))
12073      res.setVersionElement(parseString(json.get("version").getAsString()));
12074    if (json.has("_version"))
12075      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
12076    if (json.has("name"))
12077      res.setNameElement(parseString(json.get("name").getAsString()));
12078    if (json.has("_name"))
12079      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12080    if (json.has("status"))
12081      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
12082    if (json.has("_status"))
12083      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12084    if (json.has("experimental"))
12085      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
12086    if (json.has("_experimental"))
12087      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
12088    if (json.has("date"))
12089      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12090    if (json.has("_date"))
12091      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12092    if (json.has("publisher"))
12093      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
12094    if (json.has("_publisher"))
12095      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
12096    if (json.has("contact")) {
12097      JsonArray array = json.getAsJsonArray("contact");
12098      for (int i = 0; i < array.size(); i++) {
12099        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
12100      }
12101    };
12102    if (json.has("description"))
12103      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
12104    if (json.has("_description"))
12105      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12106    if (json.has("useContext")) {
12107      JsonArray array = json.getAsJsonArray("useContext");
12108      for (int i = 0; i < array.size(); i++) {
12109        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
12110      }
12111    };
12112    if (json.has("jurisdiction")) {
12113      JsonArray array = json.getAsJsonArray("jurisdiction");
12114      for (int i = 0; i < array.size(); i++) {
12115        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12116      }
12117    };
12118    if (json.has("purpose"))
12119      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
12120    if (json.has("_purpose"))
12121      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
12122    if (json.has("start"))
12123      res.setStartElement(parseCode(json.get("start").getAsString()));
12124    if (json.has("_start"))
12125      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
12126    if (json.has("profile"))
12127      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
12128    if (json.has("_profile"))
12129      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
12130    if (json.has("link")) {
12131      JsonArray array = json.getAsJsonArray("link");
12132      for (int i = 0; i < array.size(); i++) {
12133        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), res));
12134      }
12135    };
12136  }
12137
12138  protected GraphDefinition.GraphDefinitionLinkComponent parseGraphDefinitionGraphDefinitionLinkComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12139    GraphDefinition.GraphDefinitionLinkComponent res = new GraphDefinition.GraphDefinitionLinkComponent();
12140    parseGraphDefinitionGraphDefinitionLinkComponentProperties(json, owner, res);
12141    return res;
12142  }
12143
12144  protected void parseGraphDefinitionGraphDefinitionLinkComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkComponent res) throws IOException, FHIRFormatError {
12145    parseBackboneElementProperties(json, res);
12146    if (json.has("path"))
12147      res.setPathElement(parseString(json.get("path").getAsString()));
12148    if (json.has("_path"))
12149      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
12150    if (json.has("sliceName"))
12151      res.setSliceNameElement(parseString(json.get("sliceName").getAsString()));
12152    if (json.has("_sliceName"))
12153      parseElementProperties(json.getAsJsonObject("_sliceName"), res.getSliceNameElement());
12154    if (json.has("min"))
12155      res.setMinElement(parseInteger(json.get("min").getAsLong()));
12156    if (json.has("_min"))
12157      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
12158    if (json.has("max"))
12159      res.setMaxElement(parseString(json.get("max").getAsString()));
12160    if (json.has("_max"))
12161      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
12162    if (json.has("description"))
12163      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12164    if (json.has("_description"))
12165      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12166    if (json.has("target")) {
12167      JsonArray array = json.getAsJsonArray("target");
12168      for (int i = 0; i < array.size(); i++) {
12169        res.getTarget().add(parseGraphDefinitionGraphDefinitionLinkTargetComponent(array.get(i).getAsJsonObject(), owner));
12170      }
12171    };
12172  }
12173
12174  protected GraphDefinition.GraphDefinitionLinkTargetComponent parseGraphDefinitionGraphDefinitionLinkTargetComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12175    GraphDefinition.GraphDefinitionLinkTargetComponent res = new GraphDefinition.GraphDefinitionLinkTargetComponent();
12176    parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(json, owner, res);
12177    return res;
12178  }
12179
12180  protected void parseGraphDefinitionGraphDefinitionLinkTargetComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetComponent res) throws IOException, FHIRFormatError {
12181    parseBackboneElementProperties(json, res);
12182    if (json.has("type"))
12183      res.setTypeElement(parseCode(json.get("type").getAsString()));
12184    if (json.has("_type"))
12185      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12186    if (json.has("params"))
12187      res.setParamsElement(parseString(json.get("params").getAsString()));
12188    if (json.has("_params"))
12189      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
12190    if (json.has("profile"))
12191      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
12192    if (json.has("_profile"))
12193      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
12194    if (json.has("compartment")) {
12195      JsonArray array = json.getAsJsonArray("compartment");
12196      for (int i = 0; i < array.size(); i++) {
12197        res.getCompartment().add(parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(array.get(i).getAsJsonObject(), owner));
12198      }
12199    };
12200    if (json.has("link")) {
12201      JsonArray array = json.getAsJsonArray("link");
12202      for (int i = 0; i < array.size(); i++) {
12203        res.getLink().add(parseGraphDefinitionGraphDefinitionLinkComponent(array.get(i).getAsJsonObject(), owner));
12204      }
12205    };
12206  }
12207
12208  protected GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(JsonObject json, GraphDefinition owner) throws IOException, FHIRFormatError {
12209    GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res = new GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent();
12210    parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(json, owner, res);
12211    return res;
12212  }
12213
12214  protected void parseGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentProperties(JsonObject json, GraphDefinition owner, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent res) throws IOException, FHIRFormatError {
12215    parseBackboneElementProperties(json, res);
12216    if (json.has("use"))
12217      res.setUseElement(parseEnumeration(json.get("use").getAsString(), GraphDefinition.GraphCompartmentUse.NULL, new GraphDefinition.GraphCompartmentUseEnumFactory()));
12218    if (json.has("_use"))
12219      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
12220    if (json.has("code"))
12221      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), GraphDefinition.CompartmentCode.NULL, new GraphDefinition.CompartmentCodeEnumFactory()));
12222    if (json.has("_code"))
12223      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
12224    if (json.has("rule"))
12225      res.setRuleElement(parseEnumeration(json.get("rule").getAsString(), GraphDefinition.GraphCompartmentRule.NULL, new GraphDefinition.GraphCompartmentRuleEnumFactory()));
12226    if (json.has("_rule"))
12227      parseElementProperties(json.getAsJsonObject("_rule"), res.getRuleElement());
12228    if (json.has("expression"))
12229      res.setExpressionElement(parseString(json.get("expression").getAsString()));
12230    if (json.has("_expression"))
12231      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
12232    if (json.has("description"))
12233      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12234    if (json.has("_description"))
12235      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12236  }
12237
12238  protected Group parseGroup(JsonObject json) throws IOException, FHIRFormatError {
12239    Group res = new Group();
12240    parseGroupProperties(json, res);
12241    return res;
12242  }
12243
12244  protected void parseGroupProperties(JsonObject json, Group res) throws IOException, FHIRFormatError {
12245    parseDomainResourceProperties(json, res);
12246    if (json.has("identifier")) {
12247      JsonArray array = json.getAsJsonArray("identifier");
12248      for (int i = 0; i < array.size(); i++) {
12249        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12250      }
12251    };
12252    if (json.has("active"))
12253      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
12254    if (json.has("_active"))
12255      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
12256    if (json.has("type"))
12257      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Group.GroupType.NULL, new Group.GroupTypeEnumFactory()));
12258    if (json.has("_type"))
12259      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
12260    if (json.has("actual"))
12261      res.setActualElement(parseBoolean(json.get("actual").getAsBoolean()));
12262    if (json.has("_actual"))
12263      parseElementProperties(json.getAsJsonObject("_actual"), res.getActualElement());
12264    if (json.has("code"))
12265      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12266    if (json.has("name"))
12267      res.setNameElement(parseString(json.get("name").getAsString()));
12268    if (json.has("_name"))
12269      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12270    if (json.has("quantity"))
12271      res.setQuantityElement(parseUnsignedInt(json.get("quantity").getAsString()));
12272    if (json.has("_quantity"))
12273      parseElementProperties(json.getAsJsonObject("_quantity"), res.getQuantityElement());
12274    if (json.has("characteristic")) {
12275      JsonArray array = json.getAsJsonArray("characteristic");
12276      for (int i = 0; i < array.size(); i++) {
12277        res.getCharacteristic().add(parseGroupGroupCharacteristicComponent(array.get(i).getAsJsonObject(), res));
12278      }
12279    };
12280    if (json.has("member")) {
12281      JsonArray array = json.getAsJsonArray("member");
12282      for (int i = 0; i < array.size(); i++) {
12283        res.getMember().add(parseGroupGroupMemberComponent(array.get(i).getAsJsonObject(), res));
12284      }
12285    };
12286  }
12287
12288  protected Group.GroupCharacteristicComponent parseGroupGroupCharacteristicComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
12289    Group.GroupCharacteristicComponent res = new Group.GroupCharacteristicComponent();
12290    parseGroupGroupCharacteristicComponentProperties(json, owner, res);
12291    return res;
12292  }
12293
12294  protected void parseGroupGroupCharacteristicComponentProperties(JsonObject json, Group owner, Group.GroupCharacteristicComponent res) throws IOException, FHIRFormatError {
12295    parseBackboneElementProperties(json, res);
12296    if (json.has("code"))
12297      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
12298    Type value = parseType("value", json);
12299    if (value != null)
12300      res.setValue(value);
12301    if (json.has("exclude"))
12302      res.setExcludeElement(parseBoolean(json.get("exclude").getAsBoolean()));
12303    if (json.has("_exclude"))
12304      parseElementProperties(json.getAsJsonObject("_exclude"), res.getExcludeElement());
12305    if (json.has("period"))
12306      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
12307  }
12308
12309  protected Group.GroupMemberComponent parseGroupGroupMemberComponent(JsonObject json, Group owner) throws IOException, FHIRFormatError {
12310    Group.GroupMemberComponent res = new Group.GroupMemberComponent();
12311    parseGroupGroupMemberComponentProperties(json, owner, res);
12312    return res;
12313  }
12314
12315  protected void parseGroupGroupMemberComponentProperties(JsonObject json, Group owner, Group.GroupMemberComponent res) throws IOException, FHIRFormatError {
12316    parseBackboneElementProperties(json, res);
12317    if (json.has("entity"))
12318      res.setEntity(parseReference(json.getAsJsonObject("entity")));
12319    if (json.has("period"))
12320      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
12321    if (json.has("inactive"))
12322      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
12323    if (json.has("_inactive"))
12324      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
12325  }
12326
12327  protected GuidanceResponse parseGuidanceResponse(JsonObject json) throws IOException, FHIRFormatError {
12328    GuidanceResponse res = new GuidanceResponse();
12329    parseGuidanceResponseProperties(json, res);
12330    return res;
12331  }
12332
12333  protected void parseGuidanceResponseProperties(JsonObject json, GuidanceResponse res) throws IOException, FHIRFormatError {
12334    parseDomainResourceProperties(json, res);
12335    if (json.has("requestIdentifier"))
12336      res.setRequestIdentifier(parseIdentifier(json.getAsJsonObject("requestIdentifier")));
12337    if (json.has("identifier")) {
12338      JsonArray array = json.getAsJsonArray("identifier");
12339      for (int i = 0; i < array.size(); i++) {
12340        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12341      }
12342    };
12343    Type module = parseType("module", json);
12344    if (module != null)
12345      res.setModule(module);
12346    if (json.has("status"))
12347      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), GuidanceResponse.GuidanceResponseStatus.NULL, new GuidanceResponse.GuidanceResponseStatusEnumFactory()));
12348    if (json.has("_status"))
12349      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12350    if (json.has("subject"))
12351      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12352    if (json.has("context"))
12353      res.setContext(parseReference(json.getAsJsonObject("context")));
12354    if (json.has("occurrenceDateTime"))
12355      res.setOccurrenceDateTimeElement(parseDateTime(json.get("occurrenceDateTime").getAsString()));
12356    if (json.has("_occurrenceDateTime"))
12357      parseElementProperties(json.getAsJsonObject("_occurrenceDateTime"), res.getOccurrenceDateTimeElement());
12358    if (json.has("performer"))
12359      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
12360    if (json.has("reasonCode")) {
12361      JsonArray array = json.getAsJsonArray("reasonCode");
12362      for (int i = 0; i < array.size(); i++) {
12363        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12364      }
12365    };
12366    if (json.has("reasonReference")) {
12367      JsonArray array = json.getAsJsonArray("reasonReference");
12368      for (int i = 0; i < array.size(); i++) {
12369        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12370      }
12371    };
12372    if (json.has("note")) {
12373      JsonArray array = json.getAsJsonArray("note");
12374      for (int i = 0; i < array.size(); i++) {
12375        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12376      }
12377    };
12378    if (json.has("evaluationMessage")) {
12379      JsonArray array = json.getAsJsonArray("evaluationMessage");
12380      for (int i = 0; i < array.size(); i++) {
12381        res.getEvaluationMessage().add(parseReference(array.get(i).getAsJsonObject()));
12382      }
12383    };
12384    if (json.has("outputParameters"))
12385      res.setOutputParameters(parseReference(json.getAsJsonObject("outputParameters")));
12386    if (json.has("result"))
12387      res.setResult(parseReference(json.getAsJsonObject("result")));
12388    if (json.has("dataRequirement")) {
12389      JsonArray array = json.getAsJsonArray("dataRequirement");
12390      for (int i = 0; i < array.size(); i++) {
12391        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
12392      }
12393    };
12394  }
12395
12396  protected HealthcareService parseHealthcareService(JsonObject json) throws IOException, FHIRFormatError {
12397    HealthcareService res = new HealthcareService();
12398    parseHealthcareServiceProperties(json, res);
12399    return res;
12400  }
12401
12402  protected void parseHealthcareServiceProperties(JsonObject json, HealthcareService res) throws IOException, FHIRFormatError {
12403    parseDomainResourceProperties(json, res);
12404    if (json.has("identifier")) {
12405      JsonArray array = json.getAsJsonArray("identifier");
12406      for (int i = 0; i < array.size(); i++) {
12407        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12408      }
12409    };
12410    if (json.has("active"))
12411      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
12412    if (json.has("_active"))
12413      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
12414    if (json.has("providedBy"))
12415      res.setProvidedBy(parseReference(json.getAsJsonObject("providedBy")));
12416    if (json.has("category")) {
12417      JsonArray array = json.getAsJsonArray("category");
12418      for (int i = 0; i < array.size(); i++) {
12419        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12420      }
12421    };
12422    if (json.has("type")) {
12423      JsonArray array = json.getAsJsonArray("type");
12424      for (int i = 0; i < array.size(); i++) {
12425        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12426      }
12427    };
12428    if (json.has("specialty")) {
12429      JsonArray array = json.getAsJsonArray("specialty");
12430      for (int i = 0; i < array.size(); i++) {
12431        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12432      }
12433    };
12434    if (json.has("location")) {
12435      JsonArray array = json.getAsJsonArray("location");
12436      for (int i = 0; i < array.size(); i++) {
12437        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
12438      }
12439    };
12440    if (json.has("name"))
12441      res.setNameElement(parseString(json.get("name").getAsString()));
12442    if (json.has("_name"))
12443      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
12444    if (json.has("comment"))
12445      res.setCommentElement(parseString(json.get("comment").getAsString()));
12446    if (json.has("_comment"))
12447      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
12448    if (json.has("extraDetails"))
12449      res.setExtraDetailsElement(parseString(json.get("extraDetails").getAsString()));
12450    if (json.has("_extraDetails"))
12451      parseElementProperties(json.getAsJsonObject("_extraDetails"), res.getExtraDetailsElement());
12452    if (json.has("photo"))
12453      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
12454    if (json.has("telecom")) {
12455      JsonArray array = json.getAsJsonArray("telecom");
12456      for (int i = 0; i < array.size(); i++) {
12457        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
12458      }
12459    };
12460    if (json.has("coverageArea")) {
12461      JsonArray array = json.getAsJsonArray("coverageArea");
12462      for (int i = 0; i < array.size(); i++) {
12463        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
12464      }
12465    };
12466    if (json.has("serviceProvisionCode")) {
12467      JsonArray array = json.getAsJsonArray("serviceProvisionCode");
12468      for (int i = 0; i < array.size(); i++) {
12469        res.getServiceProvisionCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12470      }
12471    };
12472    if (json.has("eligibility"))
12473      res.setEligibility(parseCodeableConcept(json.getAsJsonObject("eligibility")));
12474    if (json.has("eligibilityNote"))
12475      res.setEligibilityNoteElement(parseString(json.get("eligibilityNote").getAsString()));
12476    if (json.has("_eligibilityNote"))
12477      parseElementProperties(json.getAsJsonObject("_eligibilityNote"), res.getEligibilityNoteElement());
12478    if (json.has("programName")) {
12479      JsonArray array = json.getAsJsonArray("programName");
12480      for (int i = 0; i < array.size(); i++) {
12481        res.getProgramName().add(parseString(array.get(i).getAsString()));
12482      }
12483    };
12484    if (json.has("_programName")) {
12485      JsonArray array = json.getAsJsonArray("_programName");
12486      for (int i = 0; i < array.size(); i++) {
12487        if (i == res.getProgramName().size())
12488          res.getProgramName().add(parseString(null));
12489        if (array.get(i) instanceof JsonObject) 
12490          parseElementProperties(array.get(i).getAsJsonObject(), res.getProgramName().get(i));
12491      }
12492    };
12493    if (json.has("characteristic")) {
12494      JsonArray array = json.getAsJsonArray("characteristic");
12495      for (int i = 0; i < array.size(); i++) {
12496        res.getCharacteristic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12497      }
12498    };
12499    if (json.has("referralMethod")) {
12500      JsonArray array = json.getAsJsonArray("referralMethod");
12501      for (int i = 0; i < array.size(); i++) {
12502        res.getReferralMethod().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12503      }
12504    };
12505    if (json.has("appointmentRequired"))
12506      res.setAppointmentRequiredElement(parseBoolean(json.get("appointmentRequired").getAsBoolean()));
12507    if (json.has("_appointmentRequired"))
12508      parseElementProperties(json.getAsJsonObject("_appointmentRequired"), res.getAppointmentRequiredElement());
12509    if (json.has("availableTime")) {
12510      JsonArray array = json.getAsJsonArray("availableTime");
12511      for (int i = 0; i < array.size(); i++) {
12512        res.getAvailableTime().add(parseHealthcareServiceHealthcareServiceAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
12513      }
12514    };
12515    if (json.has("notAvailable")) {
12516      JsonArray array = json.getAsJsonArray("notAvailable");
12517      for (int i = 0; i < array.size(); i++) {
12518        res.getNotAvailable().add(parseHealthcareServiceHealthcareServiceNotAvailableComponent(array.get(i).getAsJsonObject(), res));
12519      }
12520    };
12521    if (json.has("availabilityExceptions"))
12522      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
12523    if (json.has("_availabilityExceptions"))
12524      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
12525    if (json.has("endpoint")) {
12526      JsonArray array = json.getAsJsonArray("endpoint");
12527      for (int i = 0; i < array.size(); i++) {
12528        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
12529      }
12530    };
12531  }
12532
12533  protected HealthcareService.HealthcareServiceAvailableTimeComponent parseHealthcareServiceHealthcareServiceAvailableTimeComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
12534    HealthcareService.HealthcareServiceAvailableTimeComponent res = new HealthcareService.HealthcareServiceAvailableTimeComponent();
12535    parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(json, owner, res);
12536    return res;
12537  }
12538
12539  protected void parseHealthcareServiceHealthcareServiceAvailableTimeComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceAvailableTimeComponent res) throws IOException, FHIRFormatError {
12540    parseBackboneElementProperties(json, res);
12541    if (json.has("daysOfWeek")) {
12542      JsonArray array = json.getAsJsonArray("daysOfWeek");
12543      for (int i = 0; i < array.size(); i++) {
12544        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
12545      }
12546    };
12547    if (json.has("_daysOfWeek")) {
12548      JsonArray array = json.getAsJsonArray("_daysOfWeek");
12549      for (int i = 0; i < array.size(); i++) {
12550        if (i == res.getDaysOfWeek().size())
12551          res.getDaysOfWeek().add(parseEnumeration(null, HealthcareService.DaysOfWeek.NULL, new HealthcareService.DaysOfWeekEnumFactory()));
12552        if (array.get(i) instanceof JsonObject) 
12553          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
12554      }
12555    };
12556    if (json.has("allDay"))
12557      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
12558    if (json.has("_allDay"))
12559      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
12560    if (json.has("availableStartTime"))
12561      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
12562    if (json.has("_availableStartTime"))
12563      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
12564    if (json.has("availableEndTime"))
12565      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
12566    if (json.has("_availableEndTime"))
12567      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
12568  }
12569
12570  protected HealthcareService.HealthcareServiceNotAvailableComponent parseHealthcareServiceHealthcareServiceNotAvailableComponent(JsonObject json, HealthcareService owner) throws IOException, FHIRFormatError {
12571    HealthcareService.HealthcareServiceNotAvailableComponent res = new HealthcareService.HealthcareServiceNotAvailableComponent();
12572    parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(json, owner, res);
12573    return res;
12574  }
12575
12576  protected void parseHealthcareServiceHealthcareServiceNotAvailableComponentProperties(JsonObject json, HealthcareService owner, HealthcareService.HealthcareServiceNotAvailableComponent res) throws IOException, FHIRFormatError {
12577    parseBackboneElementProperties(json, res);
12578    if (json.has("description"))
12579      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12580    if (json.has("_description"))
12581      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12582    if (json.has("during"))
12583      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
12584  }
12585
12586  protected ImagingStudy parseImagingStudy(JsonObject json) throws IOException, FHIRFormatError {
12587    ImagingStudy res = new ImagingStudy();
12588    parseImagingStudyProperties(json, res);
12589    return res;
12590  }
12591
12592  protected void parseImagingStudyProperties(JsonObject json, ImagingStudy res) throws IOException, FHIRFormatError {
12593    parseDomainResourceProperties(json, res);
12594    if (json.has("identifier")) {
12595      JsonArray array = json.getAsJsonArray("identifier");
12596      for (int i = 0; i < array.size(); i++) {
12597        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12598      }
12599    };
12600    if (json.has("status"))
12601      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImagingStudy.ImagingStudyStatus.NULL, new ImagingStudy.ImagingStudyStatusEnumFactory()));
12602    if (json.has("_status"))
12603      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12604    if (json.has("modality")) {
12605      JsonArray array = json.getAsJsonArray("modality");
12606      for (int i = 0; i < array.size(); i++) {
12607        res.getModality().add(parseCoding(array.get(i).getAsJsonObject()));
12608      }
12609    };
12610    if (json.has("subject"))
12611      res.setSubject(parseReference(json.getAsJsonObject("subject")));
12612    if (json.has("context"))
12613      res.setContext(parseReference(json.getAsJsonObject("context")));
12614    if (json.has("started"))
12615      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
12616    if (json.has("_started"))
12617      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
12618    if (json.has("basedOn")) {
12619      JsonArray array = json.getAsJsonArray("basedOn");
12620      for (int i = 0; i < array.size(); i++) {
12621        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
12622      }
12623    };
12624    if (json.has("referrer"))
12625      res.setReferrer(parseReference(json.getAsJsonObject("referrer")));
12626    if (json.has("interpreter")) {
12627      JsonArray array = json.getAsJsonArray("interpreter");
12628      for (int i = 0; i < array.size(); i++) {
12629        res.getInterpreter().add(parseReference(array.get(i).getAsJsonObject()));
12630      }
12631    };
12632    if (json.has("endpoint")) {
12633      JsonArray array = json.getAsJsonArray("endpoint");
12634      for (int i = 0; i < array.size(); i++) {
12635        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
12636      }
12637    };
12638    if (json.has("numberOfSeries"))
12639      res.setNumberOfSeriesElement(parseUnsignedInt(json.get("numberOfSeries").getAsString()));
12640    if (json.has("_numberOfSeries"))
12641      parseElementProperties(json.getAsJsonObject("_numberOfSeries"), res.getNumberOfSeriesElement());
12642    if (json.has("numberOfInstances"))
12643      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
12644    if (json.has("_numberOfInstances"))
12645      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
12646    if (json.has("procedureReference"))
12647      res.setProcedureReference(parseReference(json.getAsJsonObject("procedureReference")));
12648    if (json.has("procedureCode")) {
12649      JsonArray array = json.getAsJsonArray("procedureCode");
12650      for (int i = 0; i < array.size(); i++) {
12651        res.getProcedureCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12652      }
12653    };
12654    if (json.has("location"))
12655      res.setLocation(parseReference(json.getAsJsonObject("location")));
12656    if (json.has("reasonCode")) {
12657      JsonArray array = json.getAsJsonArray("reasonCode");
12658      for (int i = 0; i < array.size(); i++) {
12659        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12660      }
12661    };
12662    if (json.has("reasonReference")) {
12663      JsonArray array = json.getAsJsonArray("reasonReference");
12664      for (int i = 0; i < array.size(); i++) {
12665        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12666      }
12667    };
12668    if (json.has("note")) {
12669      JsonArray array = json.getAsJsonArray("note");
12670      for (int i = 0; i < array.size(); i++) {
12671        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12672      }
12673    };
12674    if (json.has("description"))
12675      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12676    if (json.has("_description"))
12677      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12678    if (json.has("series")) {
12679      JsonArray array = json.getAsJsonArray("series");
12680      for (int i = 0; i < array.size(); i++) {
12681        res.getSeries().add(parseImagingStudyImagingStudySeriesComponent(array.get(i).getAsJsonObject(), res));
12682      }
12683    };
12684  }
12685
12686  protected ImagingStudy.ImagingStudySeriesComponent parseImagingStudyImagingStudySeriesComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
12687    ImagingStudy.ImagingStudySeriesComponent res = new ImagingStudy.ImagingStudySeriesComponent();
12688    parseImagingStudyImagingStudySeriesComponentProperties(json, owner, res);
12689    return res;
12690  }
12691
12692  protected void parseImagingStudyImagingStudySeriesComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesComponent res) throws IOException, FHIRFormatError {
12693    parseBackboneElementProperties(json, res);
12694    if (json.has("identifier"))
12695      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
12696    if (json.has("number"))
12697      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
12698    if (json.has("_number"))
12699      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
12700    if (json.has("modality"))
12701      res.setModality(parseCoding(json.getAsJsonObject("modality")));
12702    if (json.has("description"))
12703      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12704    if (json.has("_description"))
12705      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12706    if (json.has("numberOfInstances"))
12707      res.setNumberOfInstancesElement(parseUnsignedInt(json.get("numberOfInstances").getAsString()));
12708    if (json.has("_numberOfInstances"))
12709      parseElementProperties(json.getAsJsonObject("_numberOfInstances"), res.getNumberOfInstancesElement());
12710    if (json.has("endpoint")) {
12711      JsonArray array = json.getAsJsonArray("endpoint");
12712      for (int i = 0; i < array.size(); i++) {
12713        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
12714      }
12715    };
12716    if (json.has("bodySite"))
12717      res.setBodySite(parseCoding(json.getAsJsonObject("bodySite")));
12718    if (json.has("laterality"))
12719      res.setLaterality(parseCoding(json.getAsJsonObject("laterality")));
12720    if (json.has("specimen")) {
12721      JsonArray array = json.getAsJsonArray("specimen");
12722      for (int i = 0; i < array.size(); i++) {
12723        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
12724      }
12725    };
12726    if (json.has("started"))
12727      res.setStartedElement(parseDateTime(json.get("started").getAsString()));
12728    if (json.has("_started"))
12729      parseElementProperties(json.getAsJsonObject("_started"), res.getStartedElement());
12730    if (json.has("performer")) {
12731      JsonArray array = json.getAsJsonArray("performer");
12732      for (int i = 0; i < array.size(); i++) {
12733        res.getPerformer().add(parseImagingStudyImagingStudySeriesPerformerComponent(array.get(i).getAsJsonObject(), owner));
12734      }
12735    };
12736    if (json.has("instance")) {
12737      JsonArray array = json.getAsJsonArray("instance");
12738      for (int i = 0; i < array.size(); i++) {
12739        res.getInstance().add(parseImagingStudyImagingStudySeriesInstanceComponent(array.get(i).getAsJsonObject(), owner));
12740      }
12741    };
12742  }
12743
12744  protected ImagingStudy.ImagingStudySeriesPerformerComponent parseImagingStudyImagingStudySeriesPerformerComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
12745    ImagingStudy.ImagingStudySeriesPerformerComponent res = new ImagingStudy.ImagingStudySeriesPerformerComponent();
12746    parseImagingStudyImagingStudySeriesPerformerComponentProperties(json, owner, res);
12747    return res;
12748  }
12749
12750  protected void parseImagingStudyImagingStudySeriesPerformerComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesPerformerComponent res) throws IOException, FHIRFormatError {
12751    parseBackboneElementProperties(json, res);
12752    if (json.has("function"))
12753      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
12754    if (json.has("actor"))
12755      res.setActor(parseReference(json.getAsJsonObject("actor")));
12756  }
12757
12758  protected ImagingStudy.ImagingStudySeriesInstanceComponent parseImagingStudyImagingStudySeriesInstanceComponent(JsonObject json, ImagingStudy owner) throws IOException, FHIRFormatError {
12759    ImagingStudy.ImagingStudySeriesInstanceComponent res = new ImagingStudy.ImagingStudySeriesInstanceComponent();
12760    parseImagingStudyImagingStudySeriesInstanceComponentProperties(json, owner, res);
12761    return res;
12762  }
12763
12764  protected void parseImagingStudyImagingStudySeriesInstanceComponentProperties(JsonObject json, ImagingStudy owner, ImagingStudy.ImagingStudySeriesInstanceComponent res) throws IOException, FHIRFormatError {
12765    parseBackboneElementProperties(json, res);
12766    if (json.has("identifier"))
12767      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
12768    if (json.has("number"))
12769      res.setNumberElement(parseUnsignedInt(json.get("number").getAsString()));
12770    if (json.has("_number"))
12771      parseElementProperties(json.getAsJsonObject("_number"), res.getNumberElement());
12772    if (json.has("sopClass"))
12773      res.setSopClass(parseCoding(json.getAsJsonObject("sopClass")));
12774    if (json.has("title"))
12775      res.setTitleElement(parseString(json.get("title").getAsString()));
12776    if (json.has("_title"))
12777      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
12778  }
12779
12780  protected Immunization parseImmunization(JsonObject json) throws IOException, FHIRFormatError {
12781    Immunization res = new Immunization();
12782    parseImmunizationProperties(json, res);
12783    return res;
12784  }
12785
12786  protected void parseImmunizationProperties(JsonObject json, Immunization res) throws IOException, FHIRFormatError {
12787    parseDomainResourceProperties(json, res);
12788    if (json.has("identifier")) {
12789      JsonArray array = json.getAsJsonArray("identifier");
12790      for (int i = 0; i < array.size(); i++) {
12791        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12792      }
12793    };
12794    if (json.has("status"))
12795      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Immunization.ImmunizationStatus.NULL, new Immunization.ImmunizationStatusEnumFactory()));
12796    if (json.has("_status"))
12797      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12798    if (json.has("statusReason"))
12799      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
12800    if (json.has("vaccineCode"))
12801      res.setVaccineCode(parseCodeableConcept(json.getAsJsonObject("vaccineCode")));
12802    if (json.has("patient"))
12803      res.setPatient(parseReference(json.getAsJsonObject("patient")));
12804    if (json.has("encounter"))
12805      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
12806    Type occurrence = parseType("occurrence", json);
12807    if (occurrence != null)
12808      res.setOccurrence(occurrence);
12809    if (json.has("recorded"))
12810      res.setRecordedElement(parseDateTime(json.get("recorded").getAsString()));
12811    if (json.has("_recorded"))
12812      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
12813    if (json.has("primarySource"))
12814      res.setPrimarySourceElement(parseBoolean(json.get("primarySource").getAsBoolean()));
12815    if (json.has("_primarySource"))
12816      parseElementProperties(json.getAsJsonObject("_primarySource"), res.getPrimarySourceElement());
12817    if (json.has("reportOrigin"))
12818      res.setReportOrigin(parseCodeableConcept(json.getAsJsonObject("reportOrigin")));
12819    if (json.has("location"))
12820      res.setLocation(parseReference(json.getAsJsonObject("location")));
12821    if (json.has("manufacturer"))
12822      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
12823    if (json.has("lotNumber"))
12824      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
12825    if (json.has("_lotNumber"))
12826      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
12827    if (json.has("expirationDate"))
12828      res.setExpirationDateElement(parseDate(json.get("expirationDate").getAsString()));
12829    if (json.has("_expirationDate"))
12830      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
12831    if (json.has("site"))
12832      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
12833    if (json.has("route"))
12834      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
12835    if (json.has("doseQuantity"))
12836      res.setDoseQuantity(parseQuantity(json.getAsJsonObject("doseQuantity")));
12837    if (json.has("performer")) {
12838      JsonArray array = json.getAsJsonArray("performer");
12839      for (int i = 0; i < array.size(); i++) {
12840        res.getPerformer().add(parseImmunizationImmunizationPerformerComponent(array.get(i).getAsJsonObject(), res));
12841      }
12842    };
12843    if (json.has("note")) {
12844      JsonArray array = json.getAsJsonArray("note");
12845      for (int i = 0; i < array.size(); i++) {
12846        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
12847      }
12848    };
12849    if (json.has("reasonCode")) {
12850      JsonArray array = json.getAsJsonArray("reasonCode");
12851      for (int i = 0; i < array.size(); i++) {
12852        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12853      }
12854    };
12855    if (json.has("reasonReference")) {
12856      JsonArray array = json.getAsJsonArray("reasonReference");
12857      for (int i = 0; i < array.size(); i++) {
12858        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
12859      }
12860    };
12861    if (json.has("isSubpotent"))
12862      res.setIsSubpotentElement(parseBoolean(json.get("isSubpotent").getAsBoolean()));
12863    if (json.has("_isSubpotent"))
12864      parseElementProperties(json.getAsJsonObject("_isSubpotent"), res.getIsSubpotentElement());
12865    if (json.has("subpotentReason")) {
12866      JsonArray array = json.getAsJsonArray("subpotentReason");
12867      for (int i = 0; i < array.size(); i++) {
12868        res.getSubpotentReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12869      }
12870    };
12871    if (json.has("education")) {
12872      JsonArray array = json.getAsJsonArray("education");
12873      for (int i = 0; i < array.size(); i++) {
12874        res.getEducation().add(parseImmunizationImmunizationEducationComponent(array.get(i).getAsJsonObject(), res));
12875      }
12876    };
12877    if (json.has("programEligibility")) {
12878      JsonArray array = json.getAsJsonArray("programEligibility");
12879      for (int i = 0; i < array.size(); i++) {
12880        res.getProgramEligibility().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12881      }
12882    };
12883    if (json.has("fundingSource"))
12884      res.setFundingSource(parseCodeableConcept(json.getAsJsonObject("fundingSource")));
12885    if (json.has("protocolApplied")) {
12886      JsonArray array = json.getAsJsonArray("protocolApplied");
12887      for (int i = 0; i < array.size(); i++) {
12888        res.getProtocolApplied().add(parseImmunizationImmunizationProtocolAppliedComponent(array.get(i).getAsJsonObject(), res));
12889      }
12890    };
12891  }
12892
12893  protected Immunization.ImmunizationPerformerComponent parseImmunizationImmunizationPerformerComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
12894    Immunization.ImmunizationPerformerComponent res = new Immunization.ImmunizationPerformerComponent();
12895    parseImmunizationImmunizationPerformerComponentProperties(json, owner, res);
12896    return res;
12897  }
12898
12899  protected void parseImmunizationImmunizationPerformerComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationPerformerComponent res) throws IOException, FHIRFormatError {
12900    parseBackboneElementProperties(json, res);
12901    if (json.has("function"))
12902      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
12903    if (json.has("actor"))
12904      res.setActor(parseReference(json.getAsJsonObject("actor")));
12905  }
12906
12907  protected Immunization.ImmunizationEducationComponent parseImmunizationImmunizationEducationComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
12908    Immunization.ImmunizationEducationComponent res = new Immunization.ImmunizationEducationComponent();
12909    parseImmunizationImmunizationEducationComponentProperties(json, owner, res);
12910    return res;
12911  }
12912
12913  protected void parseImmunizationImmunizationEducationComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationEducationComponent res) throws IOException, FHIRFormatError {
12914    parseBackboneElementProperties(json, res);
12915    if (json.has("documentType"))
12916      res.setDocumentTypeElement(parseString(json.get("documentType").getAsString()));
12917    if (json.has("_documentType"))
12918      parseElementProperties(json.getAsJsonObject("_documentType"), res.getDocumentTypeElement());
12919    if (json.has("reference"))
12920      res.setReferenceElement(parseUri(json.get("reference").getAsString()));
12921    if (json.has("_reference"))
12922      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
12923    if (json.has("publicationDate"))
12924      res.setPublicationDateElement(parseDateTime(json.get("publicationDate").getAsString()));
12925    if (json.has("_publicationDate"))
12926      parseElementProperties(json.getAsJsonObject("_publicationDate"), res.getPublicationDateElement());
12927    if (json.has("presentationDate"))
12928      res.setPresentationDateElement(parseDateTime(json.get("presentationDate").getAsString()));
12929    if (json.has("_presentationDate"))
12930      parseElementProperties(json.getAsJsonObject("_presentationDate"), res.getPresentationDateElement());
12931  }
12932
12933  protected Immunization.ImmunizationProtocolAppliedComponent parseImmunizationImmunizationProtocolAppliedComponent(JsonObject json, Immunization owner) throws IOException, FHIRFormatError {
12934    Immunization.ImmunizationProtocolAppliedComponent res = new Immunization.ImmunizationProtocolAppliedComponent();
12935    parseImmunizationImmunizationProtocolAppliedComponentProperties(json, owner, res);
12936    return res;
12937  }
12938
12939  protected void parseImmunizationImmunizationProtocolAppliedComponentProperties(JsonObject json, Immunization owner, Immunization.ImmunizationProtocolAppliedComponent res) throws IOException, FHIRFormatError {
12940    parseBackboneElementProperties(json, res);
12941    if (json.has("series"))
12942      res.setSeriesElement(parseString(json.get("series").getAsString()));
12943    if (json.has("_series"))
12944      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
12945    if (json.has("authority"))
12946      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
12947    if (json.has("targetDisease"))
12948      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
12949    Type doseNumber = parseType("doseNumber", json);
12950    if (doseNumber != null)
12951      res.setDoseNumber(doseNumber);
12952  }
12953
12954  protected ImmunizationEvaluation parseImmunizationEvaluation(JsonObject json) throws IOException, FHIRFormatError {
12955    ImmunizationEvaluation res = new ImmunizationEvaluation();
12956    parseImmunizationEvaluationProperties(json, res);
12957    return res;
12958  }
12959
12960  protected void parseImmunizationEvaluationProperties(JsonObject json, ImmunizationEvaluation res) throws IOException, FHIRFormatError {
12961    parseDomainResourceProperties(json, res);
12962    if (json.has("identifier")) {
12963      JsonArray array = json.getAsJsonArray("identifier");
12964      for (int i = 0; i < array.size(); i++) {
12965        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
12966      }
12967    };
12968    if (json.has("status"))
12969      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ImmunizationEvaluation.ImmunizationEvaluationStatus.NULL, new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory()));
12970    if (json.has("_status"))
12971      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
12972    if (json.has("patient"))
12973      res.setPatient(parseReference(json.getAsJsonObject("patient")));
12974    if (json.has("date"))
12975      res.setDateElement(parseDateTime(json.get("date").getAsString()));
12976    if (json.has("_date"))
12977      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
12978    if (json.has("authority"))
12979      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
12980    if (json.has("targetDisease"))
12981      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
12982    if (json.has("immunizationEvent"))
12983      res.setImmunizationEvent(parseReference(json.getAsJsonObject("immunizationEvent")));
12984    if (json.has("doseStatus"))
12985      res.setDoseStatus(parseCodeableConcept(json.getAsJsonObject("doseStatus")));
12986    if (json.has("doseStatusReason")) {
12987      JsonArray array = json.getAsJsonArray("doseStatusReason");
12988      for (int i = 0; i < array.size(); i++) {
12989        res.getDoseStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
12990      }
12991    };
12992    if (json.has("description"))
12993      res.setDescriptionElement(parseString(json.get("description").getAsString()));
12994    if (json.has("_description"))
12995      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
12996    if (json.has("series"))
12997      res.setSeriesElement(parseString(json.get("series").getAsString()));
12998    if (json.has("_series"))
12999      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
13000    Type doseNumber = parseType("doseNumber", json);
13001    if (doseNumber != null)
13002      res.setDoseNumber(doseNumber);
13003    Type seriesDoses = parseType("seriesDoses", json);
13004    if (seriesDoses != null)
13005      res.setSeriesDoses(seriesDoses);
13006  }
13007
13008  protected ImmunizationRecommendation parseImmunizationRecommendation(JsonObject json) throws IOException, FHIRFormatError {
13009    ImmunizationRecommendation res = new ImmunizationRecommendation();
13010    parseImmunizationRecommendationProperties(json, res);
13011    return res;
13012  }
13013
13014  protected void parseImmunizationRecommendationProperties(JsonObject json, ImmunizationRecommendation res) throws IOException, FHIRFormatError {
13015    parseDomainResourceProperties(json, res);
13016    if (json.has("identifier")) {
13017      JsonArray array = json.getAsJsonArray("identifier");
13018      for (int i = 0; i < array.size(); i++) {
13019        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13020      }
13021    };
13022    if (json.has("patient"))
13023      res.setPatient(parseReference(json.getAsJsonObject("patient")));
13024    if (json.has("date"))
13025      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13026    if (json.has("_date"))
13027      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13028    if (json.has("authority"))
13029      res.setAuthority(parseReference(json.getAsJsonObject("authority")));
13030    if (json.has("recommendation")) {
13031      JsonArray array = json.getAsJsonArray("recommendation");
13032      for (int i = 0; i < array.size(); i++) {
13033        res.getRecommendation().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(array.get(i).getAsJsonObject(), res));
13034      }
13035    };
13036  }
13037
13038  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
13039    ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent();
13040    parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(json, owner, res);
13041    return res;
13042  }
13043
13044  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent res) throws IOException, FHIRFormatError {
13045    parseBackboneElementProperties(json, res);
13046    if (json.has("vaccineCode")) {
13047      JsonArray array = json.getAsJsonArray("vaccineCode");
13048      for (int i = 0; i < array.size(); i++) {
13049        res.getVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13050      }
13051    };
13052    if (json.has("targetDisease"))
13053      res.setTargetDisease(parseCodeableConcept(json.getAsJsonObject("targetDisease")));
13054    if (json.has("contraindicatedVaccineCode")) {
13055      JsonArray array = json.getAsJsonArray("contraindicatedVaccineCode");
13056      for (int i = 0; i < array.size(); i++) {
13057        res.getContraindicatedVaccineCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13058      }
13059    };
13060    if (json.has("forecastStatus"))
13061      res.setForecastStatus(parseCodeableConcept(json.getAsJsonObject("forecastStatus")));
13062    if (json.has("forecastReason")) {
13063      JsonArray array = json.getAsJsonArray("forecastReason");
13064      for (int i = 0; i < array.size(); i++) {
13065        res.getForecastReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13066      }
13067    };
13068    if (json.has("dateCriterion")) {
13069      JsonArray array = json.getAsJsonArray("dateCriterion");
13070      for (int i = 0; i < array.size(); i++) {
13071        res.getDateCriterion().add(parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(array.get(i).getAsJsonObject(), owner));
13072      }
13073    };
13074    if (json.has("description"))
13075      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13076    if (json.has("_description"))
13077      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13078    if (json.has("series"))
13079      res.setSeriesElement(parseString(json.get("series").getAsString()));
13080    if (json.has("_series"))
13081      parseElementProperties(json.getAsJsonObject("_series"), res.getSeriesElement());
13082    Type doseNumber = parseType("doseNumber", json);
13083    if (doseNumber != null)
13084      res.setDoseNumber(doseNumber);
13085    Type seriesDoses = parseType("seriesDoses", json);
13086    if (seriesDoses != null)
13087      res.setSeriesDoses(seriesDoses);
13088    if (json.has("supportingImmunization")) {
13089      JsonArray array = json.getAsJsonArray("supportingImmunization");
13090      for (int i = 0; i < array.size(); i++) {
13091        res.getSupportingImmunization().add(parseReference(array.get(i).getAsJsonObject()));
13092      }
13093    };
13094    if (json.has("supportingPatientInformation")) {
13095      JsonArray array = json.getAsJsonArray("supportingPatientInformation");
13096      for (int i = 0; i < array.size(); i++) {
13097        res.getSupportingPatientInformation().add(parseReference(array.get(i).getAsJsonObject()));
13098      }
13099    };
13100  }
13101
13102  protected ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(JsonObject json, ImmunizationRecommendation owner) throws IOException, FHIRFormatError {
13103    ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res = new ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent();
13104    parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(json, owner, res);
13105    return res;
13106  }
13107
13108  protected void parseImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentProperties(JsonObject json, ImmunizationRecommendation owner, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent res) throws IOException, FHIRFormatError {
13109    parseBackboneElementProperties(json, res);
13110    if (json.has("code"))
13111      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13112    if (json.has("value"))
13113      res.setValueElement(parseDateTime(json.get("value").getAsString()));
13114    if (json.has("_value"))
13115      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
13116  }
13117
13118  protected ImplementationGuide parseImplementationGuide(JsonObject json) throws IOException, FHIRFormatError {
13119    ImplementationGuide res = new ImplementationGuide();
13120    parseImplementationGuideProperties(json, res);
13121    return res;
13122  }
13123
13124  protected void parseImplementationGuideProperties(JsonObject json, ImplementationGuide res) throws IOException, FHIRFormatError {
13125    parseDomainResourceProperties(json, res);
13126    if (json.has("url"))
13127      res.setUrlElement(parseUri(json.get("url").getAsString()));
13128    if (json.has("_url"))
13129      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13130    if (json.has("version"))
13131      res.setVersionElement(parseString(json.get("version").getAsString()));
13132    if (json.has("_version"))
13133      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
13134    if (json.has("name"))
13135      res.setNameElement(parseString(json.get("name").getAsString()));
13136    if (json.has("_name"))
13137      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13138    if (json.has("title"))
13139      res.setTitleElement(parseString(json.get("title").getAsString()));
13140    if (json.has("_title"))
13141      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
13142    if (json.has("status"))
13143      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13144    if (json.has("_status"))
13145      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13146    if (json.has("experimental"))
13147      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
13148    if (json.has("_experimental"))
13149      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
13150    if (json.has("date"))
13151      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13152    if (json.has("_date"))
13153      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13154    if (json.has("publisher"))
13155      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
13156    if (json.has("_publisher"))
13157      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
13158    if (json.has("contact")) {
13159      JsonArray array = json.getAsJsonArray("contact");
13160      for (int i = 0; i < array.size(); i++) {
13161        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
13162      }
13163    };
13164    if (json.has("description"))
13165      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
13166    if (json.has("_description"))
13167      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13168    if (json.has("useContext")) {
13169      JsonArray array = json.getAsJsonArray("useContext");
13170      for (int i = 0; i < array.size(); i++) {
13171        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
13172      }
13173    };
13174    if (json.has("jurisdiction")) {
13175      JsonArray array = json.getAsJsonArray("jurisdiction");
13176      for (int i = 0; i < array.size(); i++) {
13177        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13178      }
13179    };
13180    if (json.has("copyright"))
13181      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
13182    if (json.has("_copyright"))
13183      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
13184    if (json.has("packageId"))
13185      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
13186    if (json.has("_packageId"))
13187      parseElementProperties(json.getAsJsonObject("_packageId"), res.getPackageIdElement());
13188    if (json.has("license"))
13189      res.setLicenseElement(parseEnumeration(json.get("license").getAsString(), ImplementationGuide.SPDXLicense.NULL, new ImplementationGuide.SPDXLicenseEnumFactory()));
13190    if (json.has("_license"))
13191      parseElementProperties(json.getAsJsonObject("_license"), res.getLicenseElement());
13192    if (json.has("fhirVersion"))
13193      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
13194    if (json.has("_fhirVersion"))
13195      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
13196    if (json.has("dependsOn")) {
13197      JsonArray array = json.getAsJsonArray("dependsOn");
13198      for (int i = 0; i < array.size(); i++) {
13199        res.getDependsOn().add(parseImplementationGuideImplementationGuideDependsOnComponent(array.get(i).getAsJsonObject(), res));
13200      }
13201    };
13202    if (json.has("global")) {
13203      JsonArray array = json.getAsJsonArray("global");
13204      for (int i = 0; i < array.size(); i++) {
13205        res.getGlobal().add(parseImplementationGuideImplementationGuideGlobalComponent(array.get(i).getAsJsonObject(), res));
13206      }
13207    };
13208    if (json.has("definition"))
13209      res.setDefinition(parseImplementationGuideImplementationGuideDefinitionComponent(json.getAsJsonObject("definition"), res));
13210    if (json.has("manifest"))
13211      res.setManifest(parseImplementationGuideImplementationGuideManifestComponent(json.getAsJsonObject("manifest"), res));
13212  }
13213
13214  protected ImplementationGuide.ImplementationGuideDependsOnComponent parseImplementationGuideImplementationGuideDependsOnComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13215    ImplementationGuide.ImplementationGuideDependsOnComponent res = new ImplementationGuide.ImplementationGuideDependsOnComponent();
13216    parseImplementationGuideImplementationGuideDependsOnComponentProperties(json, owner, res);
13217    return res;
13218  }
13219
13220  protected void parseImplementationGuideImplementationGuideDependsOnComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDependsOnComponent res) throws IOException, FHIRFormatError {
13221    parseBackboneElementProperties(json, res);
13222    if (json.has("uri"))
13223      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
13224    if (json.has("_uri"))
13225      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
13226    if (json.has("packageId"))
13227      res.setPackageIdElement(parseId(json.get("packageId").getAsString()));
13228    if (json.has("_packageId"))
13229      parseElementProperties(json.getAsJsonObject("_packageId"), res.getPackageIdElement());
13230    if (json.has("version"))
13231      res.setVersionElement(parseString(json.get("version").getAsString()));
13232    if (json.has("_version"))
13233      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
13234  }
13235
13236  protected ImplementationGuide.ImplementationGuideGlobalComponent parseImplementationGuideImplementationGuideGlobalComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13237    ImplementationGuide.ImplementationGuideGlobalComponent res = new ImplementationGuide.ImplementationGuideGlobalComponent();
13238    parseImplementationGuideImplementationGuideGlobalComponentProperties(json, owner, res);
13239    return res;
13240  }
13241
13242  protected void parseImplementationGuideImplementationGuideGlobalComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideGlobalComponent res) throws IOException, FHIRFormatError {
13243    parseBackboneElementProperties(json, res);
13244    if (json.has("type"))
13245      res.setTypeElement(parseCode(json.get("type").getAsString()));
13246    if (json.has("_type"))
13247      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13248    if (json.has("profile"))
13249      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
13250    if (json.has("_profile"))
13251      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
13252  }
13253
13254  protected ImplementationGuide.ImplementationGuideDefinitionComponent parseImplementationGuideImplementationGuideDefinitionComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13255    ImplementationGuide.ImplementationGuideDefinitionComponent res = new ImplementationGuide.ImplementationGuideDefinitionComponent();
13256    parseImplementationGuideImplementationGuideDefinitionComponentProperties(json, owner, res);
13257    return res;
13258  }
13259
13260  protected void parseImplementationGuideImplementationGuideDefinitionComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionComponent res) throws IOException, FHIRFormatError {
13261    parseBackboneElementProperties(json, res);
13262    if (json.has("package")) {
13263      JsonArray array = json.getAsJsonArray("package");
13264      for (int i = 0; i < array.size(); i++) {
13265        res.getPackage().add(parseImplementationGuideImplementationGuideDefinitionPackageComponent(array.get(i).getAsJsonObject(), owner));
13266      }
13267    };
13268    if (json.has("resource")) {
13269      JsonArray array = json.getAsJsonArray("resource");
13270      for (int i = 0; i < array.size(); i++) {
13271        res.getResource().add(parseImplementationGuideImplementationGuideDefinitionResourceComponent(array.get(i).getAsJsonObject(), owner));
13272      }
13273    };
13274    if (json.has("page"))
13275      res.setPage(parseImplementationGuideImplementationGuideDefinitionPageComponent(json.getAsJsonObject("page"), owner));
13276    if (json.has("parameter")) {
13277      JsonArray array = json.getAsJsonArray("parameter");
13278      for (int i = 0; i < array.size(); i++) {
13279        res.getParameter().add(parseImplementationGuideImplementationGuideDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
13280      }
13281    };
13282    if (json.has("template")) {
13283      JsonArray array = json.getAsJsonArray("template");
13284      for (int i = 0; i < array.size(); i++) {
13285        res.getTemplate().add(parseImplementationGuideImplementationGuideDefinitionTemplateComponent(array.get(i).getAsJsonObject(), owner));
13286      }
13287    };
13288  }
13289
13290  protected ImplementationGuide.ImplementationGuideDefinitionPackageComponent parseImplementationGuideImplementationGuideDefinitionPackageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13291    ImplementationGuide.ImplementationGuideDefinitionPackageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPackageComponent();
13292    parseImplementationGuideImplementationGuideDefinitionPackageComponentProperties(json, owner, res);
13293    return res;
13294  }
13295
13296  protected void parseImplementationGuideImplementationGuideDefinitionPackageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPackageComponent res) throws IOException, FHIRFormatError {
13297    parseBackboneElementProperties(json, res);
13298    if (json.has("name"))
13299      res.setNameElement(parseString(json.get("name").getAsString()));
13300    if (json.has("_name"))
13301      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13302    if (json.has("description"))
13303      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13304    if (json.has("_description"))
13305      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13306  }
13307
13308  protected ImplementationGuide.ImplementationGuideDefinitionResourceComponent parseImplementationGuideImplementationGuideDefinitionResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13309    ImplementationGuide.ImplementationGuideDefinitionResourceComponent res = new ImplementationGuide.ImplementationGuideDefinitionResourceComponent();
13310    parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(json, owner, res);
13311    return res;
13312  }
13313
13314  protected void parseImplementationGuideImplementationGuideDefinitionResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionResourceComponent res) throws IOException, FHIRFormatError {
13315    parseBackboneElementProperties(json, res);
13316    if (json.has("reference"))
13317      res.setReference(parseReference(json.getAsJsonObject("reference")));
13318    if (json.has("name"))
13319      res.setNameElement(parseString(json.get("name").getAsString()));
13320    if (json.has("_name"))
13321      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13322    if (json.has("description"))
13323      res.setDescriptionElement(parseString(json.get("description").getAsString()));
13324    if (json.has("_description"))
13325      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
13326    Type example = parseType("example", json);
13327    if (example != null)
13328      res.setExample(example);
13329    if (json.has("package"))
13330      res.setPackageElement(parseId(json.get("package").getAsString()));
13331    if (json.has("_package"))
13332      parseElementProperties(json.getAsJsonObject("_package"), res.getPackageElement());
13333  }
13334
13335  protected ImplementationGuide.ImplementationGuideDefinitionPageComponent parseImplementationGuideImplementationGuideDefinitionPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13336    ImplementationGuide.ImplementationGuideDefinitionPageComponent res = new ImplementationGuide.ImplementationGuideDefinitionPageComponent();
13337    parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(json, owner, res);
13338    return res;
13339  }
13340
13341  protected void parseImplementationGuideImplementationGuideDefinitionPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionPageComponent res) throws IOException, FHIRFormatError {
13342    parseBackboneElementProperties(json, res);
13343    Type name = parseType("name", json);
13344    if (name != null)
13345      res.setName(name);
13346    if (json.has("title"))
13347      res.setTitleElement(parseString(json.get("title").getAsString()));
13348    if (json.has("_title"))
13349      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
13350    if (json.has("generation"))
13351      res.setGenerationElement(parseEnumeration(json.get("generation").getAsString(), ImplementationGuide.GuidePageGeneration.NULL, new ImplementationGuide.GuidePageGenerationEnumFactory()));
13352    if (json.has("_generation"))
13353      parseElementProperties(json.getAsJsonObject("_generation"), res.getGenerationElement());
13354    if (json.has("page")) {
13355      JsonArray array = json.getAsJsonArray("page");
13356      for (int i = 0; i < array.size(); i++) {
13357        res.getPage().add(parseImplementationGuideImplementationGuideDefinitionPageComponent(array.get(i).getAsJsonObject(), owner));
13358      }
13359    };
13360  }
13361
13362  protected ImplementationGuide.ImplementationGuideDefinitionParameterComponent parseImplementationGuideImplementationGuideDefinitionParameterComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13363    ImplementationGuide.ImplementationGuideDefinitionParameterComponent res = new ImplementationGuide.ImplementationGuideDefinitionParameterComponent();
13364    parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(json, owner, res);
13365    return res;
13366  }
13367
13368  protected void parseImplementationGuideImplementationGuideDefinitionParameterComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionParameterComponent res) throws IOException, FHIRFormatError {
13369    parseBackboneElementProperties(json, res);
13370    if (json.has("code"))
13371      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), ImplementationGuide.GuideParameterCode.NULL, new ImplementationGuide.GuideParameterCodeEnumFactory()));
13372    if (json.has("_code"))
13373      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
13374    if (json.has("value"))
13375      res.setValueElement(parseString(json.get("value").getAsString()));
13376    if (json.has("_value"))
13377      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
13378  }
13379
13380  protected ImplementationGuide.ImplementationGuideDefinitionTemplateComponent parseImplementationGuideImplementationGuideDefinitionTemplateComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13381    ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res = new ImplementationGuide.ImplementationGuideDefinitionTemplateComponent();
13382    parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(json, owner, res);
13383    return res;
13384  }
13385
13386  protected void parseImplementationGuideImplementationGuideDefinitionTemplateComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent res) throws IOException, FHIRFormatError {
13387    parseBackboneElementProperties(json, res);
13388    if (json.has("code"))
13389      res.setCodeElement(parseCode(json.get("code").getAsString()));
13390    if (json.has("_code"))
13391      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
13392    if (json.has("source"))
13393      res.setSourceElement(parseString(json.get("source").getAsString()));
13394    if (json.has("_source"))
13395      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
13396    if (json.has("scope"))
13397      res.setScopeElement(parseString(json.get("scope").getAsString()));
13398    if (json.has("_scope"))
13399      parseElementProperties(json.getAsJsonObject("_scope"), res.getScopeElement());
13400  }
13401
13402  protected ImplementationGuide.ImplementationGuideManifestComponent parseImplementationGuideImplementationGuideManifestComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13403    ImplementationGuide.ImplementationGuideManifestComponent res = new ImplementationGuide.ImplementationGuideManifestComponent();
13404    parseImplementationGuideImplementationGuideManifestComponentProperties(json, owner, res);
13405    return res;
13406  }
13407
13408  protected void parseImplementationGuideImplementationGuideManifestComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ImplementationGuideManifestComponent res) throws IOException, FHIRFormatError {
13409    parseBackboneElementProperties(json, res);
13410    if (json.has("rendering"))
13411      res.setRenderingElement(parseUrl(json.get("rendering").getAsString()));
13412    if (json.has("_rendering"))
13413      parseElementProperties(json.getAsJsonObject("_rendering"), res.getRenderingElement());
13414    if (json.has("resource")) {
13415      JsonArray array = json.getAsJsonArray("resource");
13416      for (int i = 0; i < array.size(); i++) {
13417        res.getResource().add(parseImplementationGuideManifestResourceComponent(array.get(i).getAsJsonObject(), owner));
13418      }
13419    };
13420    if (json.has("page")) {
13421      JsonArray array = json.getAsJsonArray("page");
13422      for (int i = 0; i < array.size(); i++) {
13423        res.getPage().add(parseImplementationGuideManifestPageComponent(array.get(i).getAsJsonObject(), owner));
13424      }
13425    };
13426    if (json.has("image")) {
13427      JsonArray array = json.getAsJsonArray("image");
13428      for (int i = 0; i < array.size(); i++) {
13429        res.getImage().add(parseString(array.get(i).getAsString()));
13430      }
13431    };
13432    if (json.has("_image")) {
13433      JsonArray array = json.getAsJsonArray("_image");
13434      for (int i = 0; i < array.size(); i++) {
13435        if (i == res.getImage().size())
13436          res.getImage().add(parseString(null));
13437        if (array.get(i) instanceof JsonObject) 
13438          parseElementProperties(array.get(i).getAsJsonObject(), res.getImage().get(i));
13439      }
13440    };
13441    if (json.has("other")) {
13442      JsonArray array = json.getAsJsonArray("other");
13443      for (int i = 0; i < array.size(); i++) {
13444        res.getOther().add(parseString(array.get(i).getAsString()));
13445      }
13446    };
13447    if (json.has("_other")) {
13448      JsonArray array = json.getAsJsonArray("_other");
13449      for (int i = 0; i < array.size(); i++) {
13450        if (i == res.getOther().size())
13451          res.getOther().add(parseString(null));
13452        if (array.get(i) instanceof JsonObject) 
13453          parseElementProperties(array.get(i).getAsJsonObject(), res.getOther().get(i));
13454      }
13455    };
13456  }
13457
13458  protected ImplementationGuide.ManifestResourceComponent parseImplementationGuideManifestResourceComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13459    ImplementationGuide.ManifestResourceComponent res = new ImplementationGuide.ManifestResourceComponent();
13460    parseImplementationGuideManifestResourceComponentProperties(json, owner, res);
13461    return res;
13462  }
13463
13464  protected void parseImplementationGuideManifestResourceComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestResourceComponent res) throws IOException, FHIRFormatError {
13465    parseBackboneElementProperties(json, res);
13466    if (json.has("reference"))
13467      res.setReference(parseReference(json.getAsJsonObject("reference")));
13468    Type example = parseType("example", json);
13469    if (example != null)
13470      res.setExample(example);
13471    if (json.has("relativePath"))
13472      res.setRelativePathElement(parseUrl(json.get("relativePath").getAsString()));
13473    if (json.has("_relativePath"))
13474      parseElementProperties(json.getAsJsonObject("_relativePath"), res.getRelativePathElement());
13475  }
13476
13477  protected ImplementationGuide.ManifestPageComponent parseImplementationGuideManifestPageComponent(JsonObject json, ImplementationGuide owner) throws IOException, FHIRFormatError {
13478    ImplementationGuide.ManifestPageComponent res = new ImplementationGuide.ManifestPageComponent();
13479    parseImplementationGuideManifestPageComponentProperties(json, owner, res);
13480    return res;
13481  }
13482
13483  protected void parseImplementationGuideManifestPageComponentProperties(JsonObject json, ImplementationGuide owner, ImplementationGuide.ManifestPageComponent res) throws IOException, FHIRFormatError {
13484    parseBackboneElementProperties(json, res);
13485    if (json.has("name"))
13486      res.setNameElement(parseString(json.get("name").getAsString()));
13487    if (json.has("_name"))
13488      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13489    if (json.has("title"))
13490      res.setTitleElement(parseString(json.get("title").getAsString()));
13491    if (json.has("_title"))
13492      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
13493    if (json.has("anchor")) {
13494      JsonArray array = json.getAsJsonArray("anchor");
13495      for (int i = 0; i < array.size(); i++) {
13496        res.getAnchor().add(parseString(array.get(i).getAsString()));
13497      }
13498    };
13499    if (json.has("_anchor")) {
13500      JsonArray array = json.getAsJsonArray("_anchor");
13501      for (int i = 0; i < array.size(); i++) {
13502        if (i == res.getAnchor().size())
13503          res.getAnchor().add(parseString(null));
13504        if (array.get(i) instanceof JsonObject) 
13505          parseElementProperties(array.get(i).getAsJsonObject(), res.getAnchor().get(i));
13506      }
13507    };
13508  }
13509
13510  protected InsurancePlan parseInsurancePlan(JsonObject json) throws IOException, FHIRFormatError {
13511    InsurancePlan res = new InsurancePlan();
13512    parseInsurancePlanProperties(json, res);
13513    return res;
13514  }
13515
13516  protected void parseInsurancePlanProperties(JsonObject json, InsurancePlan res) throws IOException, FHIRFormatError {
13517    parseDomainResourceProperties(json, res);
13518    if (json.has("identifier")) {
13519      JsonArray array = json.getAsJsonArray("identifier");
13520      for (int i = 0; i < array.size(); i++) {
13521        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13522      }
13523    };
13524    if (json.has("status"))
13525      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
13526    if (json.has("_status"))
13527      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13528    if (json.has("type")) {
13529      JsonArray array = json.getAsJsonArray("type");
13530      for (int i = 0; i < array.size(); i++) {
13531        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13532      }
13533    };
13534    if (json.has("name"))
13535      res.setNameElement(parseString(json.get("name").getAsString()));
13536    if (json.has("_name"))
13537      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
13538    if (json.has("alias")) {
13539      JsonArray array = json.getAsJsonArray("alias");
13540      for (int i = 0; i < array.size(); i++) {
13541        res.getAlias().add(parseString(array.get(i).getAsString()));
13542      }
13543    };
13544    if (json.has("_alias")) {
13545      JsonArray array = json.getAsJsonArray("_alias");
13546      for (int i = 0; i < array.size(); i++) {
13547        if (i == res.getAlias().size())
13548          res.getAlias().add(parseString(null));
13549        if (array.get(i) instanceof JsonObject) 
13550          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
13551      }
13552    };
13553    if (json.has("period"))
13554      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
13555    if (json.has("ownedBy"))
13556      res.setOwnedBy(parseReference(json.getAsJsonObject("ownedBy")));
13557    if (json.has("administeredBy"))
13558      res.setAdministeredBy(parseReference(json.getAsJsonObject("administeredBy")));
13559    if (json.has("coverageArea")) {
13560      JsonArray array = json.getAsJsonArray("coverageArea");
13561      for (int i = 0; i < array.size(); i++) {
13562        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
13563      }
13564    };
13565    if (json.has("contact")) {
13566      JsonArray array = json.getAsJsonArray("contact");
13567      for (int i = 0; i < array.size(); i++) {
13568        res.getContact().add(parseInsurancePlanInsurancePlanContactComponent(array.get(i).getAsJsonObject(), res));
13569      }
13570    };
13571    if (json.has("endpoint")) {
13572      JsonArray array = json.getAsJsonArray("endpoint");
13573      for (int i = 0; i < array.size(); i++) {
13574        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
13575      }
13576    };
13577    if (json.has("network")) {
13578      JsonArray array = json.getAsJsonArray("network");
13579      for (int i = 0; i < array.size(); i++) {
13580        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
13581      }
13582    };
13583    if (json.has("coverage")) {
13584      JsonArray array = json.getAsJsonArray("coverage");
13585      for (int i = 0; i < array.size(); i++) {
13586        res.getCoverage().add(parseInsurancePlanInsurancePlanCoverageComponent(array.get(i).getAsJsonObject(), res));
13587      }
13588    };
13589    if (json.has("plan")) {
13590      JsonArray array = json.getAsJsonArray("plan");
13591      for (int i = 0; i < array.size(); i++) {
13592        res.getPlan().add(parseInsurancePlanInsurancePlanPlanComponent(array.get(i).getAsJsonObject(), res));
13593      }
13594    };
13595  }
13596
13597  protected InsurancePlan.InsurancePlanContactComponent parseInsurancePlanInsurancePlanContactComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
13598    InsurancePlan.InsurancePlanContactComponent res = new InsurancePlan.InsurancePlanContactComponent();
13599    parseInsurancePlanInsurancePlanContactComponentProperties(json, owner, res);
13600    return res;
13601  }
13602
13603  protected void parseInsurancePlanInsurancePlanContactComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanContactComponent res) throws IOException, FHIRFormatError {
13604    parseBackboneElementProperties(json, res);
13605    if (json.has("purpose"))
13606      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
13607    if (json.has("name"))
13608      res.setName(parseHumanName(json.getAsJsonObject("name")));
13609    if (json.has("telecom")) {
13610      JsonArray array = json.getAsJsonArray("telecom");
13611      for (int i = 0; i < array.size(); i++) {
13612        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
13613      }
13614    };
13615    if (json.has("address"))
13616      res.setAddress(parseAddress(json.getAsJsonObject("address")));
13617  }
13618
13619  protected InsurancePlan.InsurancePlanCoverageComponent parseInsurancePlanInsurancePlanCoverageComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
13620    InsurancePlan.InsurancePlanCoverageComponent res = new InsurancePlan.InsurancePlanCoverageComponent();
13621    parseInsurancePlanInsurancePlanCoverageComponentProperties(json, owner, res);
13622    return res;
13623  }
13624
13625  protected void parseInsurancePlanInsurancePlanCoverageComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanCoverageComponent res) throws IOException, FHIRFormatError {
13626    parseBackboneElementProperties(json, res);
13627    if (json.has("type"))
13628      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13629    if (json.has("network")) {
13630      JsonArray array = json.getAsJsonArray("network");
13631      for (int i = 0; i < array.size(); i++) {
13632        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
13633      }
13634    };
13635    if (json.has("benefit")) {
13636      JsonArray array = json.getAsJsonArray("benefit");
13637      for (int i = 0; i < array.size(); i++) {
13638        res.getBenefit().add(parseInsurancePlanCoverageBenefitComponent(array.get(i).getAsJsonObject(), owner));
13639      }
13640    };
13641  }
13642
13643  protected InsurancePlan.CoverageBenefitComponent parseInsurancePlanCoverageBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
13644    InsurancePlan.CoverageBenefitComponent res = new InsurancePlan.CoverageBenefitComponent();
13645    parseInsurancePlanCoverageBenefitComponentProperties(json, owner, res);
13646    return res;
13647  }
13648
13649  protected void parseInsurancePlanCoverageBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitComponent res) throws IOException, FHIRFormatError {
13650    parseBackboneElementProperties(json, res);
13651    if (json.has("type"))
13652      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13653    if (json.has("requirement"))
13654      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
13655    if (json.has("_requirement"))
13656      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
13657    if (json.has("limit")) {
13658      JsonArray array = json.getAsJsonArray("limit");
13659      for (int i = 0; i < array.size(); i++) {
13660        res.getLimit().add(parseInsurancePlanCoverageBenefitLimitComponent(array.get(i).getAsJsonObject(), owner));
13661      }
13662    };
13663  }
13664
13665  protected InsurancePlan.CoverageBenefitLimitComponent parseInsurancePlanCoverageBenefitLimitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
13666    InsurancePlan.CoverageBenefitLimitComponent res = new InsurancePlan.CoverageBenefitLimitComponent();
13667    parseInsurancePlanCoverageBenefitLimitComponentProperties(json, owner, res);
13668    return res;
13669  }
13670
13671  protected void parseInsurancePlanCoverageBenefitLimitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.CoverageBenefitLimitComponent res) throws IOException, FHIRFormatError {
13672    parseBackboneElementProperties(json, res);
13673    if (json.has("value"))
13674      res.setValue(parseQuantity(json.getAsJsonObject("value")));
13675    if (json.has("code"))
13676      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13677  }
13678
13679  protected InsurancePlan.InsurancePlanPlanComponent parseInsurancePlanInsurancePlanPlanComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
13680    InsurancePlan.InsurancePlanPlanComponent res = new InsurancePlan.InsurancePlanPlanComponent();
13681    parseInsurancePlanInsurancePlanPlanComponentProperties(json, owner, res);
13682    return res;
13683  }
13684
13685  protected void parseInsurancePlanInsurancePlanPlanComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanComponent res) throws IOException, FHIRFormatError {
13686    parseBackboneElementProperties(json, res);
13687    if (json.has("identifier")) {
13688      JsonArray array = json.getAsJsonArray("identifier");
13689      for (int i = 0; i < array.size(); i++) {
13690        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13691      }
13692    };
13693    if (json.has("type"))
13694      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13695    if (json.has("coverageArea")) {
13696      JsonArray array = json.getAsJsonArray("coverageArea");
13697      for (int i = 0; i < array.size(); i++) {
13698        res.getCoverageArea().add(parseReference(array.get(i).getAsJsonObject()));
13699      }
13700    };
13701    if (json.has("network")) {
13702      JsonArray array = json.getAsJsonArray("network");
13703      for (int i = 0; i < array.size(); i++) {
13704        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
13705      }
13706    };
13707    if (json.has("generalCost")) {
13708      JsonArray array = json.getAsJsonArray("generalCost");
13709      for (int i = 0; i < array.size(); i++) {
13710        res.getGeneralCost().add(parseInsurancePlanInsurancePlanPlanGeneralCostComponent(array.get(i).getAsJsonObject(), owner));
13711      }
13712    };
13713    if (json.has("specificCost")) {
13714      JsonArray array = json.getAsJsonArray("specificCost");
13715      for (int i = 0; i < array.size(); i++) {
13716        res.getSpecificCost().add(parseInsurancePlanInsurancePlanPlanSpecificCostComponent(array.get(i).getAsJsonObject(), owner));
13717      }
13718    };
13719  }
13720
13721  protected InsurancePlan.InsurancePlanPlanGeneralCostComponent parseInsurancePlanInsurancePlanPlanGeneralCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
13722    InsurancePlan.InsurancePlanPlanGeneralCostComponent res = new InsurancePlan.InsurancePlanPlanGeneralCostComponent();
13723    parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(json, owner, res);
13724    return res;
13725  }
13726
13727  protected void parseInsurancePlanInsurancePlanPlanGeneralCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanGeneralCostComponent res) throws IOException, FHIRFormatError {
13728    parseBackboneElementProperties(json, res);
13729    if (json.has("type"))
13730      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13731    if (json.has("groupSize"))
13732      res.setGroupSizeElement(parsePositiveInt(json.get("groupSize").getAsString()));
13733    if (json.has("_groupSize"))
13734      parseElementProperties(json.getAsJsonObject("_groupSize"), res.getGroupSizeElement());
13735    if (json.has("cost"))
13736      res.setCost(parseMoney(json.getAsJsonObject("cost")));
13737    if (json.has("comment"))
13738      res.setCommentElement(parseString(json.get("comment").getAsString()));
13739    if (json.has("_comment"))
13740      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
13741  }
13742
13743  protected InsurancePlan.InsurancePlanPlanSpecificCostComponent parseInsurancePlanInsurancePlanPlanSpecificCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
13744    InsurancePlan.InsurancePlanPlanSpecificCostComponent res = new InsurancePlan.InsurancePlanPlanSpecificCostComponent();
13745    parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(json, owner, res);
13746    return res;
13747  }
13748
13749  protected void parseInsurancePlanInsurancePlanPlanSpecificCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.InsurancePlanPlanSpecificCostComponent res) throws IOException, FHIRFormatError {
13750    parseBackboneElementProperties(json, res);
13751    if (json.has("category"))
13752      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
13753    if (json.has("benefit")) {
13754      JsonArray array = json.getAsJsonArray("benefit");
13755      for (int i = 0; i < array.size(); i++) {
13756        res.getBenefit().add(parseInsurancePlanPlanBenefitComponent(array.get(i).getAsJsonObject(), owner));
13757      }
13758    };
13759  }
13760
13761  protected InsurancePlan.PlanBenefitComponent parseInsurancePlanPlanBenefitComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
13762    InsurancePlan.PlanBenefitComponent res = new InsurancePlan.PlanBenefitComponent();
13763    parseInsurancePlanPlanBenefitComponentProperties(json, owner, res);
13764    return res;
13765  }
13766
13767  protected void parseInsurancePlanPlanBenefitComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitComponent res) throws IOException, FHIRFormatError {
13768    parseBackboneElementProperties(json, res);
13769    if (json.has("type"))
13770      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13771    if (json.has("cost")) {
13772      JsonArray array = json.getAsJsonArray("cost");
13773      for (int i = 0; i < array.size(); i++) {
13774        res.getCost().add(parseInsurancePlanPlanBenefitCostComponent(array.get(i).getAsJsonObject(), owner));
13775      }
13776    };
13777  }
13778
13779  protected InsurancePlan.PlanBenefitCostComponent parseInsurancePlanPlanBenefitCostComponent(JsonObject json, InsurancePlan owner) throws IOException, FHIRFormatError {
13780    InsurancePlan.PlanBenefitCostComponent res = new InsurancePlan.PlanBenefitCostComponent();
13781    parseInsurancePlanPlanBenefitCostComponentProperties(json, owner, res);
13782    return res;
13783  }
13784
13785  protected void parseInsurancePlanPlanBenefitCostComponentProperties(JsonObject json, InsurancePlan owner, InsurancePlan.PlanBenefitCostComponent res) throws IOException, FHIRFormatError {
13786    parseBackboneElementProperties(json, res);
13787    if (json.has("type"))
13788      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13789    if (json.has("applicability"))
13790      res.setApplicability(parseCodeableConcept(json.getAsJsonObject("applicability")));
13791    if (json.has("qualifiers")) {
13792      JsonArray array = json.getAsJsonArray("qualifiers");
13793      for (int i = 0; i < array.size(); i++) {
13794        res.getQualifiers().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
13795      }
13796    };
13797    if (json.has("value"))
13798      res.setValue(parseQuantity(json.getAsJsonObject("value")));
13799  }
13800
13801  protected Invoice parseInvoice(JsonObject json) throws IOException, FHIRFormatError {
13802    Invoice res = new Invoice();
13803    parseInvoiceProperties(json, res);
13804    return res;
13805  }
13806
13807  protected void parseInvoiceProperties(JsonObject json, Invoice res) throws IOException, FHIRFormatError {
13808    parseDomainResourceProperties(json, res);
13809    if (json.has("identifier")) {
13810      JsonArray array = json.getAsJsonArray("identifier");
13811      for (int i = 0; i < array.size(); i++) {
13812        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13813      }
13814    };
13815    if (json.has("status"))
13816      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Invoice.InvoiceStatus.NULL, new Invoice.InvoiceStatusEnumFactory()));
13817    if (json.has("_status"))
13818      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
13819    if (json.has("cancelledReason"))
13820      res.setCancelledReasonElement(parseString(json.get("cancelledReason").getAsString()));
13821    if (json.has("_cancelledReason"))
13822      parseElementProperties(json.getAsJsonObject("_cancelledReason"), res.getCancelledReasonElement());
13823    if (json.has("type"))
13824      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
13825    if (json.has("subject"))
13826      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13827    if (json.has("recipient"))
13828      res.setRecipient(parseReference(json.getAsJsonObject("recipient")));
13829    if (json.has("date"))
13830      res.setDateElement(parseDateTime(json.get("date").getAsString()));
13831    if (json.has("_date"))
13832      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
13833    if (json.has("participant")) {
13834      JsonArray array = json.getAsJsonArray("participant");
13835      for (int i = 0; i < array.size(); i++) {
13836        res.getParticipant().add(parseInvoiceInvoiceParticipantComponent(array.get(i).getAsJsonObject(), res));
13837      }
13838    };
13839    if (json.has("issuer"))
13840      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
13841    if (json.has("account"))
13842      res.setAccount(parseReference(json.getAsJsonObject("account")));
13843    if (json.has("lineItem")) {
13844      JsonArray array = json.getAsJsonArray("lineItem");
13845      for (int i = 0; i < array.size(); i++) {
13846        res.getLineItem().add(parseInvoiceInvoiceLineItemComponent(array.get(i).getAsJsonObject(), res));
13847      }
13848    };
13849    if (json.has("totalPriceComponent")) {
13850      JsonArray array = json.getAsJsonArray("totalPriceComponent");
13851      for (int i = 0; i < array.size(); i++) {
13852        res.getTotalPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), res));
13853      }
13854    };
13855    if (json.has("totalNet"))
13856      res.setTotalNet(parseMoney(json.getAsJsonObject("totalNet")));
13857    if (json.has("totalGross"))
13858      res.setTotalGross(parseMoney(json.getAsJsonObject("totalGross")));
13859    if (json.has("paymentTerms"))
13860      res.setPaymentTermsElement(parseMarkdown(json.get("paymentTerms").getAsString()));
13861    if (json.has("_paymentTerms"))
13862      parseElementProperties(json.getAsJsonObject("_paymentTerms"), res.getPaymentTermsElement());
13863    if (json.has("note")) {
13864      JsonArray array = json.getAsJsonArray("note");
13865      for (int i = 0; i < array.size(); i++) {
13866        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
13867      }
13868    };
13869  }
13870
13871  protected Invoice.InvoiceParticipantComponent parseInvoiceInvoiceParticipantComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
13872    Invoice.InvoiceParticipantComponent res = new Invoice.InvoiceParticipantComponent();
13873    parseInvoiceInvoiceParticipantComponentProperties(json, owner, res);
13874    return res;
13875  }
13876
13877  protected void parseInvoiceInvoiceParticipantComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceParticipantComponent res) throws IOException, FHIRFormatError {
13878    parseBackboneElementProperties(json, res);
13879    if (json.has("role"))
13880      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
13881    if (json.has("actor"))
13882      res.setActor(parseReference(json.getAsJsonObject("actor")));
13883  }
13884
13885  protected Invoice.InvoiceLineItemComponent parseInvoiceInvoiceLineItemComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
13886    Invoice.InvoiceLineItemComponent res = new Invoice.InvoiceLineItemComponent();
13887    parseInvoiceInvoiceLineItemComponentProperties(json, owner, res);
13888    return res;
13889  }
13890
13891  protected void parseInvoiceInvoiceLineItemComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemComponent res) throws IOException, FHIRFormatError {
13892    parseBackboneElementProperties(json, res);
13893    if (json.has("sequence"))
13894      res.setSequenceElement(parsePositiveInt(json.get("sequence").getAsString()));
13895    if (json.has("_sequence"))
13896      parseElementProperties(json.getAsJsonObject("_sequence"), res.getSequenceElement());
13897    Type chargeItem = parseType("chargeItem", json);
13898    if (chargeItem != null)
13899      res.setChargeItem(chargeItem);
13900    if (json.has("priceComponent")) {
13901      JsonArray array = json.getAsJsonArray("priceComponent");
13902      for (int i = 0; i < array.size(); i++) {
13903        res.getPriceComponent().add(parseInvoiceInvoiceLineItemPriceComponentComponent(array.get(i).getAsJsonObject(), owner));
13904      }
13905    };
13906  }
13907
13908  protected Invoice.InvoiceLineItemPriceComponentComponent parseInvoiceInvoiceLineItemPriceComponentComponent(JsonObject json, Invoice owner) throws IOException, FHIRFormatError {
13909    Invoice.InvoiceLineItemPriceComponentComponent res = new Invoice.InvoiceLineItemPriceComponentComponent();
13910    parseInvoiceInvoiceLineItemPriceComponentComponentProperties(json, owner, res);
13911    return res;
13912  }
13913
13914  protected void parseInvoiceInvoiceLineItemPriceComponentComponentProperties(JsonObject json, Invoice owner, Invoice.InvoiceLineItemPriceComponentComponent res) throws IOException, FHIRFormatError {
13915    parseBackboneElementProperties(json, res);
13916    if (json.has("type"))
13917      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Invoice.InvoicePriceComponentType.NULL, new Invoice.InvoicePriceComponentTypeEnumFactory()));
13918    if (json.has("_type"))
13919      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
13920    if (json.has("code"))
13921      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
13922    if (json.has("factor"))
13923      res.setFactorElement(parseDecimal(json.get("factor").getAsBigDecimal()));
13924    if (json.has("_factor"))
13925      parseElementProperties(json.getAsJsonObject("_factor"), res.getFactorElement());
13926    if (json.has("amount"))
13927      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
13928  }
13929
13930  protected ItemInstance parseItemInstance(JsonObject json) throws IOException, FHIRFormatError {
13931    ItemInstance res = new ItemInstance();
13932    parseItemInstanceProperties(json, res);
13933    return res;
13934  }
13935
13936  protected void parseItemInstanceProperties(JsonObject json, ItemInstance res) throws IOException, FHIRFormatError {
13937    parseDomainResourceProperties(json, res);
13938    if (json.has("count"))
13939      res.setCountElement(parseInteger(json.get("count").getAsLong()));
13940    if (json.has("_count"))
13941      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
13942    if (json.has("location"))
13943      res.setLocation(parseReference(json.getAsJsonObject("location")));
13944    if (json.has("subject"))
13945      res.setSubject(parseReference(json.getAsJsonObject("subject")));
13946    if (json.has("manufactureDate"))
13947      res.setManufactureDateElement(parseDateTime(json.get("manufactureDate").getAsString()));
13948    if (json.has("_manufactureDate"))
13949      parseElementProperties(json.getAsJsonObject("_manufactureDate"), res.getManufactureDateElement());
13950    if (json.has("expiryDate"))
13951      res.setExpiryDateElement(parseDateTime(json.get("expiryDate").getAsString()));
13952    if (json.has("_expiryDate"))
13953      parseElementProperties(json.getAsJsonObject("_expiryDate"), res.getExpiryDateElement());
13954    if (json.has("currentSWVersion"))
13955      res.setCurrentSWVersionElement(parseString(json.get("currentSWVersion").getAsString()));
13956    if (json.has("_currentSWVersion"))
13957      parseElementProperties(json.getAsJsonObject("_currentSWVersion"), res.getCurrentSWVersionElement());
13958    if (json.has("lotNumber"))
13959      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
13960    if (json.has("_lotNumber"))
13961      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
13962    if (json.has("serialNumber"))
13963      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
13964    if (json.has("_serialNumber"))
13965      parseElementProperties(json.getAsJsonObject("_serialNumber"), res.getSerialNumberElement());
13966    if (json.has("carrierAIDC"))
13967      res.setCarrierAIDCElement(parseString(json.get("carrierAIDC").getAsString()));
13968    if (json.has("_carrierAIDC"))
13969      parseElementProperties(json.getAsJsonObject("_carrierAIDC"), res.getCarrierAIDCElement());
13970    if (json.has("carrierHRF"))
13971      res.setCarrierHRFElement(parseString(json.get("carrierHRF").getAsString()));
13972    if (json.has("_carrierHRF"))
13973      parseElementProperties(json.getAsJsonObject("_carrierHRF"), res.getCarrierHRFElement());
13974  }
13975
13976  protected Library parseLibrary(JsonObject json) throws IOException, FHIRFormatError {
13977    Library res = new Library();
13978    parseLibraryProperties(json, res);
13979    return res;
13980  }
13981
13982  protected void parseLibraryProperties(JsonObject json, Library res) throws IOException, FHIRFormatError {
13983    parseDomainResourceProperties(json, res);
13984    if (json.has("url"))
13985      res.setUrlElement(parseUri(json.get("url").getAsString()));
13986    if (json.has("_url"))
13987      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
13988    if (json.has("identifier")) {
13989      JsonArray array = json.getAsJsonArray("identifier");
13990      for (int i = 0; i < array.size(); i++) {
13991        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
13992      }
13993    };
13994    if (json.has("version"))
13995      res.setVersionElement(parseString(json.get("version").getAsString()));
13996    if (json.has("_version"))
13997      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
13998    if (json.has("name"))
13999      res.setNameElement(parseString(json.get("name").getAsString()));
14000    if (json.has("_name"))
14001      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14002    if (json.has("title"))
14003      res.setTitleElement(parseString(json.get("title").getAsString()));
14004    if (json.has("_title"))
14005      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14006    if (json.has("subtitle"))
14007      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
14008    if (json.has("_subtitle"))
14009      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
14010    if (json.has("status"))
14011      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14012    if (json.has("_status"))
14013      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14014    if (json.has("experimental"))
14015      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14016    if (json.has("_experimental"))
14017      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
14018    if (json.has("type"))
14019      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14020    Type subject = parseType("subject", json);
14021    if (subject != null)
14022      res.setSubject(subject);
14023    if (json.has("date"))
14024      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14025    if (json.has("_date"))
14026      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14027    if (json.has("publisher"))
14028      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14029    if (json.has("_publisher"))
14030      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
14031    if (json.has("contact")) {
14032      JsonArray array = json.getAsJsonArray("contact");
14033      for (int i = 0; i < array.size(); i++) {
14034        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14035      }
14036    };
14037    if (json.has("description"))
14038      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14039    if (json.has("_description"))
14040      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14041    if (json.has("useContext")) {
14042      JsonArray array = json.getAsJsonArray("useContext");
14043      for (int i = 0; i < array.size(); i++) {
14044        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14045      }
14046    };
14047    if (json.has("jurisdiction")) {
14048      JsonArray array = json.getAsJsonArray("jurisdiction");
14049      for (int i = 0; i < array.size(); i++) {
14050        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14051      }
14052    };
14053    if (json.has("purpose"))
14054      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14055    if (json.has("_purpose"))
14056      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
14057    if (json.has("usage"))
14058      res.setUsageElement(parseString(json.get("usage").getAsString()));
14059    if (json.has("_usage"))
14060      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
14061    if (json.has("copyright"))
14062      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14063    if (json.has("_copyright"))
14064      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
14065    if (json.has("approvalDate"))
14066      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
14067    if (json.has("_approvalDate"))
14068      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
14069    if (json.has("lastReviewDate"))
14070      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
14071    if (json.has("_lastReviewDate"))
14072      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
14073    if (json.has("effectivePeriod"))
14074      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
14075    if (json.has("topic")) {
14076      JsonArray array = json.getAsJsonArray("topic");
14077      for (int i = 0; i < array.size(); i++) {
14078        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14079      }
14080    };
14081    if (json.has("author")) {
14082      JsonArray array = json.getAsJsonArray("author");
14083      for (int i = 0; i < array.size(); i++) {
14084        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14085      }
14086    };
14087    if (json.has("editor")) {
14088      JsonArray array = json.getAsJsonArray("editor");
14089      for (int i = 0; i < array.size(); i++) {
14090        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14091      }
14092    };
14093    if (json.has("reviewer")) {
14094      JsonArray array = json.getAsJsonArray("reviewer");
14095      for (int i = 0; i < array.size(); i++) {
14096        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
14097      }
14098    };
14099    if (json.has("endorser")) {
14100      JsonArray array = json.getAsJsonArray("endorser");
14101      for (int i = 0; i < array.size(); i++) {
14102        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
14103      }
14104    };
14105    if (json.has("relatedArtifact")) {
14106      JsonArray array = json.getAsJsonArray("relatedArtifact");
14107      for (int i = 0; i < array.size(); i++) {
14108        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14109      }
14110    };
14111    if (json.has("parameter")) {
14112      JsonArray array = json.getAsJsonArray("parameter");
14113      for (int i = 0; i < array.size(); i++) {
14114        res.getParameter().add(parseParameterDefinition(array.get(i).getAsJsonObject()));
14115      }
14116    };
14117    if (json.has("dataRequirement")) {
14118      JsonArray array = json.getAsJsonArray("dataRequirement");
14119      for (int i = 0; i < array.size(); i++) {
14120        res.getDataRequirement().add(parseDataRequirement(array.get(i).getAsJsonObject()));
14121      }
14122    };
14123    if (json.has("content")) {
14124      JsonArray array = json.getAsJsonArray("content");
14125      for (int i = 0; i < array.size(); i++) {
14126        res.getContent().add(parseAttachment(array.get(i).getAsJsonObject()));
14127      }
14128    };
14129  }
14130
14131  protected Linkage parseLinkage(JsonObject json) throws IOException, FHIRFormatError {
14132    Linkage res = new Linkage();
14133    parseLinkageProperties(json, res);
14134    return res;
14135  }
14136
14137  protected void parseLinkageProperties(JsonObject json, Linkage res) throws IOException, FHIRFormatError {
14138    parseDomainResourceProperties(json, res);
14139    if (json.has("active"))
14140      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
14141    if (json.has("_active"))
14142      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
14143    if (json.has("author"))
14144      res.setAuthor(parseReference(json.getAsJsonObject("author")));
14145    if (json.has("item")) {
14146      JsonArray array = json.getAsJsonArray("item");
14147      for (int i = 0; i < array.size(); i++) {
14148        res.getItem().add(parseLinkageLinkageItemComponent(array.get(i).getAsJsonObject(), res));
14149      }
14150    };
14151  }
14152
14153  protected Linkage.LinkageItemComponent parseLinkageLinkageItemComponent(JsonObject json, Linkage owner) throws IOException, FHIRFormatError {
14154    Linkage.LinkageItemComponent res = new Linkage.LinkageItemComponent();
14155    parseLinkageLinkageItemComponentProperties(json, owner, res);
14156    return res;
14157  }
14158
14159  protected void parseLinkageLinkageItemComponentProperties(JsonObject json, Linkage owner, Linkage.LinkageItemComponent res) throws IOException, FHIRFormatError {
14160    parseBackboneElementProperties(json, res);
14161    if (json.has("type"))
14162      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Linkage.LinkageType.NULL, new Linkage.LinkageTypeEnumFactory()));
14163    if (json.has("_type"))
14164      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14165    if (json.has("resource"))
14166      res.setResource(parseReference(json.getAsJsonObject("resource")));
14167  }
14168
14169  protected ListResource parseListResource(JsonObject json) throws IOException, FHIRFormatError {
14170    ListResource res = new ListResource();
14171    parseListResourceProperties(json, res);
14172    return res;
14173  }
14174
14175  protected void parseListResourceProperties(JsonObject json, ListResource res) throws IOException, FHIRFormatError {
14176    parseDomainResourceProperties(json, res);
14177    if (json.has("identifier")) {
14178      JsonArray array = json.getAsJsonArray("identifier");
14179      for (int i = 0; i < array.size(); i++) {
14180        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14181      }
14182    };
14183    if (json.has("status"))
14184      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ListResource.ListStatus.NULL, new ListResource.ListStatusEnumFactory()));
14185    if (json.has("_status"))
14186      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14187    if (json.has("mode"))
14188      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), ListResource.ListMode.NULL, new ListResource.ListModeEnumFactory()));
14189    if (json.has("_mode"))
14190      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
14191    if (json.has("title"))
14192      res.setTitleElement(parseString(json.get("title").getAsString()));
14193    if (json.has("_title"))
14194      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14195    if (json.has("code"))
14196      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14197    if (json.has("subject"))
14198      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14199    if (json.has("encounter"))
14200      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
14201    if (json.has("date"))
14202      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14203    if (json.has("_date"))
14204      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14205    if (json.has("source"))
14206      res.setSource(parseReference(json.getAsJsonObject("source")));
14207    if (json.has("orderedBy"))
14208      res.setOrderedBy(parseCodeableConcept(json.getAsJsonObject("orderedBy")));
14209    if (json.has("note")) {
14210      JsonArray array = json.getAsJsonArray("note");
14211      for (int i = 0; i < array.size(); i++) {
14212        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14213      }
14214    };
14215    if (json.has("entry")) {
14216      JsonArray array = json.getAsJsonArray("entry");
14217      for (int i = 0; i < array.size(); i++) {
14218        res.getEntry().add(parseListResourceListEntryComponent(array.get(i).getAsJsonObject(), res));
14219      }
14220    };
14221    if (json.has("emptyReason"))
14222      res.setEmptyReason(parseCodeableConcept(json.getAsJsonObject("emptyReason")));
14223  }
14224
14225  protected ListResource.ListEntryComponent parseListResourceListEntryComponent(JsonObject json, ListResource owner) throws IOException, FHIRFormatError {
14226    ListResource.ListEntryComponent res = new ListResource.ListEntryComponent();
14227    parseListResourceListEntryComponentProperties(json, owner, res);
14228    return res;
14229  }
14230
14231  protected void parseListResourceListEntryComponentProperties(JsonObject json, ListResource owner, ListResource.ListEntryComponent res) throws IOException, FHIRFormatError {
14232    parseBackboneElementProperties(json, res);
14233    if (json.has("flag"))
14234      res.setFlag(parseCodeableConcept(json.getAsJsonObject("flag")));
14235    if (json.has("deleted"))
14236      res.setDeletedElement(parseBoolean(json.get("deleted").getAsBoolean()));
14237    if (json.has("_deleted"))
14238      parseElementProperties(json.getAsJsonObject("_deleted"), res.getDeletedElement());
14239    if (json.has("date"))
14240      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14241    if (json.has("_date"))
14242      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14243    if (json.has("item"))
14244      res.setItem(parseReference(json.getAsJsonObject("item")));
14245  }
14246
14247  protected Location parseLocation(JsonObject json) throws IOException, FHIRFormatError {
14248    Location res = new Location();
14249    parseLocationProperties(json, res);
14250    return res;
14251  }
14252
14253  protected void parseLocationProperties(JsonObject json, Location res) throws IOException, FHIRFormatError {
14254    parseDomainResourceProperties(json, res);
14255    if (json.has("identifier")) {
14256      JsonArray array = json.getAsJsonArray("identifier");
14257      for (int i = 0; i < array.size(); i++) {
14258        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14259      }
14260    };
14261    if (json.has("status"))
14262      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Location.LocationStatus.NULL, new Location.LocationStatusEnumFactory()));
14263    if (json.has("_status"))
14264      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14265    if (json.has("operationalStatus"))
14266      res.setOperationalStatus(parseCoding(json.getAsJsonObject("operationalStatus")));
14267    if (json.has("name"))
14268      res.setNameElement(parseString(json.get("name").getAsString()));
14269    if (json.has("_name"))
14270      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14271    if (json.has("alias")) {
14272      JsonArray array = json.getAsJsonArray("alias");
14273      for (int i = 0; i < array.size(); i++) {
14274        res.getAlias().add(parseString(array.get(i).getAsString()));
14275      }
14276    };
14277    if (json.has("_alias")) {
14278      JsonArray array = json.getAsJsonArray("_alias");
14279      for (int i = 0; i < array.size(); i++) {
14280        if (i == res.getAlias().size())
14281          res.getAlias().add(parseString(null));
14282        if (array.get(i) instanceof JsonObject) 
14283          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
14284      }
14285    };
14286    if (json.has("description"))
14287      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14288    if (json.has("_description"))
14289      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14290    if (json.has("mode"))
14291      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), Location.LocationMode.NULL, new Location.LocationModeEnumFactory()));
14292    if (json.has("_mode"))
14293      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
14294    if (json.has("type")) {
14295      JsonArray array = json.getAsJsonArray("type");
14296      for (int i = 0; i < array.size(); i++) {
14297        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14298      }
14299    };
14300    if (json.has("telecom")) {
14301      JsonArray array = json.getAsJsonArray("telecom");
14302      for (int i = 0; i < array.size(); i++) {
14303        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
14304      }
14305    };
14306    if (json.has("address"))
14307      res.setAddress(parseAddress(json.getAsJsonObject("address")));
14308    if (json.has("physicalType"))
14309      res.setPhysicalType(parseCodeableConcept(json.getAsJsonObject("physicalType")));
14310    if (json.has("position"))
14311      res.setPosition(parseLocationLocationPositionComponent(json.getAsJsonObject("position"), res));
14312    if (json.has("managingOrganization"))
14313      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
14314    if (json.has("partOf"))
14315      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
14316    if (json.has("hoursOfOperation")) {
14317      JsonArray array = json.getAsJsonArray("hoursOfOperation");
14318      for (int i = 0; i < array.size(); i++) {
14319        res.getHoursOfOperation().add(parseLocationLocationHoursOfOperationComponent(array.get(i).getAsJsonObject(), res));
14320      }
14321    };
14322    if (json.has("availabilityExceptions"))
14323      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
14324    if (json.has("_availabilityExceptions"))
14325      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
14326    if (json.has("endpoint")) {
14327      JsonArray array = json.getAsJsonArray("endpoint");
14328      for (int i = 0; i < array.size(); i++) {
14329        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
14330      }
14331    };
14332  }
14333
14334  protected Location.LocationPositionComponent parseLocationLocationPositionComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
14335    Location.LocationPositionComponent res = new Location.LocationPositionComponent();
14336    parseLocationLocationPositionComponentProperties(json, owner, res);
14337    return res;
14338  }
14339
14340  protected void parseLocationLocationPositionComponentProperties(JsonObject json, Location owner, Location.LocationPositionComponent res) throws IOException, FHIRFormatError {
14341    parseBackboneElementProperties(json, res);
14342    if (json.has("longitude"))
14343      res.setLongitudeElement(parseDecimal(json.get("longitude").getAsBigDecimal()));
14344    if (json.has("_longitude"))
14345      parseElementProperties(json.getAsJsonObject("_longitude"), res.getLongitudeElement());
14346    if (json.has("latitude"))
14347      res.setLatitudeElement(parseDecimal(json.get("latitude").getAsBigDecimal()));
14348    if (json.has("_latitude"))
14349      parseElementProperties(json.getAsJsonObject("_latitude"), res.getLatitudeElement());
14350    if (json.has("altitude"))
14351      res.setAltitudeElement(parseDecimal(json.get("altitude").getAsBigDecimal()));
14352    if (json.has("_altitude"))
14353      parseElementProperties(json.getAsJsonObject("_altitude"), res.getAltitudeElement());
14354  }
14355
14356  protected Location.LocationHoursOfOperationComponent parseLocationLocationHoursOfOperationComponent(JsonObject json, Location owner) throws IOException, FHIRFormatError {
14357    Location.LocationHoursOfOperationComponent res = new Location.LocationHoursOfOperationComponent();
14358    parseLocationLocationHoursOfOperationComponentProperties(json, owner, res);
14359    return res;
14360  }
14361
14362  protected void parseLocationLocationHoursOfOperationComponentProperties(JsonObject json, Location owner, Location.LocationHoursOfOperationComponent res) throws IOException, FHIRFormatError {
14363    parseBackboneElementProperties(json, res);
14364    if (json.has("daysOfWeek")) {
14365      JsonArray array = json.getAsJsonArray("daysOfWeek");
14366      for (int i = 0; i < array.size(); i++) {
14367        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
14368      }
14369    };
14370    if (json.has("_daysOfWeek")) {
14371      JsonArray array = json.getAsJsonArray("_daysOfWeek");
14372      for (int i = 0; i < array.size(); i++) {
14373        if (i == res.getDaysOfWeek().size())
14374          res.getDaysOfWeek().add(parseEnumeration(null, Location.DaysOfWeek.NULL, new Location.DaysOfWeekEnumFactory()));
14375        if (array.get(i) instanceof JsonObject) 
14376          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
14377      }
14378    };
14379    if (json.has("allDay"))
14380      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
14381    if (json.has("_allDay"))
14382      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
14383    if (json.has("openingTime"))
14384      res.setOpeningTimeElement(parseTime(json.get("openingTime").getAsString()));
14385    if (json.has("_openingTime"))
14386      parseElementProperties(json.getAsJsonObject("_openingTime"), res.getOpeningTimeElement());
14387    if (json.has("closingTime"))
14388      res.setClosingTimeElement(parseTime(json.get("closingTime").getAsString()));
14389    if (json.has("_closingTime"))
14390      parseElementProperties(json.getAsJsonObject("_closingTime"), res.getClosingTimeElement());
14391  }
14392
14393  protected Measure parseMeasure(JsonObject json) throws IOException, FHIRFormatError {
14394    Measure res = new Measure();
14395    parseMeasureProperties(json, res);
14396    return res;
14397  }
14398
14399  protected void parseMeasureProperties(JsonObject json, Measure res) throws IOException, FHIRFormatError {
14400    parseDomainResourceProperties(json, res);
14401    if (json.has("url"))
14402      res.setUrlElement(parseUri(json.get("url").getAsString()));
14403    if (json.has("_url"))
14404      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
14405    if (json.has("identifier")) {
14406      JsonArray array = json.getAsJsonArray("identifier");
14407      for (int i = 0; i < array.size(); i++) {
14408        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14409      }
14410    };
14411    if (json.has("version"))
14412      res.setVersionElement(parseString(json.get("version").getAsString()));
14413    if (json.has("_version"))
14414      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
14415    if (json.has("name"))
14416      res.setNameElement(parseString(json.get("name").getAsString()));
14417    if (json.has("_name"))
14418      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
14419    if (json.has("title"))
14420      res.setTitleElement(parseString(json.get("title").getAsString()));
14421    if (json.has("_title"))
14422      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
14423    if (json.has("subtitle"))
14424      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
14425    if (json.has("_subtitle"))
14426      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
14427    if (json.has("status"))
14428      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
14429    if (json.has("_status"))
14430      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14431    if (json.has("experimental"))
14432      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
14433    if (json.has("_experimental"))
14434      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
14435    Type subject = parseType("subject", json);
14436    if (subject != null)
14437      res.setSubject(subject);
14438    if (json.has("date"))
14439      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14440    if (json.has("_date"))
14441      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14442    if (json.has("publisher"))
14443      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
14444    if (json.has("_publisher"))
14445      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
14446    if (json.has("contact")) {
14447      JsonArray array = json.getAsJsonArray("contact");
14448      for (int i = 0; i < array.size(); i++) {
14449        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
14450      }
14451    };
14452    if (json.has("description"))
14453      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
14454    if (json.has("_description"))
14455      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14456    if (json.has("useContext")) {
14457      JsonArray array = json.getAsJsonArray("useContext");
14458      for (int i = 0; i < array.size(); i++) {
14459        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
14460      }
14461    };
14462    if (json.has("jurisdiction")) {
14463      JsonArray array = json.getAsJsonArray("jurisdiction");
14464      for (int i = 0; i < array.size(); i++) {
14465        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14466      }
14467    };
14468    if (json.has("purpose"))
14469      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
14470    if (json.has("_purpose"))
14471      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
14472    if (json.has("usage"))
14473      res.setUsageElement(parseString(json.get("usage").getAsString()));
14474    if (json.has("_usage"))
14475      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
14476    if (json.has("copyright"))
14477      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
14478    if (json.has("_copyright"))
14479      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
14480    if (json.has("approvalDate"))
14481      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
14482    if (json.has("_approvalDate"))
14483      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
14484    if (json.has("lastReviewDate"))
14485      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
14486    if (json.has("_lastReviewDate"))
14487      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
14488    if (json.has("effectivePeriod"))
14489      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
14490    if (json.has("topic")) {
14491      JsonArray array = json.getAsJsonArray("topic");
14492      for (int i = 0; i < array.size(); i++) {
14493        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14494      }
14495    };
14496    if (json.has("author")) {
14497      JsonArray array = json.getAsJsonArray("author");
14498      for (int i = 0; i < array.size(); i++) {
14499        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14500      }
14501    };
14502    if (json.has("editor")) {
14503      JsonArray array = json.getAsJsonArray("editor");
14504      for (int i = 0; i < array.size(); i++) {
14505        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
14506      }
14507    };
14508    if (json.has("reviewer")) {
14509      JsonArray array = json.getAsJsonArray("reviewer");
14510      for (int i = 0; i < array.size(); i++) {
14511        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
14512      }
14513    };
14514    if (json.has("endorser")) {
14515      JsonArray array = json.getAsJsonArray("endorser");
14516      for (int i = 0; i < array.size(); i++) {
14517        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
14518      }
14519    };
14520    if (json.has("relatedArtifact")) {
14521      JsonArray array = json.getAsJsonArray("relatedArtifact");
14522      for (int i = 0; i < array.size(); i++) {
14523        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
14524      }
14525    };
14526    if (json.has("library")) {
14527      JsonArray array = json.getAsJsonArray("library");
14528      for (int i = 0; i < array.size(); i++) {
14529        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
14530      }
14531    };
14532    if (json.has("_library")) {
14533      JsonArray array = json.getAsJsonArray("_library");
14534      for (int i = 0; i < array.size(); i++) {
14535        if (i == res.getLibrary().size())
14536          res.getLibrary().add(parseCanonical(null));
14537        if (array.get(i) instanceof JsonObject) 
14538          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
14539      }
14540    };
14541    if (json.has("disclaimer"))
14542      res.setDisclaimerElement(parseMarkdown(json.get("disclaimer").getAsString()));
14543    if (json.has("_disclaimer"))
14544      parseElementProperties(json.getAsJsonObject("_disclaimer"), res.getDisclaimerElement());
14545    if (json.has("scoring"))
14546      res.setScoring(parseCodeableConcept(json.getAsJsonObject("scoring")));
14547    if (json.has("compositeScoring"))
14548      res.setCompositeScoring(parseCodeableConcept(json.getAsJsonObject("compositeScoring")));
14549    if (json.has("type")) {
14550      JsonArray array = json.getAsJsonArray("type");
14551      for (int i = 0; i < array.size(); i++) {
14552        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14553      }
14554    };
14555    if (json.has("riskAdjustment"))
14556      res.setRiskAdjustmentElement(parseString(json.get("riskAdjustment").getAsString()));
14557    if (json.has("_riskAdjustment"))
14558      parseElementProperties(json.getAsJsonObject("_riskAdjustment"), res.getRiskAdjustmentElement());
14559    if (json.has("rateAggregation"))
14560      res.setRateAggregationElement(parseString(json.get("rateAggregation").getAsString()));
14561    if (json.has("_rateAggregation"))
14562      parseElementProperties(json.getAsJsonObject("_rateAggregation"), res.getRateAggregationElement());
14563    if (json.has("rationale"))
14564      res.setRationaleElement(parseMarkdown(json.get("rationale").getAsString()));
14565    if (json.has("_rationale"))
14566      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
14567    if (json.has("clinicalRecommendationStatement"))
14568      res.setClinicalRecommendationStatementElement(parseMarkdown(json.get("clinicalRecommendationStatement").getAsString()));
14569    if (json.has("_clinicalRecommendationStatement"))
14570      parseElementProperties(json.getAsJsonObject("_clinicalRecommendationStatement"), res.getClinicalRecommendationStatementElement());
14571    if (json.has("improvementNotation"))
14572      res.setImprovementNotationElement(parseEnumeration(json.get("improvementNotation").getAsString(), Measure.MeasureImprovementNotation.NULL, new Measure.MeasureImprovementNotationEnumFactory()));
14573    if (json.has("_improvementNotation"))
14574      parseElementProperties(json.getAsJsonObject("_improvementNotation"), res.getImprovementNotationElement());
14575    if (json.has("definition")) {
14576      JsonArray array = json.getAsJsonArray("definition");
14577      for (int i = 0; i < array.size(); i++) {
14578        res.getDefinition().add(parseMarkdown(array.get(i).getAsString()));
14579      }
14580    };
14581    if (json.has("_definition")) {
14582      JsonArray array = json.getAsJsonArray("_definition");
14583      for (int i = 0; i < array.size(); i++) {
14584        if (i == res.getDefinition().size())
14585          res.getDefinition().add(parseMarkdown(null));
14586        if (array.get(i) instanceof JsonObject) 
14587          parseElementProperties(array.get(i).getAsJsonObject(), res.getDefinition().get(i));
14588      }
14589    };
14590    if (json.has("guidance"))
14591      res.setGuidanceElement(parseMarkdown(json.get("guidance").getAsString()));
14592    if (json.has("_guidance"))
14593      parseElementProperties(json.getAsJsonObject("_guidance"), res.getGuidanceElement());
14594    if (json.has("group")) {
14595      JsonArray array = json.getAsJsonArray("group");
14596      for (int i = 0; i < array.size(); i++) {
14597        res.getGroup().add(parseMeasureMeasureGroupComponent(array.get(i).getAsJsonObject(), res));
14598      }
14599    };
14600    if (json.has("supplementalData")) {
14601      JsonArray array = json.getAsJsonArray("supplementalData");
14602      for (int i = 0; i < array.size(); i++) {
14603        res.getSupplementalData().add(parseMeasureMeasureSupplementalDataComponent(array.get(i).getAsJsonObject(), res));
14604      }
14605    };
14606  }
14607
14608  protected Measure.MeasureGroupComponent parseMeasureMeasureGroupComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
14609    Measure.MeasureGroupComponent res = new Measure.MeasureGroupComponent();
14610    parseMeasureMeasureGroupComponentProperties(json, owner, res);
14611    return res;
14612  }
14613
14614  protected void parseMeasureMeasureGroupComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupComponent res) throws IOException, FHIRFormatError {
14615    parseBackboneElementProperties(json, res);
14616    if (json.has("code"))
14617      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14618    if (json.has("description"))
14619      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14620    if (json.has("_description"))
14621      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14622    if (json.has("population")) {
14623      JsonArray array = json.getAsJsonArray("population");
14624      for (int i = 0; i < array.size(); i++) {
14625        res.getPopulation().add(parseMeasureMeasureGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
14626      }
14627    };
14628    if (json.has("stratifier")) {
14629      JsonArray array = json.getAsJsonArray("stratifier");
14630      for (int i = 0; i < array.size(); i++) {
14631        res.getStratifier().add(parseMeasureMeasureGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
14632      }
14633    };
14634  }
14635
14636  protected Measure.MeasureGroupPopulationComponent parseMeasureMeasureGroupPopulationComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
14637    Measure.MeasureGroupPopulationComponent res = new Measure.MeasureGroupPopulationComponent();
14638    parseMeasureMeasureGroupPopulationComponentProperties(json, owner, res);
14639    return res;
14640  }
14641
14642  protected void parseMeasureMeasureGroupPopulationComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupPopulationComponent res) throws IOException, FHIRFormatError {
14643    parseBackboneElementProperties(json, res);
14644    if (json.has("code"))
14645      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14646    if (json.has("description"))
14647      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14648    if (json.has("_description"))
14649      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14650    if (json.has("criteria"))
14651      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
14652  }
14653
14654  protected Measure.MeasureGroupStratifierComponent parseMeasureMeasureGroupStratifierComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
14655    Measure.MeasureGroupStratifierComponent res = new Measure.MeasureGroupStratifierComponent();
14656    parseMeasureMeasureGroupStratifierComponentProperties(json, owner, res);
14657    return res;
14658  }
14659
14660  protected void parseMeasureMeasureGroupStratifierComponentProperties(JsonObject json, Measure owner, Measure.MeasureGroupStratifierComponent res) throws IOException, FHIRFormatError {
14661    parseBackboneElementProperties(json, res);
14662    if (json.has("code"))
14663      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14664    if (json.has("description"))
14665      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14666    if (json.has("_description"))
14667      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14668    if (json.has("criteria"))
14669      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
14670  }
14671
14672  protected Measure.MeasureSupplementalDataComponent parseMeasureMeasureSupplementalDataComponent(JsonObject json, Measure owner) throws IOException, FHIRFormatError {
14673    Measure.MeasureSupplementalDataComponent res = new Measure.MeasureSupplementalDataComponent();
14674    parseMeasureMeasureSupplementalDataComponentProperties(json, owner, res);
14675    return res;
14676  }
14677
14678  protected void parseMeasureMeasureSupplementalDataComponentProperties(JsonObject json, Measure owner, Measure.MeasureSupplementalDataComponent res) throws IOException, FHIRFormatError {
14679    parseBackboneElementProperties(json, res);
14680    if (json.has("code"))
14681      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14682    if (json.has("usage")) {
14683      JsonArray array = json.getAsJsonArray("usage");
14684      for (int i = 0; i < array.size(); i++) {
14685        res.getUsage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14686      }
14687    };
14688    if (json.has("description"))
14689      res.setDescriptionElement(parseString(json.get("description").getAsString()));
14690    if (json.has("_description"))
14691      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
14692    if (json.has("criteria"))
14693      res.setCriteria(parseExpression(json.getAsJsonObject("criteria")));
14694  }
14695
14696  protected MeasureReport parseMeasureReport(JsonObject json) throws IOException, FHIRFormatError {
14697    MeasureReport res = new MeasureReport();
14698    parseMeasureReportProperties(json, res);
14699    return res;
14700  }
14701
14702  protected void parseMeasureReportProperties(JsonObject json, MeasureReport res) throws IOException, FHIRFormatError {
14703    parseDomainResourceProperties(json, res);
14704    if (json.has("identifier")) {
14705      JsonArray array = json.getAsJsonArray("identifier");
14706      for (int i = 0; i < array.size(); i++) {
14707        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14708      }
14709    };
14710    if (json.has("status"))
14711      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MeasureReport.MeasureReportStatus.NULL, new MeasureReport.MeasureReportStatusEnumFactory()));
14712    if (json.has("_status"))
14713      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14714    if (json.has("type"))
14715      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), MeasureReport.MeasureReportType.NULL, new MeasureReport.MeasureReportTypeEnumFactory()));
14716    if (json.has("_type"))
14717      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
14718    if (json.has("measure"))
14719      res.setMeasureElement(parseCanonical(json.get("measure").getAsString()));
14720    if (json.has("_measure"))
14721      parseElementProperties(json.getAsJsonObject("_measure"), res.getMeasureElement());
14722    if (json.has("subject"))
14723      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14724    if (json.has("date"))
14725      res.setDateElement(parseDateTime(json.get("date").getAsString()));
14726    if (json.has("_date"))
14727      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
14728    if (json.has("reporter"))
14729      res.setReporter(parseReference(json.getAsJsonObject("reporter")));
14730    if (json.has("period"))
14731      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
14732    if (json.has("improvementNotation"))
14733      res.setImprovementNotationElement(parseEnumeration(json.get("improvementNotation").getAsString(), MeasureReport.MeasureImprovementNotation.NULL, new MeasureReport.MeasureImprovementNotationEnumFactory()));
14734    if (json.has("_improvementNotation"))
14735      parseElementProperties(json.getAsJsonObject("_improvementNotation"), res.getImprovementNotationElement());
14736    if (json.has("group")) {
14737      JsonArray array = json.getAsJsonArray("group");
14738      for (int i = 0; i < array.size(); i++) {
14739        res.getGroup().add(parseMeasureReportMeasureReportGroupComponent(array.get(i).getAsJsonObject(), res));
14740      }
14741    };
14742    if (json.has("evaluatedResource")) {
14743      JsonArray array = json.getAsJsonArray("evaluatedResource");
14744      for (int i = 0; i < array.size(); i++) {
14745        res.getEvaluatedResource().add(parseReference(array.get(i).getAsJsonObject()));
14746      }
14747    };
14748  }
14749
14750  protected MeasureReport.MeasureReportGroupComponent parseMeasureReportMeasureReportGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
14751    MeasureReport.MeasureReportGroupComponent res = new MeasureReport.MeasureReportGroupComponent();
14752    parseMeasureReportMeasureReportGroupComponentProperties(json, owner, res);
14753    return res;
14754  }
14755
14756  protected void parseMeasureReportMeasureReportGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupComponent res) throws IOException, FHIRFormatError {
14757    parseBackboneElementProperties(json, res);
14758    if (json.has("code"))
14759      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14760    if (json.has("population")) {
14761      JsonArray array = json.getAsJsonArray("population");
14762      for (int i = 0; i < array.size(); i++) {
14763        res.getPopulation().add(parseMeasureReportMeasureReportGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
14764      }
14765    };
14766    if (json.has("measureScore"))
14767      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
14768    if (json.has("stratifier")) {
14769      JsonArray array = json.getAsJsonArray("stratifier");
14770      for (int i = 0; i < array.size(); i++) {
14771        res.getStratifier().add(parseMeasureReportMeasureReportGroupStratifierComponent(array.get(i).getAsJsonObject(), owner));
14772      }
14773    };
14774  }
14775
14776  protected MeasureReport.MeasureReportGroupPopulationComponent parseMeasureReportMeasureReportGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
14777    MeasureReport.MeasureReportGroupPopulationComponent res = new MeasureReport.MeasureReportGroupPopulationComponent();
14778    parseMeasureReportMeasureReportGroupPopulationComponentProperties(json, owner, res);
14779    return res;
14780  }
14781
14782  protected void parseMeasureReportMeasureReportGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupPopulationComponent res) throws IOException, FHIRFormatError {
14783    parseBackboneElementProperties(json, res);
14784    if (json.has("code"))
14785      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14786    if (json.has("count"))
14787      res.setCountElement(parseInteger(json.get("count").getAsLong()));
14788    if (json.has("_count"))
14789      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
14790    if (json.has("subjectResults"))
14791      res.setSubjectResults(parseReference(json.getAsJsonObject("subjectResults")));
14792  }
14793
14794  protected MeasureReport.MeasureReportGroupStratifierComponent parseMeasureReportMeasureReportGroupStratifierComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
14795    MeasureReport.MeasureReportGroupStratifierComponent res = new MeasureReport.MeasureReportGroupStratifierComponent();
14796    parseMeasureReportMeasureReportGroupStratifierComponentProperties(json, owner, res);
14797    return res;
14798  }
14799
14800  protected void parseMeasureReportMeasureReportGroupStratifierComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.MeasureReportGroupStratifierComponent res) throws IOException, FHIRFormatError {
14801    parseBackboneElementProperties(json, res);
14802    if (json.has("code"))
14803      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14804    if (json.has("stratum")) {
14805      JsonArray array = json.getAsJsonArray("stratum");
14806      for (int i = 0; i < array.size(); i++) {
14807        res.getStratum().add(parseMeasureReportStratifierGroupComponent(array.get(i).getAsJsonObject(), owner));
14808      }
14809    };
14810  }
14811
14812  protected MeasureReport.StratifierGroupComponent parseMeasureReportStratifierGroupComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
14813    MeasureReport.StratifierGroupComponent res = new MeasureReport.StratifierGroupComponent();
14814    parseMeasureReportStratifierGroupComponentProperties(json, owner, res);
14815    return res;
14816  }
14817
14818  protected void parseMeasureReportStratifierGroupComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupComponent res) throws IOException, FHIRFormatError {
14819    parseBackboneElementProperties(json, res);
14820    if (json.has("value"))
14821      res.setValue(parseCodeableConcept(json.getAsJsonObject("value")));
14822    if (json.has("population")) {
14823      JsonArray array = json.getAsJsonArray("population");
14824      for (int i = 0; i < array.size(); i++) {
14825        res.getPopulation().add(parseMeasureReportStratifierGroupPopulationComponent(array.get(i).getAsJsonObject(), owner));
14826      }
14827    };
14828    if (json.has("measureScore"))
14829      res.setMeasureScore(parseQuantity(json.getAsJsonObject("measureScore")));
14830  }
14831
14832  protected MeasureReport.StratifierGroupPopulationComponent parseMeasureReportStratifierGroupPopulationComponent(JsonObject json, MeasureReport owner) throws IOException, FHIRFormatError {
14833    MeasureReport.StratifierGroupPopulationComponent res = new MeasureReport.StratifierGroupPopulationComponent();
14834    parseMeasureReportStratifierGroupPopulationComponentProperties(json, owner, res);
14835    return res;
14836  }
14837
14838  protected void parseMeasureReportStratifierGroupPopulationComponentProperties(JsonObject json, MeasureReport owner, MeasureReport.StratifierGroupPopulationComponent res) throws IOException, FHIRFormatError {
14839    parseBackboneElementProperties(json, res);
14840    if (json.has("code"))
14841      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14842    if (json.has("count"))
14843      res.setCountElement(parseInteger(json.get("count").getAsLong()));
14844    if (json.has("_count"))
14845      parseElementProperties(json.getAsJsonObject("_count"), res.getCountElement());
14846    if (json.has("subjectResults"))
14847      res.setSubjectResults(parseReference(json.getAsJsonObject("subjectResults")));
14848  }
14849
14850  protected Media parseMedia(JsonObject json) throws IOException, FHIRFormatError {
14851    Media res = new Media();
14852    parseMediaProperties(json, res);
14853    return res;
14854  }
14855
14856  protected void parseMediaProperties(JsonObject json, Media res) throws IOException, FHIRFormatError {
14857    parseDomainResourceProperties(json, res);
14858    if (json.has("identifier")) {
14859      JsonArray array = json.getAsJsonArray("identifier");
14860      for (int i = 0; i < array.size(); i++) {
14861        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
14862      }
14863    };
14864    if (json.has("basedOn")) {
14865      JsonArray array = json.getAsJsonArray("basedOn");
14866      for (int i = 0; i < array.size(); i++) {
14867        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
14868      }
14869    };
14870    if (json.has("partOf")) {
14871      JsonArray array = json.getAsJsonArray("partOf");
14872      for (int i = 0; i < array.size(); i++) {
14873        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
14874      }
14875    };
14876    if (json.has("status"))
14877      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Media.MediaStatus.NULL, new Media.MediaStatusEnumFactory()));
14878    if (json.has("_status"))
14879      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14880    if (json.has("type"))
14881      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
14882    if (json.has("modality"))
14883      res.setModality(parseCodeableConcept(json.getAsJsonObject("modality")));
14884    if (json.has("view"))
14885      res.setView(parseCodeableConcept(json.getAsJsonObject("view")));
14886    if (json.has("subject"))
14887      res.setSubject(parseReference(json.getAsJsonObject("subject")));
14888    if (json.has("context"))
14889      res.setContext(parseReference(json.getAsJsonObject("context")));
14890    Type created = parseType("created", json);
14891    if (created != null)
14892      res.setCreated(created);
14893    if (json.has("issued"))
14894      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
14895    if (json.has("_issued"))
14896      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
14897    if (json.has("operator"))
14898      res.setOperator(parseReference(json.getAsJsonObject("operator")));
14899    if (json.has("reasonCode")) {
14900      JsonArray array = json.getAsJsonArray("reasonCode");
14901      for (int i = 0; i < array.size(); i++) {
14902        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
14903      }
14904    };
14905    if (json.has("bodySite"))
14906      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
14907    if (json.has("deviceName"))
14908      res.setDeviceNameElement(parseString(json.get("deviceName").getAsString()));
14909    if (json.has("_deviceName"))
14910      parseElementProperties(json.getAsJsonObject("_deviceName"), res.getDeviceNameElement());
14911    if (json.has("device"))
14912      res.setDevice(parseReference(json.getAsJsonObject("device")));
14913    if (json.has("height"))
14914      res.setHeightElement(parsePositiveInt(json.get("height").getAsString()));
14915    if (json.has("_height"))
14916      parseElementProperties(json.getAsJsonObject("_height"), res.getHeightElement());
14917    if (json.has("width"))
14918      res.setWidthElement(parsePositiveInt(json.get("width").getAsString()));
14919    if (json.has("_width"))
14920      parseElementProperties(json.getAsJsonObject("_width"), res.getWidthElement());
14921    if (json.has("frames"))
14922      res.setFramesElement(parsePositiveInt(json.get("frames").getAsString()));
14923    if (json.has("_frames"))
14924      parseElementProperties(json.getAsJsonObject("_frames"), res.getFramesElement());
14925    if (json.has("duration"))
14926      res.setDurationElement(parseDecimal(json.get("duration").getAsBigDecimal()));
14927    if (json.has("_duration"))
14928      parseElementProperties(json.getAsJsonObject("_duration"), res.getDurationElement());
14929    if (json.has("content"))
14930      res.setContent(parseAttachment(json.getAsJsonObject("content")));
14931    if (json.has("note")) {
14932      JsonArray array = json.getAsJsonArray("note");
14933      for (int i = 0; i < array.size(); i++) {
14934        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
14935      }
14936    };
14937  }
14938
14939  protected Medication parseMedication(JsonObject json) throws IOException, FHIRFormatError {
14940    Medication res = new Medication();
14941    parseMedicationProperties(json, res);
14942    return res;
14943  }
14944
14945  protected void parseMedicationProperties(JsonObject json, Medication res) throws IOException, FHIRFormatError {
14946    parseDomainResourceProperties(json, res);
14947    if (json.has("code"))
14948      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
14949    if (json.has("status"))
14950      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Medication.MedicationStatus.NULL, new Medication.MedicationStatusEnumFactory()));
14951    if (json.has("_status"))
14952      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
14953    if (json.has("manufacturer"))
14954      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
14955    if (json.has("form"))
14956      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
14957    if (json.has("amount"))
14958      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
14959    if (json.has("ingredient")) {
14960      JsonArray array = json.getAsJsonArray("ingredient");
14961      for (int i = 0; i < array.size(); i++) {
14962        res.getIngredient().add(parseMedicationMedicationIngredientComponent(array.get(i).getAsJsonObject(), res));
14963      }
14964    };
14965    if (json.has("batch"))
14966      res.setBatch(parseMedicationMedicationBatchComponent(json.getAsJsonObject("batch"), res));
14967  }
14968
14969  protected Medication.MedicationIngredientComponent parseMedicationMedicationIngredientComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
14970    Medication.MedicationIngredientComponent res = new Medication.MedicationIngredientComponent();
14971    parseMedicationMedicationIngredientComponentProperties(json, owner, res);
14972    return res;
14973  }
14974
14975  protected void parseMedicationMedicationIngredientComponentProperties(JsonObject json, Medication owner, Medication.MedicationIngredientComponent res) throws IOException, FHIRFormatError {
14976    parseBackboneElementProperties(json, res);
14977    Type item = parseType("item", json);
14978    if (item != null)
14979      res.setItem(item);
14980    if (json.has("isActive"))
14981      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
14982    if (json.has("_isActive"))
14983      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
14984    if (json.has("amount"))
14985      res.setAmount(parseRatio(json.getAsJsonObject("amount")));
14986  }
14987
14988  protected Medication.MedicationBatchComponent parseMedicationMedicationBatchComponent(JsonObject json, Medication owner) throws IOException, FHIRFormatError {
14989    Medication.MedicationBatchComponent res = new Medication.MedicationBatchComponent();
14990    parseMedicationMedicationBatchComponentProperties(json, owner, res);
14991    return res;
14992  }
14993
14994  protected void parseMedicationMedicationBatchComponentProperties(JsonObject json, Medication owner, Medication.MedicationBatchComponent res) throws IOException, FHIRFormatError {
14995    parseBackboneElementProperties(json, res);
14996    if (json.has("lotNumber"))
14997      res.setLotNumberElement(parseString(json.get("lotNumber").getAsString()));
14998    if (json.has("_lotNumber"))
14999      parseElementProperties(json.getAsJsonObject("_lotNumber"), res.getLotNumberElement());
15000    if (json.has("expirationDate"))
15001      res.setExpirationDateElement(parseDateTime(json.get("expirationDate").getAsString()));
15002    if (json.has("_expirationDate"))
15003      parseElementProperties(json.getAsJsonObject("_expirationDate"), res.getExpirationDateElement());
15004    if (json.has("serialNumber"))
15005      res.setSerialNumberElement(parseString(json.get("serialNumber").getAsString()));
15006    if (json.has("_serialNumber"))
15007      parseElementProperties(json.getAsJsonObject("_serialNumber"), res.getSerialNumberElement());
15008  }
15009
15010  protected MedicationAdministration parseMedicationAdministration(JsonObject json) throws IOException, FHIRFormatError {
15011    MedicationAdministration res = new MedicationAdministration();
15012    parseMedicationAdministrationProperties(json, res);
15013    return res;
15014  }
15015
15016  protected void parseMedicationAdministrationProperties(JsonObject json, MedicationAdministration res) throws IOException, FHIRFormatError {
15017    parseDomainResourceProperties(json, res);
15018    if (json.has("identifier")) {
15019      JsonArray array = json.getAsJsonArray("identifier");
15020      for (int i = 0; i < array.size(); i++) {
15021        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15022      }
15023    };
15024    if (json.has("instantiates")) {
15025      JsonArray array = json.getAsJsonArray("instantiates");
15026      for (int i = 0; i < array.size(); i++) {
15027        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
15028      }
15029    };
15030    if (json.has("_instantiates")) {
15031      JsonArray array = json.getAsJsonArray("_instantiates");
15032      for (int i = 0; i < array.size(); i++) {
15033        if (i == res.getInstantiates().size())
15034          res.getInstantiates().add(parseUri(null));
15035        if (array.get(i) instanceof JsonObject) 
15036          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
15037      }
15038    };
15039    if (json.has("partOf")) {
15040      JsonArray array = json.getAsJsonArray("partOf");
15041      for (int i = 0; i < array.size(); i++) {
15042        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15043      }
15044    };
15045    if (json.has("status"))
15046      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationAdministration.MedicationAdministrationStatus.NULL, new MedicationAdministration.MedicationAdministrationStatusEnumFactory()));
15047    if (json.has("_status"))
15048      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15049    if (json.has("category"))
15050      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
15051    Type medication = parseType("medication", json);
15052    if (medication != null)
15053      res.setMedication(medication);
15054    if (json.has("subject"))
15055      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15056    if (json.has("context"))
15057      res.setContext(parseReference(json.getAsJsonObject("context")));
15058    if (json.has("supportingInformation")) {
15059      JsonArray array = json.getAsJsonArray("supportingInformation");
15060      for (int i = 0; i < array.size(); i++) {
15061        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
15062      }
15063    };
15064    Type effective = parseType("effective", json);
15065    if (effective != null)
15066      res.setEffective(effective);
15067    if (json.has("performer")) {
15068      JsonArray array = json.getAsJsonArray("performer");
15069      for (int i = 0; i < array.size(); i++) {
15070        res.getPerformer().add(parseMedicationAdministrationMedicationAdministrationPerformerComponent(array.get(i).getAsJsonObject(), res));
15071      }
15072    };
15073    if (json.has("statusReason")) {
15074      JsonArray array = json.getAsJsonArray("statusReason");
15075      for (int i = 0; i < array.size(); i++) {
15076        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15077      }
15078    };
15079    if (json.has("reasonCode")) {
15080      JsonArray array = json.getAsJsonArray("reasonCode");
15081      for (int i = 0; i < array.size(); i++) {
15082        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15083      }
15084    };
15085    if (json.has("reasonReference")) {
15086      JsonArray array = json.getAsJsonArray("reasonReference");
15087      for (int i = 0; i < array.size(); i++) {
15088        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15089      }
15090    };
15091    if (json.has("request"))
15092      res.setRequest(parseReference(json.getAsJsonObject("request")));
15093    if (json.has("device")) {
15094      JsonArray array = json.getAsJsonArray("device");
15095      for (int i = 0; i < array.size(); i++) {
15096        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
15097      }
15098    };
15099    if (json.has("note")) {
15100      JsonArray array = json.getAsJsonArray("note");
15101      for (int i = 0; i < array.size(); i++) {
15102        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15103      }
15104    };
15105    if (json.has("dosage"))
15106      res.setDosage(parseMedicationAdministrationMedicationAdministrationDosageComponent(json.getAsJsonObject("dosage"), res));
15107    if (json.has("eventHistory")) {
15108      JsonArray array = json.getAsJsonArray("eventHistory");
15109      for (int i = 0; i < array.size(); i++) {
15110        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
15111      }
15112    };
15113  }
15114
15115  protected MedicationAdministration.MedicationAdministrationPerformerComponent parseMedicationAdministrationMedicationAdministrationPerformerComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
15116    MedicationAdministration.MedicationAdministrationPerformerComponent res = new MedicationAdministration.MedicationAdministrationPerformerComponent();
15117    parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(json, owner, res);
15118    return res;
15119  }
15120
15121  protected void parseMedicationAdministrationMedicationAdministrationPerformerComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationPerformerComponent res) throws IOException, FHIRFormatError {
15122    parseBackboneElementProperties(json, res);
15123    if (json.has("function"))
15124      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
15125    if (json.has("actor"))
15126      res.setActor(parseReference(json.getAsJsonObject("actor")));
15127  }
15128
15129  protected MedicationAdministration.MedicationAdministrationDosageComponent parseMedicationAdministrationMedicationAdministrationDosageComponent(JsonObject json, MedicationAdministration owner) throws IOException, FHIRFormatError {
15130    MedicationAdministration.MedicationAdministrationDosageComponent res = new MedicationAdministration.MedicationAdministrationDosageComponent();
15131    parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(json, owner, res);
15132    return res;
15133  }
15134
15135  protected void parseMedicationAdministrationMedicationAdministrationDosageComponentProperties(JsonObject json, MedicationAdministration owner, MedicationAdministration.MedicationAdministrationDosageComponent res) throws IOException, FHIRFormatError {
15136    parseBackboneElementProperties(json, res);
15137    if (json.has("text"))
15138      res.setTextElement(parseString(json.get("text").getAsString()));
15139    if (json.has("_text"))
15140      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
15141    if (json.has("site"))
15142      res.setSite(parseCodeableConcept(json.getAsJsonObject("site")));
15143    if (json.has("route"))
15144      res.setRoute(parseCodeableConcept(json.getAsJsonObject("route")));
15145    if (json.has("method"))
15146      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
15147    if (json.has("dose"))
15148      res.setDose(parseQuantity(json.getAsJsonObject("dose")));
15149    Type rate = parseType("rate", json);
15150    if (rate != null)
15151      res.setRate(rate);
15152  }
15153
15154  protected MedicationDispense parseMedicationDispense(JsonObject json) throws IOException, FHIRFormatError {
15155    MedicationDispense res = new MedicationDispense();
15156    parseMedicationDispenseProperties(json, res);
15157    return res;
15158  }
15159
15160  protected void parseMedicationDispenseProperties(JsonObject json, MedicationDispense res) throws IOException, FHIRFormatError {
15161    parseDomainResourceProperties(json, res);
15162    if (json.has("identifier")) {
15163      JsonArray array = json.getAsJsonArray("identifier");
15164      for (int i = 0; i < array.size(); i++) {
15165        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15166      }
15167    };
15168    if (json.has("partOf")) {
15169      JsonArray array = json.getAsJsonArray("partOf");
15170      for (int i = 0; i < array.size(); i++) {
15171        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15172      }
15173    };
15174    if (json.has("status"))
15175      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationDispense.MedicationDispenseStatus.NULL, new MedicationDispense.MedicationDispenseStatusEnumFactory()));
15176    if (json.has("_status"))
15177      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15178    if (json.has("category"))
15179      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
15180    Type medication = parseType("medication", json);
15181    if (medication != null)
15182      res.setMedication(medication);
15183    if (json.has("subject"))
15184      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15185    if (json.has("context"))
15186      res.setContext(parseReference(json.getAsJsonObject("context")));
15187    if (json.has("supportingInformation")) {
15188      JsonArray array = json.getAsJsonArray("supportingInformation");
15189      for (int i = 0; i < array.size(); i++) {
15190        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
15191      }
15192    };
15193    if (json.has("performer")) {
15194      JsonArray array = json.getAsJsonArray("performer");
15195      for (int i = 0; i < array.size(); i++) {
15196        res.getPerformer().add(parseMedicationDispenseMedicationDispensePerformerComponent(array.get(i).getAsJsonObject(), res));
15197      }
15198    };
15199    if (json.has("location"))
15200      res.setLocation(parseReference(json.getAsJsonObject("location")));
15201    if (json.has("authorizingPrescription")) {
15202      JsonArray array = json.getAsJsonArray("authorizingPrescription");
15203      for (int i = 0; i < array.size(); i++) {
15204        res.getAuthorizingPrescription().add(parseReference(array.get(i).getAsJsonObject()));
15205      }
15206    };
15207    if (json.has("type"))
15208      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15209    if (json.has("quantity"))
15210      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
15211    if (json.has("daysSupply"))
15212      res.setDaysSupply(parseQuantity(json.getAsJsonObject("daysSupply")));
15213    if (json.has("whenPrepared"))
15214      res.setWhenPreparedElement(parseDateTime(json.get("whenPrepared").getAsString()));
15215    if (json.has("_whenPrepared"))
15216      parseElementProperties(json.getAsJsonObject("_whenPrepared"), res.getWhenPreparedElement());
15217    if (json.has("whenHandedOver"))
15218      res.setWhenHandedOverElement(parseDateTime(json.get("whenHandedOver").getAsString()));
15219    if (json.has("_whenHandedOver"))
15220      parseElementProperties(json.getAsJsonObject("_whenHandedOver"), res.getWhenHandedOverElement());
15221    if (json.has("destination"))
15222      res.setDestination(parseReference(json.getAsJsonObject("destination")));
15223    if (json.has("receiver")) {
15224      JsonArray array = json.getAsJsonArray("receiver");
15225      for (int i = 0; i < array.size(); i++) {
15226        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
15227      }
15228    };
15229    if (json.has("note")) {
15230      JsonArray array = json.getAsJsonArray("note");
15231      for (int i = 0; i < array.size(); i++) {
15232        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15233      }
15234    };
15235    if (json.has("dosageInstruction")) {
15236      JsonArray array = json.getAsJsonArray("dosageInstruction");
15237      for (int i = 0; i < array.size(); i++) {
15238        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
15239      }
15240    };
15241    if (json.has("substitution"))
15242      res.setSubstitution(parseMedicationDispenseMedicationDispenseSubstitutionComponent(json.getAsJsonObject("substitution"), res));
15243    if (json.has("detectedIssue")) {
15244      JsonArray array = json.getAsJsonArray("detectedIssue");
15245      for (int i = 0; i < array.size(); i++) {
15246        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
15247      }
15248    };
15249    Type statusReason = parseType("statusReason", json);
15250    if (statusReason != null)
15251      res.setStatusReason(statusReason);
15252    if (json.has("eventHistory")) {
15253      JsonArray array = json.getAsJsonArray("eventHistory");
15254      for (int i = 0; i < array.size(); i++) {
15255        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
15256      }
15257    };
15258  }
15259
15260  protected MedicationDispense.MedicationDispensePerformerComponent parseMedicationDispenseMedicationDispensePerformerComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
15261    MedicationDispense.MedicationDispensePerformerComponent res = new MedicationDispense.MedicationDispensePerformerComponent();
15262    parseMedicationDispenseMedicationDispensePerformerComponentProperties(json, owner, res);
15263    return res;
15264  }
15265
15266  protected void parseMedicationDispenseMedicationDispensePerformerComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispensePerformerComponent res) throws IOException, FHIRFormatError {
15267    parseBackboneElementProperties(json, res);
15268    if (json.has("function"))
15269      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
15270    if (json.has("actor"))
15271      res.setActor(parseReference(json.getAsJsonObject("actor")));
15272  }
15273
15274  protected MedicationDispense.MedicationDispenseSubstitutionComponent parseMedicationDispenseMedicationDispenseSubstitutionComponent(JsonObject json, MedicationDispense owner) throws IOException, FHIRFormatError {
15275    MedicationDispense.MedicationDispenseSubstitutionComponent res = new MedicationDispense.MedicationDispenseSubstitutionComponent();
15276    parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(json, owner, res);
15277    return res;
15278  }
15279
15280  protected void parseMedicationDispenseMedicationDispenseSubstitutionComponentProperties(JsonObject json, MedicationDispense owner, MedicationDispense.MedicationDispenseSubstitutionComponent res) throws IOException, FHIRFormatError {
15281    parseBackboneElementProperties(json, res);
15282    if (json.has("wasSubstituted"))
15283      res.setWasSubstitutedElement(parseBoolean(json.get("wasSubstituted").getAsBoolean()));
15284    if (json.has("_wasSubstituted"))
15285      parseElementProperties(json.getAsJsonObject("_wasSubstituted"), res.getWasSubstitutedElement());
15286    if (json.has("type"))
15287      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15288    if (json.has("reason")) {
15289      JsonArray array = json.getAsJsonArray("reason");
15290      for (int i = 0; i < array.size(); i++) {
15291        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15292      }
15293    };
15294    if (json.has("responsibleParty")) {
15295      JsonArray array = json.getAsJsonArray("responsibleParty");
15296      for (int i = 0; i < array.size(); i++) {
15297        res.getResponsibleParty().add(parseReference(array.get(i).getAsJsonObject()));
15298      }
15299    };
15300  }
15301
15302  protected MedicationKnowledge parseMedicationKnowledge(JsonObject json) throws IOException, FHIRFormatError {
15303    MedicationKnowledge res = new MedicationKnowledge();
15304    parseMedicationKnowledgeProperties(json, res);
15305    return res;
15306  }
15307
15308  protected void parseMedicationKnowledgeProperties(JsonObject json, MedicationKnowledge res) throws IOException, FHIRFormatError {
15309    parseDomainResourceProperties(json, res);
15310    if (json.has("code"))
15311      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
15312    if (json.has("status"))
15313      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationKnowledge.MedicationKnowledgeStatus.NULL, new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory()));
15314    if (json.has("_status"))
15315      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15316    if (json.has("manufacturer"))
15317      res.setManufacturer(parseReference(json.getAsJsonObject("manufacturer")));
15318    if (json.has("doseForm"))
15319      res.setDoseForm(parseCodeableConcept(json.getAsJsonObject("doseForm")));
15320    if (json.has("amount"))
15321      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
15322    if (json.has("synonym")) {
15323      JsonArray array = json.getAsJsonArray("synonym");
15324      for (int i = 0; i < array.size(); i++) {
15325        res.getSynonym().add(parseString(array.get(i).getAsString()));
15326      }
15327    };
15328    if (json.has("_synonym")) {
15329      JsonArray array = json.getAsJsonArray("_synonym");
15330      for (int i = 0; i < array.size(); i++) {
15331        if (i == res.getSynonym().size())
15332          res.getSynonym().add(parseString(null));
15333        if (array.get(i) instanceof JsonObject) 
15334          parseElementProperties(array.get(i).getAsJsonObject(), res.getSynonym().get(i));
15335      }
15336    };
15337    if (json.has("relatedMedicationKnowledge")) {
15338      JsonArray array = json.getAsJsonArray("relatedMedicationKnowledge");
15339      for (int i = 0; i < array.size(); i++) {
15340        res.getRelatedMedicationKnowledge().add(parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(array.get(i).getAsJsonObject(), res));
15341      }
15342    };
15343    if (json.has("associatedMedication")) {
15344      JsonArray array = json.getAsJsonArray("associatedMedication");
15345      for (int i = 0; i < array.size(); i++) {
15346        res.getAssociatedMedication().add(parseReference(array.get(i).getAsJsonObject()));
15347      }
15348    };
15349    if (json.has("productType")) {
15350      JsonArray array = json.getAsJsonArray("productType");
15351      for (int i = 0; i < array.size(); i++) {
15352        res.getProductType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15353      }
15354    };
15355    if (json.has("monograph")) {
15356      JsonArray array = json.getAsJsonArray("monograph");
15357      for (int i = 0; i < array.size(); i++) {
15358        res.getMonograph().add(parseMedicationKnowledgeMedicationKnowledgeMonographComponent(array.get(i).getAsJsonObject(), res));
15359      }
15360    };
15361    if (json.has("ingredient")) {
15362      JsonArray array = json.getAsJsonArray("ingredient");
15363      for (int i = 0; i < array.size(); i++) {
15364        res.getIngredient().add(parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(array.get(i).getAsJsonObject(), res));
15365      }
15366    };
15367    if (json.has("preparationInstruction"))
15368      res.setPreparationInstructionElement(parseMarkdown(json.get("preparationInstruction").getAsString()));
15369    if (json.has("_preparationInstruction"))
15370      parseElementProperties(json.getAsJsonObject("_preparationInstruction"), res.getPreparationInstructionElement());
15371    if (json.has("intendedRoute")) {
15372      JsonArray array = json.getAsJsonArray("intendedRoute");
15373      for (int i = 0; i < array.size(); i++) {
15374        res.getIntendedRoute().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15375      }
15376    };
15377    if (json.has("cost")) {
15378      JsonArray array = json.getAsJsonArray("cost");
15379      for (int i = 0; i < array.size(); i++) {
15380        res.getCost().add(parseMedicationKnowledgeMedicationKnowledgeCostComponent(array.get(i).getAsJsonObject(), res));
15381      }
15382    };
15383    if (json.has("monitoringProgram")) {
15384      JsonArray array = json.getAsJsonArray("monitoringProgram");
15385      for (int i = 0; i < array.size(); i++) {
15386        res.getMonitoringProgram().add(parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(array.get(i).getAsJsonObject(), res));
15387      }
15388    };
15389    if (json.has("administrationGuidelines")) {
15390      JsonArray array = json.getAsJsonArray("administrationGuidelines");
15391      for (int i = 0; i < array.size(); i++) {
15392        res.getAdministrationGuidelines().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(array.get(i).getAsJsonObject(), res));
15393      }
15394    };
15395    if (json.has("medicineClassification")) {
15396      JsonArray array = json.getAsJsonArray("medicineClassification");
15397      for (int i = 0; i < array.size(); i++) {
15398        res.getMedicineClassification().add(parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(array.get(i).getAsJsonObject(), res));
15399      }
15400    };
15401    if (json.has("packaging"))
15402      res.setPackaging(parseMedicationKnowledgeMedicationKnowledgePackagingComponent(json.getAsJsonObject("packaging"), res));
15403    if (json.has("drugCharacteristic")) {
15404      JsonArray array = json.getAsJsonArray("drugCharacteristic");
15405      for (int i = 0; i < array.size(); i++) {
15406        res.getDrugCharacteristic().add(parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(array.get(i).getAsJsonObject(), res));
15407      }
15408    };
15409    if (json.has("contraindication")) {
15410      JsonArray array = json.getAsJsonArray("contraindication");
15411      for (int i = 0; i < array.size(); i++) {
15412        res.getContraindication().add(parseReference(array.get(i).getAsJsonObject()));
15413      }
15414    };
15415    if (json.has("regulatory")) {
15416      JsonArray array = json.getAsJsonArray("regulatory");
15417      for (int i = 0; i < array.size(); i++) {
15418        res.getRegulatory().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(array.get(i).getAsJsonObject(), res));
15419      }
15420    };
15421    if (json.has("kinetics")) {
15422      JsonArray array = json.getAsJsonArray("kinetics");
15423      for (int i = 0; i < array.size(); i++) {
15424        res.getKinetics().add(parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(array.get(i).getAsJsonObject(), res));
15425      }
15426    };
15427  }
15428
15429  protected MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15430    MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res = new MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent();
15431    parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(json, owner, res);
15432    return res;
15433  }
15434
15435  protected void parseMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent res) throws IOException, FHIRFormatError {
15436    parseBackboneElementProperties(json, res);
15437    if (json.has("type"))
15438      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15439    if (json.has("reference")) {
15440      JsonArray array = json.getAsJsonArray("reference");
15441      for (int i = 0; i < array.size(); i++) {
15442        res.getReference().add(parseReference(array.get(i).getAsJsonObject()));
15443      }
15444    };
15445  }
15446
15447  protected MedicationKnowledge.MedicationKnowledgeMonographComponent parseMedicationKnowledgeMedicationKnowledgeMonographComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15448    MedicationKnowledge.MedicationKnowledgeMonographComponent res = new MedicationKnowledge.MedicationKnowledgeMonographComponent();
15449    parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(json, owner, res);
15450    return res;
15451  }
15452
15453  protected void parseMedicationKnowledgeMedicationKnowledgeMonographComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonographComponent res) throws IOException, FHIRFormatError {
15454    parseBackboneElementProperties(json, res);
15455    if (json.has("type"))
15456      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15457    if (json.has("source"))
15458      res.setSource(parseReference(json.getAsJsonObject("source")));
15459  }
15460
15461  protected MedicationKnowledge.MedicationKnowledgeIngredientComponent parseMedicationKnowledgeMedicationKnowledgeIngredientComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15462    MedicationKnowledge.MedicationKnowledgeIngredientComponent res = new MedicationKnowledge.MedicationKnowledgeIngredientComponent();
15463    parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(json, owner, res);
15464    return res;
15465  }
15466
15467  protected void parseMedicationKnowledgeMedicationKnowledgeIngredientComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeIngredientComponent res) throws IOException, FHIRFormatError {
15468    parseBackboneElementProperties(json, res);
15469    Type item = parseType("item", json);
15470    if (item != null)
15471      res.setItem(item);
15472    if (json.has("isActive"))
15473      res.setIsActiveElement(parseBoolean(json.get("isActive").getAsBoolean()));
15474    if (json.has("_isActive"))
15475      parseElementProperties(json.getAsJsonObject("_isActive"), res.getIsActiveElement());
15476    if (json.has("strength"))
15477      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
15478  }
15479
15480  protected MedicationKnowledge.MedicationKnowledgeCostComponent parseMedicationKnowledgeMedicationKnowledgeCostComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15481    MedicationKnowledge.MedicationKnowledgeCostComponent res = new MedicationKnowledge.MedicationKnowledgeCostComponent();
15482    parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(json, owner, res);
15483    return res;
15484  }
15485
15486  protected void parseMedicationKnowledgeMedicationKnowledgeCostComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeCostComponent res) throws IOException, FHIRFormatError {
15487    parseBackboneElementProperties(json, res);
15488    if (json.has("type"))
15489      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15490    if (json.has("source"))
15491      res.setSourceElement(parseString(json.get("source").getAsString()));
15492    if (json.has("_source"))
15493      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
15494    if (json.has("cost"))
15495      res.setCost(parseMoney(json.getAsJsonObject("cost")));
15496  }
15497
15498  protected MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15499    MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res = new MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent();
15500    parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(json, owner, res);
15501    return res;
15502  }
15503
15504  protected void parseMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent res) throws IOException, FHIRFormatError {
15505    parseBackboneElementProperties(json, res);
15506    if (json.has("type"))
15507      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15508    if (json.has("name"))
15509      res.setNameElement(parseString(json.get("name").getAsString()));
15510    if (json.has("_name"))
15511      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
15512  }
15513
15514  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15515    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent();
15516    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(json, owner, res);
15517    return res;
15518  }
15519
15520  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent res) throws IOException, FHIRFormatError {
15521    parseBackboneElementProperties(json, res);
15522    if (json.has("dosage")) {
15523      JsonArray array = json.getAsJsonArray("dosage");
15524      for (int i = 0; i < array.size(); i++) {
15525        res.getDosage().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(array.get(i).getAsJsonObject(), owner));
15526      }
15527    };
15528    Type indication = parseType("indication", json);
15529    if (indication != null)
15530      res.setIndication(indication);
15531    if (json.has("patientCharacteristics")) {
15532      JsonArray array = json.getAsJsonArray("patientCharacteristics");
15533      for (int i = 0; i < array.size(); i++) {
15534        res.getPatientCharacteristics().add(parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(array.get(i).getAsJsonObject(), owner));
15535      }
15536    };
15537  }
15538
15539  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15540    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent();
15541    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(json, owner, res);
15542    return res;
15543  }
15544
15545  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent res) throws IOException, FHIRFormatError {
15546    parseBackboneElementProperties(json, res);
15547    if (json.has("type"))
15548      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15549    if (json.has("dosage")) {
15550      JsonArray array = json.getAsJsonArray("dosage");
15551      for (int i = 0; i < array.size(); i++) {
15552        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
15553      }
15554    };
15555  }
15556
15557  protected MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15558    MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res = new MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent();
15559    parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(json, owner, res);
15560    return res;
15561  }
15562
15563  protected void parseMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent res) throws IOException, FHIRFormatError {
15564    parseBackboneElementProperties(json, res);
15565    Type characteristic = parseType("characteristic", json);
15566    if (characteristic != null)
15567      res.setCharacteristic(characteristic);
15568    if (json.has("value")) {
15569      JsonArray array = json.getAsJsonArray("value");
15570      for (int i = 0; i < array.size(); i++) {
15571        res.getValue().add(parseString(array.get(i).getAsString()));
15572      }
15573    };
15574    if (json.has("_value")) {
15575      JsonArray array = json.getAsJsonArray("_value");
15576      for (int i = 0; i < array.size(); i++) {
15577        if (i == res.getValue().size())
15578          res.getValue().add(parseString(null));
15579        if (array.get(i) instanceof JsonObject) 
15580          parseElementProperties(array.get(i).getAsJsonObject(), res.getValue().get(i));
15581      }
15582    };
15583  }
15584
15585  protected MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15586    MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res = new MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent();
15587    parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(json, owner, res);
15588    return res;
15589  }
15590
15591  protected void parseMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent res) throws IOException, FHIRFormatError {
15592    parseBackboneElementProperties(json, res);
15593    if (json.has("type"))
15594      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15595    if (json.has("classification")) {
15596      JsonArray array = json.getAsJsonArray("classification");
15597      for (int i = 0; i < array.size(); i++) {
15598        res.getClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15599      }
15600    };
15601  }
15602
15603  protected MedicationKnowledge.MedicationKnowledgePackagingComponent parseMedicationKnowledgeMedicationKnowledgePackagingComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15604    MedicationKnowledge.MedicationKnowledgePackagingComponent res = new MedicationKnowledge.MedicationKnowledgePackagingComponent();
15605    parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(json, owner, res);
15606    return res;
15607  }
15608
15609  protected void parseMedicationKnowledgeMedicationKnowledgePackagingComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgePackagingComponent res) throws IOException, FHIRFormatError {
15610    parseBackboneElementProperties(json, res);
15611    if (json.has("type"))
15612      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15613    if (json.has("quantity"))
15614      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
15615  }
15616
15617  protected MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15618    MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res = new MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent();
15619    parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(json, owner, res);
15620    return res;
15621  }
15622
15623  protected void parseMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent res) throws IOException, FHIRFormatError {
15624    parseBackboneElementProperties(json, res);
15625    if (json.has("type"))
15626      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15627    Type value = parseType("value", json);
15628    if (value != null)
15629      res.setValue(value);
15630  }
15631
15632  protected MedicationKnowledge.MedicationKnowledgeRegulatoryComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15633    MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryComponent();
15634    parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(json, owner, res);
15635    return res;
15636  }
15637
15638  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent res) throws IOException, FHIRFormatError {
15639    parseBackboneElementProperties(json, res);
15640    if (json.has("regulatoryAuthority"))
15641      res.setRegulatoryAuthority(parseReference(json.getAsJsonObject("regulatoryAuthority")));
15642    if (json.has("substitution")) {
15643      JsonArray array = json.getAsJsonArray("substitution");
15644      for (int i = 0; i < array.size(); i++) {
15645        res.getSubstitution().add(parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(array.get(i).getAsJsonObject(), owner));
15646      }
15647    };
15648    if (json.has("schedule")) {
15649      JsonArray array = json.getAsJsonArray("schedule");
15650      for (int i = 0; i < array.size(); i++) {
15651        res.getSchedule().add(parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(array.get(i).getAsJsonObject(), owner));
15652      }
15653    };
15654    if (json.has("maxDispense"))
15655      res.setMaxDispense(parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(json.getAsJsonObject("maxDispense"), owner));
15656  }
15657
15658  protected MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15659    MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent();
15660    parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(json, owner, res);
15661    return res;
15662  }
15663
15664  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent res) throws IOException, FHIRFormatError {
15665    parseBackboneElementProperties(json, res);
15666    if (json.has("type"))
15667      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
15668    if (json.has("allowed"))
15669      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
15670    if (json.has("_allowed"))
15671      parseElementProperties(json.getAsJsonObject("_allowed"), res.getAllowedElement());
15672  }
15673
15674  protected MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15675    MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent();
15676    parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(json, owner, res);
15677    return res;
15678  }
15679
15680  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent res) throws IOException, FHIRFormatError {
15681    parseBackboneElementProperties(json, res);
15682    if (json.has("schedule"))
15683      res.setSchedule(parseCodeableConcept(json.getAsJsonObject("schedule")));
15684  }
15685
15686  protected MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15687    MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res = new MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent();
15688    parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(json, owner, res);
15689    return res;
15690  }
15691
15692  protected void parseMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent res) throws IOException, FHIRFormatError {
15693    parseBackboneElementProperties(json, res);
15694    if (json.has("quantity"))
15695      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
15696    if (json.has("period"))
15697      res.setPeriod(parseDuration(json.getAsJsonObject("period")));
15698  }
15699
15700  protected MedicationKnowledge.MedicationKnowledgeKineticsComponent parseMedicationKnowledgeMedicationKnowledgeKineticsComponent(JsonObject json, MedicationKnowledge owner) throws IOException, FHIRFormatError {
15701    MedicationKnowledge.MedicationKnowledgeKineticsComponent res = new MedicationKnowledge.MedicationKnowledgeKineticsComponent();
15702    parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(json, owner, res);
15703    return res;
15704  }
15705
15706  protected void parseMedicationKnowledgeMedicationKnowledgeKineticsComponentProperties(JsonObject json, MedicationKnowledge owner, MedicationKnowledge.MedicationKnowledgeKineticsComponent res) throws IOException, FHIRFormatError {
15707    parseBackboneElementProperties(json, res);
15708    if (json.has("areaUnderCurve")) {
15709      JsonArray array = json.getAsJsonArray("areaUnderCurve");
15710      for (int i = 0; i < array.size(); i++) {
15711        res.getAreaUnderCurve().add(parseQuantity(array.get(i).getAsJsonObject()));
15712      }
15713    };
15714    if (json.has("lethalDose50")) {
15715      JsonArray array = json.getAsJsonArray("lethalDose50");
15716      for (int i = 0; i < array.size(); i++) {
15717        res.getLethalDose50().add(parseQuantity(array.get(i).getAsJsonObject()));
15718      }
15719    };
15720    if (json.has("halfLifePeriod"))
15721      res.setHalfLifePeriod(parseDuration(json.getAsJsonObject("halfLifePeriod")));
15722  }
15723
15724  protected MedicationRequest parseMedicationRequest(JsonObject json) throws IOException, FHIRFormatError {
15725    MedicationRequest res = new MedicationRequest();
15726    parseMedicationRequestProperties(json, res);
15727    return res;
15728  }
15729
15730  protected void parseMedicationRequestProperties(JsonObject json, MedicationRequest res) throws IOException, FHIRFormatError {
15731    parseDomainResourceProperties(json, res);
15732    if (json.has("identifier")) {
15733      JsonArray array = json.getAsJsonArray("identifier");
15734      for (int i = 0; i < array.size(); i++) {
15735        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15736      }
15737    };
15738    if (json.has("status"))
15739      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationRequest.MedicationRequestStatus.NULL, new MedicationRequest.MedicationRequestStatusEnumFactory()));
15740    if (json.has("_status"))
15741      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15742    if (json.has("intent"))
15743      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), MedicationRequest.MedicationRequestIntent.NULL, new MedicationRequest.MedicationRequestIntentEnumFactory()));
15744    if (json.has("_intent"))
15745      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
15746    if (json.has("category")) {
15747      JsonArray array = json.getAsJsonArray("category");
15748      for (int i = 0; i < array.size(); i++) {
15749        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15750      }
15751    };
15752    if (json.has("priority"))
15753      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), MedicationRequest.MedicationRequestPriority.NULL, new MedicationRequest.MedicationRequestPriorityEnumFactory()));
15754    if (json.has("_priority"))
15755      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
15756    if (json.has("doNotPerform"))
15757      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
15758    if (json.has("_doNotPerform"))
15759      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
15760    Type medication = parseType("medication", json);
15761    if (medication != null)
15762      res.setMedication(medication);
15763    if (json.has("subject"))
15764      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15765    if (json.has("context"))
15766      res.setContext(parseReference(json.getAsJsonObject("context")));
15767    if (json.has("supportingInformation")) {
15768      JsonArray array = json.getAsJsonArray("supportingInformation");
15769      for (int i = 0; i < array.size(); i++) {
15770        res.getSupportingInformation().add(parseReference(array.get(i).getAsJsonObject()));
15771      }
15772    };
15773    if (json.has("authoredOn"))
15774      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
15775    if (json.has("_authoredOn"))
15776      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
15777    if (json.has("requester"))
15778      res.setRequester(parseReference(json.getAsJsonObject("requester")));
15779    if (json.has("performer"))
15780      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
15781    if (json.has("performerType"))
15782      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
15783    if (json.has("recorder"))
15784      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
15785    if (json.has("reasonCode")) {
15786      JsonArray array = json.getAsJsonArray("reasonCode");
15787      for (int i = 0; i < array.size(); i++) {
15788        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15789      }
15790    };
15791    if (json.has("reasonReference")) {
15792      JsonArray array = json.getAsJsonArray("reasonReference");
15793      for (int i = 0; i < array.size(); i++) {
15794        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15795      }
15796    };
15797    if (json.has("instantiates")) {
15798      JsonArray array = json.getAsJsonArray("instantiates");
15799      for (int i = 0; i < array.size(); i++) {
15800        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
15801      }
15802    };
15803    if (json.has("_instantiates")) {
15804      JsonArray array = json.getAsJsonArray("_instantiates");
15805      for (int i = 0; i < array.size(); i++) {
15806        if (i == res.getInstantiates().size())
15807          res.getInstantiates().add(parseUri(null));
15808        if (array.get(i) instanceof JsonObject) 
15809          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
15810      }
15811    };
15812    if (json.has("basedOn")) {
15813      JsonArray array = json.getAsJsonArray("basedOn");
15814      for (int i = 0; i < array.size(); i++) {
15815        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15816      }
15817    };
15818    if (json.has("groupIdentifier"))
15819      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
15820    if (json.has("statusReason"))
15821      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
15822    if (json.has("courseOfTherapyType"))
15823      res.setCourseOfTherapyType(parseCodeableConcept(json.getAsJsonObject("courseOfTherapyType")));
15824    if (json.has("insurance")) {
15825      JsonArray array = json.getAsJsonArray("insurance");
15826      for (int i = 0; i < array.size(); i++) {
15827        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
15828      }
15829    };
15830    if (json.has("note")) {
15831      JsonArray array = json.getAsJsonArray("note");
15832      for (int i = 0; i < array.size(); i++) {
15833        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15834      }
15835    };
15836    if (json.has("dosageInstruction")) {
15837      JsonArray array = json.getAsJsonArray("dosageInstruction");
15838      for (int i = 0; i < array.size(); i++) {
15839        res.getDosageInstruction().add(parseDosage(array.get(i).getAsJsonObject()));
15840      }
15841    };
15842    if (json.has("dispenseRequest"))
15843      res.setDispenseRequest(parseMedicationRequestMedicationRequestDispenseRequestComponent(json.getAsJsonObject("dispenseRequest"), res));
15844    if (json.has("substitution"))
15845      res.setSubstitution(parseMedicationRequestMedicationRequestSubstitutionComponent(json.getAsJsonObject("substitution"), res));
15846    if (json.has("priorPrescription"))
15847      res.setPriorPrescription(parseReference(json.getAsJsonObject("priorPrescription")));
15848    if (json.has("detectedIssue")) {
15849      JsonArray array = json.getAsJsonArray("detectedIssue");
15850      for (int i = 0; i < array.size(); i++) {
15851        res.getDetectedIssue().add(parseReference(array.get(i).getAsJsonObject()));
15852      }
15853    };
15854    if (json.has("eventHistory")) {
15855      JsonArray array = json.getAsJsonArray("eventHistory");
15856      for (int i = 0; i < array.size(); i++) {
15857        res.getEventHistory().add(parseReference(array.get(i).getAsJsonObject()));
15858      }
15859    };
15860  }
15861
15862  protected MedicationRequest.MedicationRequestDispenseRequestComponent parseMedicationRequestMedicationRequestDispenseRequestComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
15863    MedicationRequest.MedicationRequestDispenseRequestComponent res = new MedicationRequest.MedicationRequestDispenseRequestComponent();
15864    parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(json, owner, res);
15865    return res;
15866  }
15867
15868  protected void parseMedicationRequestMedicationRequestDispenseRequestComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestComponent res) throws IOException, FHIRFormatError {
15869    parseBackboneElementProperties(json, res);
15870    if (json.has("initialFill"))
15871      res.setInitialFill(parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(json.getAsJsonObject("initialFill"), owner));
15872    if (json.has("dispenseInterval"))
15873      res.setDispenseInterval(parseDuration(json.getAsJsonObject("dispenseInterval")));
15874    if (json.has("validityPeriod"))
15875      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
15876    if (json.has("numberOfRepeatsAllowed"))
15877      res.setNumberOfRepeatsAllowedElement(parseUnsignedInt(json.get("numberOfRepeatsAllowed").getAsString()));
15878    if (json.has("_numberOfRepeatsAllowed"))
15879      parseElementProperties(json.getAsJsonObject("_numberOfRepeatsAllowed"), res.getNumberOfRepeatsAllowedElement());
15880    if (json.has("quantity"))
15881      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
15882    if (json.has("expectedSupplyDuration"))
15883      res.setExpectedSupplyDuration(parseDuration(json.getAsJsonObject("expectedSupplyDuration")));
15884    if (json.has("performer"))
15885      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
15886  }
15887
15888  protected MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
15889    MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res = new MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent();
15890    parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(json, owner, res);
15891    return res;
15892  }
15893
15894  protected void parseMedicationRequestMedicationRequestDispenseRequestInitialFillComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent res) throws IOException, FHIRFormatError {
15895    parseBackboneElementProperties(json, res);
15896    if (json.has("quantity"))
15897      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
15898    if (json.has("duration"))
15899      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
15900  }
15901
15902  protected MedicationRequest.MedicationRequestSubstitutionComponent parseMedicationRequestMedicationRequestSubstitutionComponent(JsonObject json, MedicationRequest owner) throws IOException, FHIRFormatError {
15903    MedicationRequest.MedicationRequestSubstitutionComponent res = new MedicationRequest.MedicationRequestSubstitutionComponent();
15904    parseMedicationRequestMedicationRequestSubstitutionComponentProperties(json, owner, res);
15905    return res;
15906  }
15907
15908  protected void parseMedicationRequestMedicationRequestSubstitutionComponentProperties(JsonObject json, MedicationRequest owner, MedicationRequest.MedicationRequestSubstitutionComponent res) throws IOException, FHIRFormatError {
15909    parseBackboneElementProperties(json, res);
15910    if (json.has("allowed"))
15911      res.setAllowedElement(parseBoolean(json.get("allowed").getAsBoolean()));
15912    if (json.has("_allowed"))
15913      parseElementProperties(json.getAsJsonObject("_allowed"), res.getAllowedElement());
15914    if (json.has("reason"))
15915      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
15916  }
15917
15918  protected MedicationStatement parseMedicationStatement(JsonObject json) throws IOException, FHIRFormatError {
15919    MedicationStatement res = new MedicationStatement();
15920    parseMedicationStatementProperties(json, res);
15921    return res;
15922  }
15923
15924  protected void parseMedicationStatementProperties(JsonObject json, MedicationStatement res) throws IOException, FHIRFormatError {
15925    parseDomainResourceProperties(json, res);
15926    if (json.has("identifier")) {
15927      JsonArray array = json.getAsJsonArray("identifier");
15928      for (int i = 0; i < array.size(); i++) {
15929        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
15930      }
15931    };
15932    if (json.has("basedOn")) {
15933      JsonArray array = json.getAsJsonArray("basedOn");
15934      for (int i = 0; i < array.size(); i++) {
15935        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
15936      }
15937    };
15938    if (json.has("partOf")) {
15939      JsonArray array = json.getAsJsonArray("partOf");
15940      for (int i = 0; i < array.size(); i++) {
15941        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
15942      }
15943    };
15944    if (json.has("status"))
15945      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), MedicationStatement.MedicationStatementStatus.NULL, new MedicationStatement.MedicationStatementStatusEnumFactory()));
15946    if (json.has("_status"))
15947      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
15948    if (json.has("statusReason")) {
15949      JsonArray array = json.getAsJsonArray("statusReason");
15950      for (int i = 0; i < array.size(); i++) {
15951        res.getStatusReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15952      }
15953    };
15954    if (json.has("category"))
15955      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
15956    Type medication = parseType("medication", json);
15957    if (medication != null)
15958      res.setMedication(medication);
15959    if (json.has("subject"))
15960      res.setSubject(parseReference(json.getAsJsonObject("subject")));
15961    if (json.has("context"))
15962      res.setContext(parseReference(json.getAsJsonObject("context")));
15963    Type effective = parseType("effective", json);
15964    if (effective != null)
15965      res.setEffective(effective);
15966    if (json.has("dateAsserted"))
15967      res.setDateAssertedElement(parseDateTime(json.get("dateAsserted").getAsString()));
15968    if (json.has("_dateAsserted"))
15969      parseElementProperties(json.getAsJsonObject("_dateAsserted"), res.getDateAssertedElement());
15970    if (json.has("informationSource"))
15971      res.setInformationSource(parseReference(json.getAsJsonObject("informationSource")));
15972    if (json.has("derivedFrom")) {
15973      JsonArray array = json.getAsJsonArray("derivedFrom");
15974      for (int i = 0; i < array.size(); i++) {
15975        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
15976      }
15977    };
15978    if (json.has("reasonCode")) {
15979      JsonArray array = json.getAsJsonArray("reasonCode");
15980      for (int i = 0; i < array.size(); i++) {
15981        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
15982      }
15983    };
15984    if (json.has("reasonReference")) {
15985      JsonArray array = json.getAsJsonArray("reasonReference");
15986      for (int i = 0; i < array.size(); i++) {
15987        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
15988      }
15989    };
15990    if (json.has("note")) {
15991      JsonArray array = json.getAsJsonArray("note");
15992      for (int i = 0; i < array.size(); i++) {
15993        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
15994      }
15995    };
15996    if (json.has("dosage")) {
15997      JsonArray array = json.getAsJsonArray("dosage");
15998      for (int i = 0; i < array.size(); i++) {
15999        res.getDosage().add(parseDosage(array.get(i).getAsJsonObject()));
16000      }
16001    };
16002  }
16003
16004  protected MedicinalProduct parseMedicinalProduct(JsonObject json) throws IOException, FHIRFormatError {
16005    MedicinalProduct res = new MedicinalProduct();
16006    parseMedicinalProductProperties(json, res);
16007    return res;
16008  }
16009
16010  protected void parseMedicinalProductProperties(JsonObject json, MedicinalProduct res) throws IOException, FHIRFormatError {
16011    parseDomainResourceProperties(json, res);
16012    if (json.has("identifier")) {
16013      JsonArray array = json.getAsJsonArray("identifier");
16014      for (int i = 0; i < array.size(); i++) {
16015        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16016      }
16017    };
16018    if (json.has("type"))
16019      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16020    if (json.has("domain"))
16021      res.setDomain(parseCoding(json.getAsJsonObject("domain")));
16022    if (json.has("combinedPharmaceuticalDoseForm"))
16023      res.setCombinedPharmaceuticalDoseForm(parseCodeableConcept(json.getAsJsonObject("combinedPharmaceuticalDoseForm")));
16024    if (json.has("additionalMonitoringIndicator"))
16025      res.setAdditionalMonitoringIndicator(parseCodeableConcept(json.getAsJsonObject("additionalMonitoringIndicator")));
16026    if (json.has("specialMeasures")) {
16027      JsonArray array = json.getAsJsonArray("specialMeasures");
16028      for (int i = 0; i < array.size(); i++) {
16029        res.getSpecialMeasures().add(parseString(array.get(i).getAsString()));
16030      }
16031    };
16032    if (json.has("_specialMeasures")) {
16033      JsonArray array = json.getAsJsonArray("_specialMeasures");
16034      for (int i = 0; i < array.size(); i++) {
16035        if (i == res.getSpecialMeasures().size())
16036          res.getSpecialMeasures().add(parseString(null));
16037        if (array.get(i) instanceof JsonObject) 
16038          parseElementProperties(array.get(i).getAsJsonObject(), res.getSpecialMeasures().get(i));
16039      }
16040    };
16041    if (json.has("paediatricUseIndicator"))
16042      res.setPaediatricUseIndicator(parseCodeableConcept(json.getAsJsonObject("paediatricUseIndicator")));
16043    if (json.has("productClassification")) {
16044      JsonArray array = json.getAsJsonArray("productClassification");
16045      for (int i = 0; i < array.size(); i++) {
16046        res.getProductClassification().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16047      }
16048    };
16049    if (json.has("marketingStatus")) {
16050      JsonArray array = json.getAsJsonArray("marketingStatus");
16051      for (int i = 0; i < array.size(); i++) {
16052        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
16053      }
16054    };
16055    if (json.has("marketingAuthorization"))
16056      res.setMarketingAuthorization(parseReference(json.getAsJsonObject("marketingAuthorization")));
16057    if (json.has("packagedMedicinalProduct")) {
16058      JsonArray array = json.getAsJsonArray("packagedMedicinalProduct");
16059      for (int i = 0; i < array.size(); i++) {
16060        res.getPackagedMedicinalProduct().add(parseReference(array.get(i).getAsJsonObject()));
16061      }
16062    };
16063    if (json.has("pharmaceuticalProduct")) {
16064      JsonArray array = json.getAsJsonArray("pharmaceuticalProduct");
16065      for (int i = 0; i < array.size(); i++) {
16066        res.getPharmaceuticalProduct().add(parseReference(array.get(i).getAsJsonObject()));
16067      }
16068    };
16069    if (json.has("contraindication")) {
16070      JsonArray array = json.getAsJsonArray("contraindication");
16071      for (int i = 0; i < array.size(); i++) {
16072        res.getContraindication().add(parseReference(array.get(i).getAsJsonObject()));
16073      }
16074    };
16075    if (json.has("interaction")) {
16076      JsonArray array = json.getAsJsonArray("interaction");
16077      for (int i = 0; i < array.size(); i++) {
16078        res.getInteraction().add(parseReference(array.get(i).getAsJsonObject()));
16079      }
16080    };
16081    if (json.has("therapeuticIndication")) {
16082      JsonArray array = json.getAsJsonArray("therapeuticIndication");
16083      for (int i = 0; i < array.size(); i++) {
16084        res.getTherapeuticIndication().add(parseReference(array.get(i).getAsJsonObject()));
16085      }
16086    };
16087    if (json.has("undesirableEffect")) {
16088      JsonArray array = json.getAsJsonArray("undesirableEffect");
16089      for (int i = 0; i < array.size(); i++) {
16090        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
16091      }
16092    };
16093    if (json.has("attachedDocument")) {
16094      JsonArray array = json.getAsJsonArray("attachedDocument");
16095      for (int i = 0; i < array.size(); i++) {
16096        res.getAttachedDocument().add(parseReference(array.get(i).getAsJsonObject()));
16097      }
16098    };
16099    if (json.has("masterFile")) {
16100      JsonArray array = json.getAsJsonArray("masterFile");
16101      for (int i = 0; i < array.size(); i++) {
16102        res.getMasterFile().add(parseReference(array.get(i).getAsJsonObject()));
16103      }
16104    };
16105    if (json.has("contact")) {
16106      JsonArray array = json.getAsJsonArray("contact");
16107      for (int i = 0; i < array.size(); i++) {
16108        res.getContact().add(parseReference(array.get(i).getAsJsonObject()));
16109      }
16110    };
16111    if (json.has("clinicalTrial")) {
16112      JsonArray array = json.getAsJsonArray("clinicalTrial");
16113      for (int i = 0; i < array.size(); i++) {
16114        res.getClinicalTrial().add(parseReference(array.get(i).getAsJsonObject()));
16115      }
16116    };
16117    if (json.has("name")) {
16118      JsonArray array = json.getAsJsonArray("name");
16119      for (int i = 0; i < array.size(); i++) {
16120        res.getName().add(parseMedicinalProductMedicinalProductNameComponent(array.get(i).getAsJsonObject(), res));
16121      }
16122    };
16123    if (json.has("crossReference")) {
16124      JsonArray array = json.getAsJsonArray("crossReference");
16125      for (int i = 0; i < array.size(); i++) {
16126        res.getCrossReference().add(parseIdentifier(array.get(i).getAsJsonObject()));
16127      }
16128    };
16129    if (json.has("manufacturingBusinessOperation")) {
16130      JsonArray array = json.getAsJsonArray("manufacturingBusinessOperation");
16131      for (int i = 0; i < array.size(); i++) {
16132        res.getManufacturingBusinessOperation().add(parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(array.get(i).getAsJsonObject(), res));
16133      }
16134    };
16135    if (json.has("specialDesignation")) {
16136      JsonArray array = json.getAsJsonArray("specialDesignation");
16137      for (int i = 0; i < array.size(); i++) {
16138        res.getSpecialDesignation().add(parseMedicinalProductMedicinalProductSpecialDesignationComponent(array.get(i).getAsJsonObject(), res));
16139      }
16140    };
16141  }
16142
16143  protected MedicinalProduct.MedicinalProductNameComponent parseMedicinalProductMedicinalProductNameComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
16144    MedicinalProduct.MedicinalProductNameComponent res = new MedicinalProduct.MedicinalProductNameComponent();
16145    parseMedicinalProductMedicinalProductNameComponentProperties(json, owner, res);
16146    return res;
16147  }
16148
16149  protected void parseMedicinalProductMedicinalProductNameComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameComponent res) throws IOException, FHIRFormatError {
16150    parseBackboneElementProperties(json, res);
16151    if (json.has("productName"))
16152      res.setProductNameElement(parseString(json.get("productName").getAsString()));
16153    if (json.has("_productName"))
16154      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
16155    if (json.has("namePart")) {
16156      JsonArray array = json.getAsJsonArray("namePart");
16157      for (int i = 0; i < array.size(); i++) {
16158        res.getNamePart().add(parseMedicinalProductMedicinalProductNameNamePartComponent(array.get(i).getAsJsonObject(), owner));
16159      }
16160    };
16161    if (json.has("countryLanguage")) {
16162      JsonArray array = json.getAsJsonArray("countryLanguage");
16163      for (int i = 0; i < array.size(); i++) {
16164        res.getCountryLanguage().add(parseMedicinalProductMedicinalProductNameCountryLanguageComponent(array.get(i).getAsJsonObject(), owner));
16165      }
16166    };
16167  }
16168
16169  protected MedicinalProduct.MedicinalProductNameNamePartComponent parseMedicinalProductMedicinalProductNameNamePartComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
16170    MedicinalProduct.MedicinalProductNameNamePartComponent res = new MedicinalProduct.MedicinalProductNameNamePartComponent();
16171    parseMedicinalProductMedicinalProductNameNamePartComponentProperties(json, owner, res);
16172    return res;
16173  }
16174
16175  protected void parseMedicinalProductMedicinalProductNameNamePartComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameNamePartComponent res) throws IOException, FHIRFormatError {
16176    parseBackboneElementProperties(json, res);
16177    if (json.has("part"))
16178      res.setPartElement(parseString(json.get("part").getAsString()));
16179    if (json.has("_part"))
16180      parseElementProperties(json.getAsJsonObject("_part"), res.getPartElement());
16181    if (json.has("type"))
16182      res.setType(parseCoding(json.getAsJsonObject("type")));
16183  }
16184
16185  protected MedicinalProduct.MedicinalProductNameCountryLanguageComponent parseMedicinalProductMedicinalProductNameCountryLanguageComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
16186    MedicinalProduct.MedicinalProductNameCountryLanguageComponent res = new MedicinalProduct.MedicinalProductNameCountryLanguageComponent();
16187    parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(json, owner, res);
16188    return res;
16189  }
16190
16191  protected void parseMedicinalProductMedicinalProductNameCountryLanguageComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductNameCountryLanguageComponent res) throws IOException, FHIRFormatError {
16192    parseBackboneElementProperties(json, res);
16193    if (json.has("country"))
16194      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
16195    if (json.has("jurisdiction"))
16196      res.setJurisdiction(parseCodeableConcept(json.getAsJsonObject("jurisdiction")));
16197    if (json.has("language"))
16198      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
16199  }
16200
16201  protected MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
16202    MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res = new MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent();
16203    parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(json, owner, res);
16204    return res;
16205  }
16206
16207  protected void parseMedicinalProductMedicinalProductManufacturingBusinessOperationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent res) throws IOException, FHIRFormatError {
16208    parseBackboneElementProperties(json, res);
16209    if (json.has("operationType"))
16210      res.setOperationType(parseCodeableConcept(json.getAsJsonObject("operationType")));
16211    if (json.has("authorisationReferenceNumber"))
16212      res.setAuthorisationReferenceNumber(parseIdentifier(json.getAsJsonObject("authorisationReferenceNumber")));
16213    if (json.has("effectiveDate"))
16214      res.setEffectiveDateElement(parseDateTime(json.get("effectiveDate").getAsString()));
16215    if (json.has("_effectiveDate"))
16216      parseElementProperties(json.getAsJsonObject("_effectiveDate"), res.getEffectiveDateElement());
16217    if (json.has("confidentialityIndicator"))
16218      res.setConfidentialityIndicator(parseCodeableConcept(json.getAsJsonObject("confidentialityIndicator")));
16219    if (json.has("manufacturer")) {
16220      JsonArray array = json.getAsJsonArray("manufacturer");
16221      for (int i = 0; i < array.size(); i++) {
16222        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
16223      }
16224    };
16225    if (json.has("regulator"))
16226      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
16227  }
16228
16229  protected MedicinalProduct.MedicinalProductSpecialDesignationComponent parseMedicinalProductMedicinalProductSpecialDesignationComponent(JsonObject json, MedicinalProduct owner) throws IOException, FHIRFormatError {
16230    MedicinalProduct.MedicinalProductSpecialDesignationComponent res = new MedicinalProduct.MedicinalProductSpecialDesignationComponent();
16231    parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(json, owner, res);
16232    return res;
16233  }
16234
16235  protected void parseMedicinalProductMedicinalProductSpecialDesignationComponentProperties(JsonObject json, MedicinalProduct owner, MedicinalProduct.MedicinalProductSpecialDesignationComponent res) throws IOException, FHIRFormatError {
16236    parseBackboneElementProperties(json, res);
16237    if (json.has("identifier")) {
16238      JsonArray array = json.getAsJsonArray("identifier");
16239      for (int i = 0; i < array.size(); i++) {
16240        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16241      }
16242    };
16243    if (json.has("intendedUse"))
16244      res.setIntendedUse(parseCodeableConcept(json.getAsJsonObject("intendedUse")));
16245    if (json.has("indication"))
16246      res.setIndication(parseCodeableConcept(json.getAsJsonObject("indication")));
16247    if (json.has("status"))
16248      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
16249    if (json.has("date"))
16250      res.setDateElement(parseDateTime(json.get("date").getAsString()));
16251    if (json.has("_date"))
16252      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
16253    if (json.has("species"))
16254      res.setSpecies(parseCodeableConcept(json.getAsJsonObject("species")));
16255  }
16256
16257  protected MedicinalProductAuthorization parseMedicinalProductAuthorization(JsonObject json) throws IOException, FHIRFormatError {
16258    MedicinalProductAuthorization res = new MedicinalProductAuthorization();
16259    parseMedicinalProductAuthorizationProperties(json, res);
16260    return res;
16261  }
16262
16263  protected void parseMedicinalProductAuthorizationProperties(JsonObject json, MedicinalProductAuthorization res) throws IOException, FHIRFormatError {
16264    parseDomainResourceProperties(json, res);
16265    if (json.has("identifier")) {
16266      JsonArray array = json.getAsJsonArray("identifier");
16267      for (int i = 0; i < array.size(); i++) {
16268        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16269      }
16270    };
16271    if (json.has("subject"))
16272      res.setSubject(parseReference(json.getAsJsonObject("subject")));
16273    if (json.has("country")) {
16274      JsonArray array = json.getAsJsonArray("country");
16275      for (int i = 0; i < array.size(); i++) {
16276        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16277      }
16278    };
16279    if (json.has("jurisdiction")) {
16280      JsonArray array = json.getAsJsonArray("jurisdiction");
16281      for (int i = 0; i < array.size(); i++) {
16282        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16283      }
16284    };
16285    if (json.has("legalStatusOfSupply"))
16286      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
16287    if (json.has("status"))
16288      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
16289    if (json.has("statusDate"))
16290      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
16291    if (json.has("_statusDate"))
16292      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
16293    if (json.has("restoreDate"))
16294      res.setRestoreDateElement(parseDateTime(json.get("restoreDate").getAsString()));
16295    if (json.has("_restoreDate"))
16296      parseElementProperties(json.getAsJsonObject("_restoreDate"), res.getRestoreDateElement());
16297    if (json.has("validityPeriod"))
16298      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
16299    if (json.has("dataExclusivityPeriod"))
16300      res.setDataExclusivityPeriod(parsePeriod(json.getAsJsonObject("dataExclusivityPeriod")));
16301    if (json.has("dateOfFirstAuthorization"))
16302      res.setDateOfFirstAuthorizationElement(parseDateTime(json.get("dateOfFirstAuthorization").getAsString()));
16303    if (json.has("_dateOfFirstAuthorization"))
16304      parseElementProperties(json.getAsJsonObject("_dateOfFirstAuthorization"), res.getDateOfFirstAuthorizationElement());
16305    if (json.has("internationalBirthDate"))
16306      res.setInternationalBirthDateElement(parseDateTime(json.get("internationalBirthDate").getAsString()));
16307    if (json.has("_internationalBirthDate"))
16308      parseElementProperties(json.getAsJsonObject("_internationalBirthDate"), res.getInternationalBirthDateElement());
16309    if (json.has("legalBasis"))
16310      res.setLegalBasis(parseCodeableConcept(json.getAsJsonObject("legalBasis")));
16311    if (json.has("jurisdictionalAuthorization")) {
16312      JsonArray array = json.getAsJsonArray("jurisdictionalAuthorization");
16313      for (int i = 0; i < array.size(); i++) {
16314        res.getJurisdictionalAuthorization().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(array.get(i).getAsJsonObject(), res));
16315      }
16316    };
16317    if (json.has("holder"))
16318      res.setHolder(parseReference(json.getAsJsonObject("holder")));
16319    if (json.has("regulator"))
16320      res.setRegulator(parseReference(json.getAsJsonObject("regulator")));
16321    if (json.has("procedure"))
16322      res.setProcedure(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(json.getAsJsonObject("procedure"), res));
16323  }
16324
16325  protected MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
16326    MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent();
16327    parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(json, owner, res);
16328    return res;
16329  }
16330
16331  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent res) throws IOException, FHIRFormatError {
16332    parseBackboneElementProperties(json, res);
16333    if (json.has("identifier")) {
16334      JsonArray array = json.getAsJsonArray("identifier");
16335      for (int i = 0; i < array.size(); i++) {
16336        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16337      }
16338    };
16339    if (json.has("country"))
16340      res.setCountry(parseCodeableConcept(json.getAsJsonObject("country")));
16341    if (json.has("jurisdiction")) {
16342      JsonArray array = json.getAsJsonArray("jurisdiction");
16343      for (int i = 0; i < array.size(); i++) {
16344        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16345      }
16346    };
16347    if (json.has("legalStatusOfSupply"))
16348      res.setLegalStatusOfSupply(parseCodeableConcept(json.getAsJsonObject("legalStatusOfSupply")));
16349    if (json.has("validityPeriod"))
16350      res.setValidityPeriod(parsePeriod(json.getAsJsonObject("validityPeriod")));
16351  }
16352
16353  protected MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(JsonObject json, MedicinalProductAuthorization owner) throws IOException, FHIRFormatError {
16354    MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res = new MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent();
16355    parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(json, owner, res);
16356    return res;
16357  }
16358
16359  protected void parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentProperties(JsonObject json, MedicinalProductAuthorization owner, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent res) throws IOException, FHIRFormatError {
16360    parseBackboneElementProperties(json, res);
16361    if (json.has("identifier"))
16362      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
16363    if (json.has("type"))
16364      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16365    Type date = parseType("date", json);
16366    if (date != null)
16367      res.setDate(date);
16368    if (json.has("application")) {
16369      JsonArray array = json.getAsJsonArray("application");
16370      for (int i = 0; i < array.size(); i++) {
16371        res.getApplication().add(parseMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(array.get(i).getAsJsonObject(), owner));
16372      }
16373    };
16374  }
16375
16376  protected MedicinalProductClinicals parseMedicinalProductClinicals(JsonObject json) throws IOException, FHIRFormatError {
16377    MedicinalProductClinicals res = new MedicinalProductClinicals();
16378    parseMedicinalProductClinicalsProperties(json, res);
16379    return res;
16380  }
16381
16382  protected void parseMedicinalProductClinicalsProperties(JsonObject json, MedicinalProductClinicals res) throws IOException, FHIRFormatError {
16383    parseDomainResourceProperties(json, res);
16384    if (json.has("undesirableEffects")) {
16385      JsonArray array = json.getAsJsonArray("undesirableEffects");
16386      for (int i = 0; i < array.size(); i++) {
16387        res.getUndesirableEffects().add(parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(array.get(i).getAsJsonObject(), res));
16388      }
16389    };
16390    if (json.has("therapeuticIndication")) {
16391      JsonArray array = json.getAsJsonArray("therapeuticIndication");
16392      for (int i = 0; i < array.size(); i++) {
16393        res.getTherapeuticIndication().add(parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(array.get(i).getAsJsonObject(), res));
16394      }
16395    };
16396    if (json.has("contraindication")) {
16397      JsonArray array = json.getAsJsonArray("contraindication");
16398      for (int i = 0; i < array.size(); i++) {
16399        res.getContraindication().add(parseMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponent(array.get(i).getAsJsonObject(), res));
16400      }
16401    };
16402    if (json.has("interactions")) {
16403      JsonArray array = json.getAsJsonArray("interactions");
16404      for (int i = 0; i < array.size(); i++) {
16405        res.getInteractions().add(parseMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponent(array.get(i).getAsJsonObject(), res));
16406      }
16407    };
16408  }
16409
16410  protected MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
16411    MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent();
16412    parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponentProperties(json, owner, res);
16413    return res;
16414  }
16415
16416  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent res) throws IOException, FHIRFormatError {
16417    parseBackboneElementProperties(json, res);
16418    if (json.has("symptomConditionEffect"))
16419      res.setSymptomConditionEffect(parseCodeableConcept(json.getAsJsonObject("symptomConditionEffect")));
16420    if (json.has("classification"))
16421      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
16422    if (json.has("frequencyOfOccurrence"))
16423      res.setFrequencyOfOccurrence(parseCodeableConcept(json.getAsJsonObject("frequencyOfOccurrence")));
16424    if (json.has("population")) {
16425      JsonArray array = json.getAsJsonArray("population");
16426      for (int i = 0; i < array.size(); i++) {
16427        res.getPopulation().add(parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(array.get(i).getAsJsonObject(), owner));
16428      }
16429    };
16430  }
16431
16432  protected MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
16433    MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent();
16434    parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponentProperties(json, owner, res);
16435    return res;
16436  }
16437
16438  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent res) throws IOException, FHIRFormatError {
16439    parseBackboneElementProperties(json, res);
16440    Type age = parseType("age", json);
16441    if (age != null)
16442      res.setAge(age);
16443    if (json.has("gender"))
16444      res.setGender(parseCodeableConcept(json.getAsJsonObject("gender")));
16445    if (json.has("race"))
16446      res.setRace(parseCodeableConcept(json.getAsJsonObject("race")));
16447    if (json.has("physiologicalCondition"))
16448      res.setPhysiologicalCondition(parseCodeableConcept(json.getAsJsonObject("physiologicalCondition")));
16449  }
16450
16451  protected MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
16452    MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent();
16453    parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponentProperties(json, owner, res);
16454    return res;
16455  }
16456
16457  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent res) throws IOException, FHIRFormatError {
16458    parseBackboneElementProperties(json, res);
16459    if (json.has("diseaseSymptomProcedure"))
16460      res.setDiseaseSymptomProcedure(parseCodeableConcept(json.getAsJsonObject("diseaseSymptomProcedure")));
16461    if (json.has("diseaseStatus"))
16462      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
16463    if (json.has("comorbidity")) {
16464      JsonArray array = json.getAsJsonArray("comorbidity");
16465      for (int i = 0; i < array.size(); i++) {
16466        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16467      }
16468    };
16469    if (json.has("intendedEffect"))
16470      res.setIntendedEffect(parseCodeableConcept(json.getAsJsonObject("intendedEffect")));
16471    if (json.has("duration"))
16472      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
16473    if (json.has("undesirableEffects")) {
16474      JsonArray array = json.getAsJsonArray("undesirableEffects");
16475      for (int i = 0; i < array.size(); i++) {
16476        res.getUndesirableEffects().add(parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(array.get(i).getAsJsonObject(), owner));
16477      }
16478    };
16479    if (json.has("otherTherapy")) {
16480      JsonArray array = json.getAsJsonArray("otherTherapy");
16481      for (int i = 0; i < array.size(); i++) {
16482        res.getOtherTherapy().add(parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(array.get(i).getAsJsonObject(), owner));
16483      }
16484    };
16485    if (json.has("population")) {
16486      JsonArray array = json.getAsJsonArray("population");
16487      for (int i = 0; i < array.size(); i++) {
16488        res.getPopulation().add(parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(array.get(i).getAsJsonObject(), owner));
16489      }
16490    };
16491  }
16492
16493  protected MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
16494    MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent();
16495    parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponentProperties(json, owner, res);
16496    return res;
16497  }
16498
16499  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
16500    parseBackboneElementProperties(json, res);
16501    if (json.has("therapyRelationshipType"))
16502      res.setTherapyRelationshipType(parseCodeableConcept(json.getAsJsonObject("therapyRelationshipType")));
16503    Type medication = parseType("medication", json);
16504    if (medication != null)
16505      res.setMedication(medication);
16506  }
16507
16508  protected MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent parseMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
16509    MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent();
16510    parseMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponentProperties(json, owner, res);
16511    return res;
16512  }
16513
16514  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent res) throws IOException, FHIRFormatError {
16515    parseBackboneElementProperties(json, res);
16516    if (json.has("disease"))
16517      res.setDisease(parseCodeableConcept(json.getAsJsonObject("disease")));
16518    if (json.has("diseaseStatus"))
16519      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
16520    if (json.has("comorbidity")) {
16521      JsonArray array = json.getAsJsonArray("comorbidity");
16522      for (int i = 0; i < array.size(); i++) {
16523        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16524      }
16525    };
16526    if (json.has("therapeuticIndication")) {
16527      JsonArray array = json.getAsJsonArray("therapeuticIndication");
16528      for (int i = 0; i < array.size(); i++) {
16529        res.getTherapeuticIndication().add(parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(array.get(i).getAsJsonObject(), owner));
16530      }
16531    };
16532    if (json.has("otherTherapy")) {
16533      JsonArray array = json.getAsJsonArray("otherTherapy");
16534      for (int i = 0; i < array.size(); i++) {
16535        res.getOtherTherapy().add(parseMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(array.get(i).getAsJsonObject(), owner));
16536      }
16537    };
16538    if (json.has("population")) {
16539      JsonArray array = json.getAsJsonArray("population");
16540      for (int i = 0; i < array.size(); i++) {
16541        res.getPopulation().add(parseMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(array.get(i).getAsJsonObject(), owner));
16542      }
16543    };
16544  }
16545
16546  protected MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent parseMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponent(JsonObject json, MedicinalProductClinicals owner) throws IOException, FHIRFormatError {
16547    MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent res = new MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent();
16548    parseMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponentProperties(json, owner, res);
16549    return res;
16550  }
16551
16552  protected void parseMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponentProperties(JsonObject json, MedicinalProductClinicals owner, MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent res) throws IOException, FHIRFormatError {
16553    parseBackboneElementProperties(json, res);
16554    if (json.has("interaction"))
16555      res.setInteractionElement(parseString(json.get("interaction").getAsString()));
16556    if (json.has("_interaction"))
16557      parseElementProperties(json.getAsJsonObject("_interaction"), res.getInteractionElement());
16558    if (json.has("interactant")) {
16559      JsonArray array = json.getAsJsonArray("interactant");
16560      for (int i = 0; i < array.size(); i++) {
16561        res.getInteractant().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16562      }
16563    };
16564    if (json.has("type"))
16565      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16566    if (json.has("effect"))
16567      res.setEffect(parseCodeableConcept(json.getAsJsonObject("effect")));
16568    if (json.has("incidence"))
16569      res.setIncidence(parseCodeableConcept(json.getAsJsonObject("incidence")));
16570    if (json.has("management"))
16571      res.setManagement(parseCodeableConcept(json.getAsJsonObject("management")));
16572  }
16573
16574  protected MedicinalProductContraindication parseMedicinalProductContraindication(JsonObject json) throws IOException, FHIRFormatError {
16575    MedicinalProductContraindication res = new MedicinalProductContraindication();
16576    parseMedicinalProductContraindicationProperties(json, res);
16577    return res;
16578  }
16579
16580  protected void parseMedicinalProductContraindicationProperties(JsonObject json, MedicinalProductContraindication res) throws IOException, FHIRFormatError {
16581    parseDomainResourceProperties(json, res);
16582    if (json.has("subject")) {
16583      JsonArray array = json.getAsJsonArray("subject");
16584      for (int i = 0; i < array.size(); i++) {
16585        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
16586      }
16587    };
16588    if (json.has("disease"))
16589      res.setDisease(parseCodeableConcept(json.getAsJsonObject("disease")));
16590    if (json.has("diseaseStatus"))
16591      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
16592    if (json.has("comorbidity")) {
16593      JsonArray array = json.getAsJsonArray("comorbidity");
16594      for (int i = 0; i < array.size(); i++) {
16595        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16596      }
16597    };
16598    if (json.has("therapeuticIndication")) {
16599      JsonArray array = json.getAsJsonArray("therapeuticIndication");
16600      for (int i = 0; i < array.size(); i++) {
16601        res.getTherapeuticIndication().add(parseReference(array.get(i).getAsJsonObject()));
16602      }
16603    };
16604    if (json.has("otherTherapy")) {
16605      JsonArray array = json.getAsJsonArray("otherTherapy");
16606      for (int i = 0; i < array.size(); i++) {
16607        res.getOtherTherapy().add(parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(array.get(i).getAsJsonObject(), res));
16608      }
16609    };
16610    if (json.has("population")) {
16611      JsonArray array = json.getAsJsonArray("population");
16612      for (int i = 0; i < array.size(); i++) {
16613        res.getPopulation().add(parseMedicinalProductContraindicationMedicinalProductContraindicationPopulationComponent(array.get(i).getAsJsonObject(), res));
16614      }
16615    };
16616  }
16617
16618  protected MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(JsonObject json, MedicinalProductContraindication owner) throws IOException, FHIRFormatError {
16619    MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res = new MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent();
16620    parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(json, owner, res);
16621    return res;
16622  }
16623
16624  protected void parseMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductContraindication owner, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
16625    parseBackboneElementProperties(json, res);
16626    if (json.has("therapyRelationshipType"))
16627      res.setTherapyRelationshipType(parseCodeableConcept(json.getAsJsonObject("therapyRelationshipType")));
16628    Type medication = parseType("medication", json);
16629    if (medication != null)
16630      res.setMedication(medication);
16631  }
16632
16633  protected MedicinalProductContraindication.MedicinalProductContraindicationPopulationComponent parseMedicinalProductContraindicationMedicinalProductContraindicationPopulationComponent(JsonObject json, MedicinalProductContraindication owner) throws IOException, FHIRFormatError {
16634    MedicinalProductContraindication.MedicinalProductContraindicationPopulationComponent res = new MedicinalProductContraindication.MedicinalProductContraindicationPopulationComponent();
16635    parseMedicinalProductContraindicationMedicinalProductContraindicationPopulationComponentProperties(json, owner, res);
16636    return res;
16637  }
16638
16639  protected void parseMedicinalProductContraindicationMedicinalProductContraindicationPopulationComponentProperties(JsonObject json, MedicinalProductContraindication owner, MedicinalProductContraindication.MedicinalProductContraindicationPopulationComponent res) throws IOException, FHIRFormatError {
16640    parseBackboneElementProperties(json, res);
16641    Type age = parseType("age", json);
16642    if (age != null)
16643      res.setAge(age);
16644    if (json.has("gender"))
16645      res.setGender(parseCodeableConcept(json.getAsJsonObject("gender")));
16646    if (json.has("race"))
16647      res.setRace(parseCodeableConcept(json.getAsJsonObject("race")));
16648    if (json.has("physiologicalCondition"))
16649      res.setPhysiologicalCondition(parseCodeableConcept(json.getAsJsonObject("physiologicalCondition")));
16650  }
16651
16652  protected MedicinalProductDeviceSpec parseMedicinalProductDeviceSpec(JsonObject json) throws IOException, FHIRFormatError {
16653    MedicinalProductDeviceSpec res = new MedicinalProductDeviceSpec();
16654    parseMedicinalProductDeviceSpecProperties(json, res);
16655    return res;
16656  }
16657
16658  protected void parseMedicinalProductDeviceSpecProperties(JsonObject json, MedicinalProductDeviceSpec res) throws IOException, FHIRFormatError {
16659    parseDomainResourceProperties(json, res);
16660    if (json.has("identifier"))
16661      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
16662    if (json.has("type"))
16663      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16664    if (json.has("tradeName"))
16665      res.setTradeNameElement(parseString(json.get("tradeName").getAsString()));
16666    if (json.has("_tradeName"))
16667      parseElementProperties(json.getAsJsonObject("_tradeName"), res.getTradeNameElement());
16668    if (json.has("quantity"))
16669      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
16670    if (json.has("listingNumber"))
16671      res.setListingNumberElement(parseString(json.get("listingNumber").getAsString()));
16672    if (json.has("_listingNumber"))
16673      parseElementProperties(json.getAsJsonObject("_listingNumber"), res.getListingNumberElement());
16674    if (json.has("modelNumber"))
16675      res.setModelNumberElement(parseString(json.get("modelNumber").getAsString()));
16676    if (json.has("_modelNumber"))
16677      parseElementProperties(json.getAsJsonObject("_modelNumber"), res.getModelNumberElement());
16678    if (json.has("sterilityIndicator"))
16679      res.setSterilityIndicator(parseCodeableConcept(json.getAsJsonObject("sterilityIndicator")));
16680    if (json.has("sterilisationRequirement"))
16681      res.setSterilisationRequirement(parseCodeableConcept(json.getAsJsonObject("sterilisationRequirement")));
16682    if (json.has("usage"))
16683      res.setUsage(parseCodeableConcept(json.getAsJsonObject("usage")));
16684    if (json.has("nomenclature")) {
16685      JsonArray array = json.getAsJsonArray("nomenclature");
16686      for (int i = 0; i < array.size(); i++) {
16687        res.getNomenclature().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16688      }
16689    };
16690    if (json.has("shelfLifeStorage")) {
16691      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
16692      for (int i = 0; i < array.size(); i++) {
16693        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
16694      }
16695    };
16696    if (json.has("physicalCharacteristics"))
16697      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
16698    if (json.has("otherCharacteristics")) {
16699      JsonArray array = json.getAsJsonArray("otherCharacteristics");
16700      for (int i = 0; i < array.size(); i++) {
16701        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16702      }
16703    };
16704    if (json.has("batchIdentifier")) {
16705      JsonArray array = json.getAsJsonArray("batchIdentifier");
16706      for (int i = 0; i < array.size(); i++) {
16707        res.getBatchIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
16708      }
16709    };
16710    if (json.has("manufacturer")) {
16711      JsonArray array = json.getAsJsonArray("manufacturer");
16712      for (int i = 0; i < array.size(); i++) {
16713        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
16714      }
16715    };
16716    if (json.has("material")) {
16717      JsonArray array = json.getAsJsonArray("material");
16718      for (int i = 0; i < array.size(); i++) {
16719        res.getMaterial().add(parseMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponent(array.get(i).getAsJsonObject(), res));
16720      }
16721    };
16722  }
16723
16724  protected MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent parseMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponent(JsonObject json, MedicinalProductDeviceSpec owner) throws IOException, FHIRFormatError {
16725    MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent res = new MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent();
16726    parseMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponentProperties(json, owner, res);
16727    return res;
16728  }
16729
16730  protected void parseMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponentProperties(JsonObject json, MedicinalProductDeviceSpec owner, MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent res) throws IOException, FHIRFormatError {
16731    parseBackboneElementProperties(json, res);
16732    if (json.has("substance"))
16733      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
16734    if (json.has("alternate"))
16735      res.setAlternateElement(parseBoolean(json.get("alternate").getAsBoolean()));
16736    if (json.has("_alternate"))
16737      parseElementProperties(json.getAsJsonObject("_alternate"), res.getAlternateElement());
16738    if (json.has("allergenicIndicator"))
16739      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
16740    if (json.has("_allergenicIndicator"))
16741      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
16742  }
16743
16744  protected MedicinalProductIndication parseMedicinalProductIndication(JsonObject json) throws IOException, FHIRFormatError {
16745    MedicinalProductIndication res = new MedicinalProductIndication();
16746    parseMedicinalProductIndicationProperties(json, res);
16747    return res;
16748  }
16749
16750  protected void parseMedicinalProductIndicationProperties(JsonObject json, MedicinalProductIndication res) throws IOException, FHIRFormatError {
16751    parseDomainResourceProperties(json, res);
16752    if (json.has("subject")) {
16753      JsonArray array = json.getAsJsonArray("subject");
16754      for (int i = 0; i < array.size(); i++) {
16755        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
16756      }
16757    };
16758    if (json.has("diseaseSymptomProcedure"))
16759      res.setDiseaseSymptomProcedure(parseCodeableConcept(json.getAsJsonObject("diseaseSymptomProcedure")));
16760    if (json.has("diseaseStatus"))
16761      res.setDiseaseStatus(parseCodeableConcept(json.getAsJsonObject("diseaseStatus")));
16762    if (json.has("comorbidity")) {
16763      JsonArray array = json.getAsJsonArray("comorbidity");
16764      for (int i = 0; i < array.size(); i++) {
16765        res.getComorbidity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16766      }
16767    };
16768    if (json.has("intendedEffect"))
16769      res.setIntendedEffect(parseCodeableConcept(json.getAsJsonObject("intendedEffect")));
16770    if (json.has("duration"))
16771      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
16772    if (json.has("otherTherapy")) {
16773      JsonArray array = json.getAsJsonArray("otherTherapy");
16774      for (int i = 0; i < array.size(); i++) {
16775        res.getOtherTherapy().add(parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(array.get(i).getAsJsonObject(), res));
16776      }
16777    };
16778    if (json.has("undesirableEffect")) {
16779      JsonArray array = json.getAsJsonArray("undesirableEffect");
16780      for (int i = 0; i < array.size(); i++) {
16781        res.getUndesirableEffect().add(parseReference(array.get(i).getAsJsonObject()));
16782      }
16783    };
16784    if (json.has("population")) {
16785      JsonArray array = json.getAsJsonArray("population");
16786      for (int i = 0; i < array.size(); i++) {
16787        res.getPopulation().add(parseMedicinalProductIndicationMedicinalProductIndicationPopulationComponent(array.get(i).getAsJsonObject(), res));
16788      }
16789    };
16790  }
16791
16792  protected MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(JsonObject json, MedicinalProductIndication owner) throws IOException, FHIRFormatError {
16793    MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res = new MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent();
16794    parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(json, owner, res);
16795    return res;
16796  }
16797
16798  protected void parseMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentProperties(JsonObject json, MedicinalProductIndication owner, MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent res) throws IOException, FHIRFormatError {
16799    parseBackboneElementProperties(json, res);
16800    if (json.has("therapyRelationshipType"))
16801      res.setTherapyRelationshipType(parseCodeableConcept(json.getAsJsonObject("therapyRelationshipType")));
16802    Type medication = parseType("medication", json);
16803    if (medication != null)
16804      res.setMedication(medication);
16805  }
16806
16807  protected MedicinalProductIndication.MedicinalProductIndicationPopulationComponent parseMedicinalProductIndicationMedicinalProductIndicationPopulationComponent(JsonObject json, MedicinalProductIndication owner) throws IOException, FHIRFormatError {
16808    MedicinalProductIndication.MedicinalProductIndicationPopulationComponent res = new MedicinalProductIndication.MedicinalProductIndicationPopulationComponent();
16809    parseMedicinalProductIndicationMedicinalProductIndicationPopulationComponentProperties(json, owner, res);
16810    return res;
16811  }
16812
16813  protected void parseMedicinalProductIndicationMedicinalProductIndicationPopulationComponentProperties(JsonObject json, MedicinalProductIndication owner, MedicinalProductIndication.MedicinalProductIndicationPopulationComponent res) throws IOException, FHIRFormatError {
16814    parseBackboneElementProperties(json, res);
16815    Type age = parseType("age", json);
16816    if (age != null)
16817      res.setAge(age);
16818    if (json.has("gender"))
16819      res.setGender(parseCodeableConcept(json.getAsJsonObject("gender")));
16820    if (json.has("race"))
16821      res.setRace(parseCodeableConcept(json.getAsJsonObject("race")));
16822    if (json.has("physiologicalCondition"))
16823      res.setPhysiologicalCondition(parseCodeableConcept(json.getAsJsonObject("physiologicalCondition")));
16824  }
16825
16826  protected MedicinalProductIngredient parseMedicinalProductIngredient(JsonObject json) throws IOException, FHIRFormatError {
16827    MedicinalProductIngredient res = new MedicinalProductIngredient();
16828    parseMedicinalProductIngredientProperties(json, res);
16829    return res;
16830  }
16831
16832  protected void parseMedicinalProductIngredientProperties(JsonObject json, MedicinalProductIngredient res) throws IOException, FHIRFormatError {
16833    parseDomainResourceProperties(json, res);
16834    if (json.has("identifier"))
16835      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
16836    if (json.has("role"))
16837      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
16838    if (json.has("allergenicIndicator"))
16839      res.setAllergenicIndicatorElement(parseBoolean(json.get("allergenicIndicator").getAsBoolean()));
16840    if (json.has("_allergenicIndicator"))
16841      parseElementProperties(json.getAsJsonObject("_allergenicIndicator"), res.getAllergenicIndicatorElement());
16842    if (json.has("manufacturer")) {
16843      JsonArray array = json.getAsJsonArray("manufacturer");
16844      for (int i = 0; i < array.size(); i++) {
16845        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
16846      }
16847    };
16848    if (json.has("specifiedSubstance")) {
16849      JsonArray array = json.getAsJsonArray("specifiedSubstance");
16850      for (int i = 0; i < array.size(); i++) {
16851        res.getSpecifiedSubstance().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(array.get(i).getAsJsonObject(), res));
16852      }
16853    };
16854    if (json.has("substance"))
16855      res.setSubstance(parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(json.getAsJsonObject("substance"), res));
16856  }
16857
16858  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
16859    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent();
16860    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(json, owner, res);
16861    return res;
16862  }
16863
16864  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent res) throws IOException, FHIRFormatError {
16865    parseBackboneElementProperties(json, res);
16866    if (json.has("code"))
16867      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16868    if (json.has("group"))
16869      res.setGroup(parseCodeableConcept(json.getAsJsonObject("group")));
16870    if (json.has("confidentiality"))
16871      res.setConfidentiality(parseCodeableConcept(json.getAsJsonObject("confidentiality")));
16872    if (json.has("strength")) {
16873      JsonArray array = json.getAsJsonArray("strength");
16874      for (int i = 0; i < array.size(); i++) {
16875        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
16876      }
16877    };
16878  }
16879
16880  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
16881    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent();
16882    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(json, owner, res);
16883    return res;
16884  }
16885
16886  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent res) throws IOException, FHIRFormatError {
16887    parseBackboneElementProperties(json, res);
16888    if (json.has("presentation"))
16889      res.setPresentation(parseRatio(json.getAsJsonObject("presentation")));
16890    if (json.has("presentationLowLimit"))
16891      res.setPresentationLowLimit(parseRatio(json.getAsJsonObject("presentationLowLimit")));
16892    if (json.has("concentration"))
16893      res.setConcentration(parseRatio(json.getAsJsonObject("concentration")));
16894    if (json.has("concentrationLowLimit"))
16895      res.setConcentrationLowLimit(parseRatio(json.getAsJsonObject("concentrationLowLimit")));
16896    if (json.has("measurementPoint"))
16897      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
16898    if (json.has("_measurementPoint"))
16899      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
16900    if (json.has("country")) {
16901      JsonArray array = json.getAsJsonArray("country");
16902      for (int i = 0; i < array.size(); i++) {
16903        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16904      }
16905    };
16906    if (json.has("referenceStrength")) {
16907      JsonArray array = json.getAsJsonArray("referenceStrength");
16908      for (int i = 0; i < array.size(); i++) {
16909        res.getReferenceStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(array.get(i).getAsJsonObject(), owner));
16910      }
16911    };
16912  }
16913
16914  protected MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
16915    MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent();
16916    parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(json, owner, res);
16917    return res;
16918  }
16919
16920  protected void parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent res) throws IOException, FHIRFormatError {
16921    parseBackboneElementProperties(json, res);
16922    if (json.has("substance"))
16923      res.setSubstance(parseCodeableConcept(json.getAsJsonObject("substance")));
16924    if (json.has("strength"))
16925      res.setStrength(parseRatio(json.getAsJsonObject("strength")));
16926    if (json.has("measurementPoint"))
16927      res.setMeasurementPointElement(parseString(json.get("measurementPoint").getAsString()));
16928    if (json.has("_measurementPoint"))
16929      parseElementProperties(json.getAsJsonObject("_measurementPoint"), res.getMeasurementPointElement());
16930    if (json.has("country")) {
16931      JsonArray array = json.getAsJsonArray("country");
16932      for (int i = 0; i < array.size(); i++) {
16933        res.getCountry().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16934      }
16935    };
16936  }
16937
16938  protected MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(JsonObject json, MedicinalProductIngredient owner) throws IOException, FHIRFormatError {
16939    MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res = new MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent();
16940    parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(json, owner, res);
16941    return res;
16942  }
16943
16944  protected void parseMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentProperties(JsonObject json, MedicinalProductIngredient owner, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent res) throws IOException, FHIRFormatError {
16945    parseBackboneElementProperties(json, res);
16946    if (json.has("code"))
16947      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
16948    if (json.has("strength")) {
16949      JsonArray array = json.getAsJsonArray("strength");
16950      for (int i = 0; i < array.size(); i++) {
16951        res.getStrength().add(parseMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(array.get(i).getAsJsonObject(), owner));
16952      }
16953    };
16954  }
16955
16956  protected MedicinalProductInteraction parseMedicinalProductInteraction(JsonObject json) throws IOException, FHIRFormatError {
16957    MedicinalProductInteraction res = new MedicinalProductInteraction();
16958    parseMedicinalProductInteractionProperties(json, res);
16959    return res;
16960  }
16961
16962  protected void parseMedicinalProductInteractionProperties(JsonObject json, MedicinalProductInteraction res) throws IOException, FHIRFormatError {
16963    parseDomainResourceProperties(json, res);
16964    if (json.has("subject")) {
16965      JsonArray array = json.getAsJsonArray("subject");
16966      for (int i = 0; i < array.size(); i++) {
16967        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
16968      }
16969    };
16970    if (json.has("interaction"))
16971      res.setInteractionElement(parseString(json.get("interaction").getAsString()));
16972    if (json.has("_interaction"))
16973      parseElementProperties(json.getAsJsonObject("_interaction"), res.getInteractionElement());
16974    if (json.has("interactant")) {
16975      JsonArray array = json.getAsJsonArray("interactant");
16976      for (int i = 0; i < array.size(); i++) {
16977        res.getInteractant().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
16978      }
16979    };
16980    if (json.has("type"))
16981      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
16982    if (json.has("effect"))
16983      res.setEffect(parseCodeableConcept(json.getAsJsonObject("effect")));
16984    if (json.has("incidence"))
16985      res.setIncidence(parseCodeableConcept(json.getAsJsonObject("incidence")));
16986    if (json.has("management"))
16987      res.setManagement(parseCodeableConcept(json.getAsJsonObject("management")));
16988  }
16989
16990  protected MedicinalProductManufactured parseMedicinalProductManufactured(JsonObject json) throws IOException, FHIRFormatError {
16991    MedicinalProductManufactured res = new MedicinalProductManufactured();
16992    parseMedicinalProductManufacturedProperties(json, res);
16993    return res;
16994  }
16995
16996  protected void parseMedicinalProductManufacturedProperties(JsonObject json, MedicinalProductManufactured res) throws IOException, FHIRFormatError {
16997    parseDomainResourceProperties(json, res);
16998    if (json.has("manufacturedDoseForm"))
16999      res.setManufacturedDoseForm(parseCodeableConcept(json.getAsJsonObject("manufacturedDoseForm")));
17000    if (json.has("unitOfPresentation"))
17001      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
17002    if (json.has("quantity"))
17003      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17004    if (json.has("manufacturer")) {
17005      JsonArray array = json.getAsJsonArray("manufacturer");
17006      for (int i = 0; i < array.size(); i++) {
17007        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17008      }
17009    };
17010    if (json.has("ingredient")) {
17011      JsonArray array = json.getAsJsonArray("ingredient");
17012      for (int i = 0; i < array.size(); i++) {
17013        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
17014      }
17015    };
17016    if (json.has("physicalCharacteristics"))
17017      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
17018    if (json.has("otherCharacteristics")) {
17019      JsonArray array = json.getAsJsonArray("otherCharacteristics");
17020      for (int i = 0; i < array.size(); i++) {
17021        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17022      }
17023    };
17024  }
17025
17026  protected MedicinalProductPackaged parseMedicinalProductPackaged(JsonObject json) throws IOException, FHIRFormatError {
17027    MedicinalProductPackaged res = new MedicinalProductPackaged();
17028    parseMedicinalProductPackagedProperties(json, res);
17029    return res;
17030  }
17031
17032  protected void parseMedicinalProductPackagedProperties(JsonObject json, MedicinalProductPackaged res) throws IOException, FHIRFormatError {
17033    parseDomainResourceProperties(json, res);
17034    if (json.has("identifier"))
17035      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
17036    if (json.has("description"))
17037      res.setDescriptionElement(parseString(json.get("description").getAsString()));
17038    if (json.has("_description"))
17039      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17040    if (json.has("marketingStatus")) {
17041      JsonArray array = json.getAsJsonArray("marketingStatus");
17042      for (int i = 0; i < array.size(); i++) {
17043        res.getMarketingStatus().add(parseMarketingStatus(array.get(i).getAsJsonObject()));
17044      }
17045    };
17046    if (json.has("marketingAuthorization"))
17047      res.setMarketingAuthorization(parseReference(json.getAsJsonObject("marketingAuthorization")));
17048    if (json.has("manufacturer")) {
17049      JsonArray array = json.getAsJsonArray("manufacturer");
17050      for (int i = 0; i < array.size(); i++) {
17051        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17052      }
17053    };
17054    if (json.has("batchIdentifier")) {
17055      JsonArray array = json.getAsJsonArray("batchIdentifier");
17056      for (int i = 0; i < array.size(); i++) {
17057        res.getBatchIdentifier().add(parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(array.get(i).getAsJsonObject(), res));
17058      }
17059    };
17060    if (json.has("packageItem")) {
17061      JsonArray array = json.getAsJsonArray("packageItem");
17062      for (int i = 0; i < array.size(); i++) {
17063        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), res));
17064      }
17065    };
17066  }
17067
17068  protected MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
17069    MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res = new MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent();
17070    parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(json, owner, res);
17071    return res;
17072  }
17073
17074  protected void parseMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent res) throws IOException, FHIRFormatError {
17075    parseBackboneElementProperties(json, res);
17076    if (json.has("outerPackaging"))
17077      res.setOuterPackaging(parseIdentifier(json.getAsJsonObject("outerPackaging")));
17078    if (json.has("immediatePackaging"))
17079      res.setImmediatePackaging(parseIdentifier(json.getAsJsonObject("immediatePackaging")));
17080  }
17081
17082  protected MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(JsonObject json, MedicinalProductPackaged owner) throws IOException, FHIRFormatError {
17083    MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res = new MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent();
17084    parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(json, owner, res);
17085    return res;
17086  }
17087
17088  protected void parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentProperties(JsonObject json, MedicinalProductPackaged owner, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent res) throws IOException, FHIRFormatError {
17089    parseBackboneElementProperties(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("type"))
17097      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17098    if (json.has("quantity"))
17099      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17100    if (json.has("material")) {
17101      JsonArray array = json.getAsJsonArray("material");
17102      for (int i = 0; i < array.size(); i++) {
17103        res.getMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17104      }
17105    };
17106    if (json.has("alternateMaterial")) {
17107      JsonArray array = json.getAsJsonArray("alternateMaterial");
17108      for (int i = 0; i < array.size(); i++) {
17109        res.getAlternateMaterial().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17110      }
17111    };
17112    if (json.has("device")) {
17113      JsonArray array = json.getAsJsonArray("device");
17114      for (int i = 0; i < array.size(); i++) {
17115        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17116      }
17117    };
17118    if (json.has("manufacturedItem")) {
17119      JsonArray array = json.getAsJsonArray("manufacturedItem");
17120      for (int i = 0; i < array.size(); i++) {
17121        res.getManufacturedItem().add(parseReference(array.get(i).getAsJsonObject()));
17122      }
17123    };
17124    if (json.has("packageItem")) {
17125      JsonArray array = json.getAsJsonArray("packageItem");
17126      for (int i = 0; i < array.size(); i++) {
17127        res.getPackageItem().add(parseMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(array.get(i).getAsJsonObject(), owner));
17128      }
17129    };
17130    if (json.has("physicalCharacteristics"))
17131      res.setPhysicalCharacteristics(parseProdCharacteristic(json.getAsJsonObject("physicalCharacteristics")));
17132    if (json.has("otherCharacteristics")) {
17133      JsonArray array = json.getAsJsonArray("otherCharacteristics");
17134      for (int i = 0; i < array.size(); i++) {
17135        res.getOtherCharacteristics().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17136      }
17137    };
17138    if (json.has("shelfLifeStorage")) {
17139      JsonArray array = json.getAsJsonArray("shelfLifeStorage");
17140      for (int i = 0; i < array.size(); i++) {
17141        res.getShelfLifeStorage().add(parseProductShelfLife(array.get(i).getAsJsonObject()));
17142      }
17143    };
17144    if (json.has("manufacturer")) {
17145      JsonArray array = json.getAsJsonArray("manufacturer");
17146      for (int i = 0; i < array.size(); i++) {
17147        res.getManufacturer().add(parseReference(array.get(i).getAsJsonObject()));
17148      }
17149    };
17150  }
17151
17152  protected MedicinalProductPharmaceutical parseMedicinalProductPharmaceutical(JsonObject json) throws IOException, FHIRFormatError {
17153    MedicinalProductPharmaceutical res = new MedicinalProductPharmaceutical();
17154    parseMedicinalProductPharmaceuticalProperties(json, res);
17155    return res;
17156  }
17157
17158  protected void parseMedicinalProductPharmaceuticalProperties(JsonObject json, MedicinalProductPharmaceutical res) throws IOException, FHIRFormatError {
17159    parseDomainResourceProperties(json, res);
17160    if (json.has("identifier")) {
17161      JsonArray array = json.getAsJsonArray("identifier");
17162      for (int i = 0; i < array.size(); i++) {
17163        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17164      }
17165    };
17166    if (json.has("administrableDoseForm"))
17167      res.setAdministrableDoseForm(parseCodeableConcept(json.getAsJsonObject("administrableDoseForm")));
17168    if (json.has("unitOfPresentation"))
17169      res.setUnitOfPresentation(parseCodeableConcept(json.getAsJsonObject("unitOfPresentation")));
17170    if (json.has("ingredient")) {
17171      JsonArray array = json.getAsJsonArray("ingredient");
17172      for (int i = 0; i < array.size(); i++) {
17173        res.getIngredient().add(parseReference(array.get(i).getAsJsonObject()));
17174      }
17175    };
17176    if (json.has("device")) {
17177      JsonArray array = json.getAsJsonArray("device");
17178      for (int i = 0; i < array.size(); i++) {
17179        res.getDevice().add(parseReference(array.get(i).getAsJsonObject()));
17180      }
17181    };
17182    if (json.has("characteristics")) {
17183      JsonArray array = json.getAsJsonArray("characteristics");
17184      for (int i = 0; i < array.size(); i++) {
17185        res.getCharacteristics().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(array.get(i).getAsJsonObject(), res));
17186      }
17187    };
17188    if (json.has("routeOfAdministration")) {
17189      JsonArray array = json.getAsJsonArray("routeOfAdministration");
17190      for (int i = 0; i < array.size(); i++) {
17191        res.getRouteOfAdministration().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(array.get(i).getAsJsonObject(), res));
17192      }
17193    };
17194  }
17195
17196  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17197    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent();
17198    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(json, owner, res);
17199    return res;
17200  }
17201
17202  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent res) throws IOException, FHIRFormatError {
17203    parseBackboneElementProperties(json, res);
17204    if (json.has("code"))
17205      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17206    if (json.has("status"))
17207      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
17208  }
17209
17210  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17211    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent();
17212    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(json, owner, res);
17213    return res;
17214  }
17215
17216  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent res) throws IOException, FHIRFormatError {
17217    parseBackboneElementProperties(json, res);
17218    if (json.has("code"))
17219      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17220    if (json.has("firstDose"))
17221      res.setFirstDose(parseQuantity(json.getAsJsonObject("firstDose")));
17222    if (json.has("maxSingleDose"))
17223      res.setMaxSingleDose(parseQuantity(json.getAsJsonObject("maxSingleDose")));
17224    if (json.has("maxDosePerDay"))
17225      res.setMaxDosePerDay(parseQuantity(json.getAsJsonObject("maxDosePerDay")));
17226    if (json.has("maxDosePerTreatmentPeriod"))
17227      res.setMaxDosePerTreatmentPeriod(parseRatio(json.getAsJsonObject("maxDosePerTreatmentPeriod")));
17228    if (json.has("maxTreatmentPeriod"))
17229      res.setMaxTreatmentPeriod(parseDuration(json.getAsJsonObject("maxTreatmentPeriod")));
17230    if (json.has("targetSpecies")) {
17231      JsonArray array = json.getAsJsonArray("targetSpecies");
17232      for (int i = 0; i < array.size(); i++) {
17233        res.getTargetSpecies().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(array.get(i).getAsJsonObject(), owner));
17234      }
17235    };
17236  }
17237
17238  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17239    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent();
17240    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(json, owner, res);
17241    return res;
17242  }
17243
17244  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent res) throws IOException, FHIRFormatError {
17245    parseBackboneElementProperties(json, res);
17246    if (json.has("code"))
17247      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
17248    if (json.has("withdrawalPeriod")) {
17249      JsonArray array = json.getAsJsonArray("withdrawalPeriod");
17250      for (int i = 0; i < array.size(); i++) {
17251        res.getWithdrawalPeriod().add(parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(array.get(i).getAsJsonObject(), owner));
17252      }
17253    };
17254  }
17255
17256  protected MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(JsonObject json, MedicinalProductPharmaceutical owner) throws IOException, FHIRFormatError {
17257    MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res = new MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent();
17258    parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(json, owner, res);
17259    return res;
17260  }
17261
17262  protected void parseMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentProperties(JsonObject json, MedicinalProductPharmaceutical owner, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent res) throws IOException, FHIRFormatError {
17263    parseBackboneElementProperties(json, res);
17264    if (json.has("tissue"))
17265      res.setTissue(parseCodeableConcept(json.getAsJsonObject("tissue")));
17266    if (json.has("value"))
17267      res.setValue(parseQuantity(json.getAsJsonObject("value")));
17268    if (json.has("supportingInformation"))
17269      res.setSupportingInformationElement(parseString(json.get("supportingInformation").getAsString()));
17270    if (json.has("_supportingInformation"))
17271      parseElementProperties(json.getAsJsonObject("_supportingInformation"), res.getSupportingInformationElement());
17272  }
17273
17274  protected MedicinalProductUndesirableEffect parseMedicinalProductUndesirableEffect(JsonObject json) throws IOException, FHIRFormatError {
17275    MedicinalProductUndesirableEffect res = new MedicinalProductUndesirableEffect();
17276    parseMedicinalProductUndesirableEffectProperties(json, res);
17277    return res;
17278  }
17279
17280  protected void parseMedicinalProductUndesirableEffectProperties(JsonObject json, MedicinalProductUndesirableEffect res) throws IOException, FHIRFormatError {
17281    parseDomainResourceProperties(json, res);
17282    if (json.has("subject")) {
17283      JsonArray array = json.getAsJsonArray("subject");
17284      for (int i = 0; i < array.size(); i++) {
17285        res.getSubject().add(parseReference(array.get(i).getAsJsonObject()));
17286      }
17287    };
17288    if (json.has("symptomConditionEffect"))
17289      res.setSymptomConditionEffect(parseCodeableConcept(json.getAsJsonObject("symptomConditionEffect")));
17290    if (json.has("classification"))
17291      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
17292    if (json.has("frequencyOfOccurrence"))
17293      res.setFrequencyOfOccurrence(parseCodeableConcept(json.getAsJsonObject("frequencyOfOccurrence")));
17294    if (json.has("population")) {
17295      JsonArray array = json.getAsJsonArray("population");
17296      for (int i = 0; i < array.size(); i++) {
17297        res.getPopulation().add(parseMedicinalProductUndesirableEffectMedicinalProductUndesirableEffectPopulationComponent(array.get(i).getAsJsonObject(), res));
17298      }
17299    };
17300  }
17301
17302  protected MedicinalProductUndesirableEffect.MedicinalProductUndesirableEffectPopulationComponent parseMedicinalProductUndesirableEffectMedicinalProductUndesirableEffectPopulationComponent(JsonObject json, MedicinalProductUndesirableEffect owner) throws IOException, FHIRFormatError {
17303    MedicinalProductUndesirableEffect.MedicinalProductUndesirableEffectPopulationComponent res = new MedicinalProductUndesirableEffect.MedicinalProductUndesirableEffectPopulationComponent();
17304    parseMedicinalProductUndesirableEffectMedicinalProductUndesirableEffectPopulationComponentProperties(json, owner, res);
17305    return res;
17306  }
17307
17308  protected void parseMedicinalProductUndesirableEffectMedicinalProductUndesirableEffectPopulationComponentProperties(JsonObject json, MedicinalProductUndesirableEffect owner, MedicinalProductUndesirableEffect.MedicinalProductUndesirableEffectPopulationComponent res) throws IOException, FHIRFormatError {
17309    parseBackboneElementProperties(json, res);
17310    Type age = parseType("age", json);
17311    if (age != null)
17312      res.setAge(age);
17313    if (json.has("gender"))
17314      res.setGender(parseCodeableConcept(json.getAsJsonObject("gender")));
17315    if (json.has("race"))
17316      res.setRace(parseCodeableConcept(json.getAsJsonObject("race")));
17317    if (json.has("physiologicalCondition"))
17318      res.setPhysiologicalCondition(parseCodeableConcept(json.getAsJsonObject("physiologicalCondition")));
17319  }
17320
17321  protected MessageDefinition parseMessageDefinition(JsonObject json) throws IOException, FHIRFormatError {
17322    MessageDefinition res = new MessageDefinition();
17323    parseMessageDefinitionProperties(json, res);
17324    return res;
17325  }
17326
17327  protected void parseMessageDefinitionProperties(JsonObject json, MessageDefinition res) throws IOException, FHIRFormatError {
17328    parseDomainResourceProperties(json, res);
17329    if (json.has("url"))
17330      res.setUrlElement(parseUri(json.get("url").getAsString()));
17331    if (json.has("_url"))
17332      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
17333    if (json.has("identifier")) {
17334      JsonArray array = json.getAsJsonArray("identifier");
17335      for (int i = 0; i < array.size(); i++) {
17336        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17337      }
17338    };
17339    if (json.has("version"))
17340      res.setVersionElement(parseString(json.get("version").getAsString()));
17341    if (json.has("_version"))
17342      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
17343    if (json.has("name"))
17344      res.setNameElement(parseString(json.get("name").getAsString()));
17345    if (json.has("_name"))
17346      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17347    if (json.has("title"))
17348      res.setTitleElement(parseString(json.get("title").getAsString()));
17349    if (json.has("_title"))
17350      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
17351    if (json.has("replaces")) {
17352      JsonArray array = json.getAsJsonArray("replaces");
17353      for (int i = 0; i < array.size(); i++) {
17354        res.getReplaces().add(parseCanonical(array.get(i).getAsString()));
17355      }
17356    };
17357    if (json.has("_replaces")) {
17358      JsonArray array = json.getAsJsonArray("_replaces");
17359      for (int i = 0; i < array.size(); i++) {
17360        if (i == res.getReplaces().size())
17361          res.getReplaces().add(parseCanonical(null));
17362        if (array.get(i) instanceof JsonObject) 
17363          parseElementProperties(array.get(i).getAsJsonObject(), res.getReplaces().get(i));
17364      }
17365    };
17366    if (json.has("status"))
17367      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17368    if (json.has("_status"))
17369      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17370    if (json.has("experimental"))
17371      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
17372    if (json.has("_experimental"))
17373      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
17374    if (json.has("date"))
17375      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17376    if (json.has("_date"))
17377      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17378    if (json.has("publisher"))
17379      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17380    if (json.has("_publisher"))
17381      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
17382    if (json.has("contact")) {
17383      JsonArray array = json.getAsJsonArray("contact");
17384      for (int i = 0; i < array.size(); i++) {
17385        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17386      }
17387    };
17388    if (json.has("description"))
17389      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17390    if (json.has("_description"))
17391      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17392    if (json.has("useContext")) {
17393      JsonArray array = json.getAsJsonArray("useContext");
17394      for (int i = 0; i < array.size(); i++) {
17395        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17396      }
17397    };
17398    if (json.has("jurisdiction")) {
17399      JsonArray array = json.getAsJsonArray("jurisdiction");
17400      for (int i = 0; i < array.size(); i++) {
17401        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17402      }
17403    };
17404    if (json.has("purpose"))
17405      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
17406    if (json.has("_purpose"))
17407      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
17408    if (json.has("copyright"))
17409      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
17410    if (json.has("_copyright"))
17411      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
17412    if (json.has("base"))
17413      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
17414    if (json.has("_base"))
17415      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
17416    if (json.has("parent")) {
17417      JsonArray array = json.getAsJsonArray("parent");
17418      for (int i = 0; i < array.size(); i++) {
17419        res.getParent().add(parseCanonical(array.get(i).getAsString()));
17420      }
17421    };
17422    if (json.has("_parent")) {
17423      JsonArray array = json.getAsJsonArray("_parent");
17424      for (int i = 0; i < array.size(); i++) {
17425        if (i == res.getParent().size())
17426          res.getParent().add(parseCanonical(null));
17427        if (array.get(i) instanceof JsonObject) 
17428          parseElementProperties(array.get(i).getAsJsonObject(), res.getParent().get(i));
17429      }
17430    };
17431    Type event = parseType("event", json);
17432    if (event != null)
17433      res.setEvent(event);
17434    if (json.has("category"))
17435      res.setCategoryElement(parseEnumeration(json.get("category").getAsString(), MessageDefinition.MessageSignificanceCategory.NULL, new MessageDefinition.MessageSignificanceCategoryEnumFactory()));
17436    if (json.has("_category"))
17437      parseElementProperties(json.getAsJsonObject("_category"), res.getCategoryElement());
17438    if (json.has("focus")) {
17439      JsonArray array = json.getAsJsonArray("focus");
17440      for (int i = 0; i < array.size(); i++) {
17441        res.getFocus().add(parseMessageDefinitionMessageDefinitionFocusComponent(array.get(i).getAsJsonObject(), res));
17442      }
17443    };
17444    if (json.has("responseRequired"))
17445      res.setResponseRequiredElement(parseEnumeration(json.get("responseRequired").getAsString(), MessageDefinition.MessageheaderResponseRequest.NULL, new MessageDefinition.MessageheaderResponseRequestEnumFactory()));
17446    if (json.has("_responseRequired"))
17447      parseElementProperties(json.getAsJsonObject("_responseRequired"), res.getResponseRequiredElement());
17448    if (json.has("allowedResponse")) {
17449      JsonArray array = json.getAsJsonArray("allowedResponse");
17450      for (int i = 0; i < array.size(); i++) {
17451        res.getAllowedResponse().add(parseMessageDefinitionMessageDefinitionAllowedResponseComponent(array.get(i).getAsJsonObject(), res));
17452      }
17453    };
17454    if (json.has("graph")) {
17455      JsonArray array = json.getAsJsonArray("graph");
17456      for (int i = 0; i < array.size(); i++) {
17457        res.getGraph().add(parseCanonical(array.get(i).getAsString()));
17458      }
17459    };
17460    if (json.has("_graph")) {
17461      JsonArray array = json.getAsJsonArray("_graph");
17462      for (int i = 0; i < array.size(); i++) {
17463        if (i == res.getGraph().size())
17464          res.getGraph().add(parseCanonical(null));
17465        if (array.get(i) instanceof JsonObject) 
17466          parseElementProperties(array.get(i).getAsJsonObject(), res.getGraph().get(i));
17467      }
17468    };
17469  }
17470
17471  protected MessageDefinition.MessageDefinitionFocusComponent parseMessageDefinitionMessageDefinitionFocusComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
17472    MessageDefinition.MessageDefinitionFocusComponent res = new MessageDefinition.MessageDefinitionFocusComponent();
17473    parseMessageDefinitionMessageDefinitionFocusComponentProperties(json, owner, res);
17474    return res;
17475  }
17476
17477  protected void parseMessageDefinitionMessageDefinitionFocusComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionFocusComponent res) throws IOException, FHIRFormatError {
17478    parseBackboneElementProperties(json, res);
17479    if (json.has("code"))
17480      res.setCodeElement(parseCode(json.get("code").getAsString()));
17481    if (json.has("_code"))
17482      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
17483    if (json.has("profile"))
17484      res.setProfileElement(parseCanonical(json.get("profile").getAsString()));
17485    if (json.has("_profile"))
17486      parseElementProperties(json.getAsJsonObject("_profile"), res.getProfileElement());
17487    if (json.has("min"))
17488      res.setMinElement(parseUnsignedInt(json.get("min").getAsString()));
17489    if (json.has("_min"))
17490      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
17491    if (json.has("max"))
17492      res.setMaxElement(parseString(json.get("max").getAsString()));
17493    if (json.has("_max"))
17494      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
17495  }
17496
17497  protected MessageDefinition.MessageDefinitionAllowedResponseComponent parseMessageDefinitionMessageDefinitionAllowedResponseComponent(JsonObject json, MessageDefinition owner) throws IOException, FHIRFormatError {
17498    MessageDefinition.MessageDefinitionAllowedResponseComponent res = new MessageDefinition.MessageDefinitionAllowedResponseComponent();
17499    parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(json, owner, res);
17500    return res;
17501  }
17502
17503  protected void parseMessageDefinitionMessageDefinitionAllowedResponseComponentProperties(JsonObject json, MessageDefinition owner, MessageDefinition.MessageDefinitionAllowedResponseComponent res) throws IOException, FHIRFormatError {
17504    parseBackboneElementProperties(json, res);
17505    if (json.has("message"))
17506      res.setMessageElement(parseCanonical(json.get("message").getAsString()));
17507    if (json.has("_message"))
17508      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
17509    if (json.has("situation"))
17510      res.setSituationElement(parseMarkdown(json.get("situation").getAsString()));
17511    if (json.has("_situation"))
17512      parseElementProperties(json.getAsJsonObject("_situation"), res.getSituationElement());
17513  }
17514
17515  protected MessageHeader parseMessageHeader(JsonObject json) throws IOException, FHIRFormatError {
17516    MessageHeader res = new MessageHeader();
17517    parseMessageHeaderProperties(json, res);
17518    return res;
17519  }
17520
17521  protected void parseMessageHeaderProperties(JsonObject json, MessageHeader res) throws IOException, FHIRFormatError {
17522    parseDomainResourceProperties(json, res);
17523    Type event = parseType("event", json);
17524    if (event != null)
17525      res.setEvent(event);
17526    if (json.has("destination")) {
17527      JsonArray array = json.getAsJsonArray("destination");
17528      for (int i = 0; i < array.size(); i++) {
17529        res.getDestination().add(parseMessageHeaderMessageDestinationComponent(array.get(i).getAsJsonObject(), res));
17530      }
17531    };
17532    if (json.has("sender"))
17533      res.setSender(parseReference(json.getAsJsonObject("sender")));
17534    if (json.has("enterer"))
17535      res.setEnterer(parseReference(json.getAsJsonObject("enterer")));
17536    if (json.has("author"))
17537      res.setAuthor(parseReference(json.getAsJsonObject("author")));
17538    if (json.has("source"))
17539      res.setSource(parseMessageHeaderMessageSourceComponent(json.getAsJsonObject("source"), res));
17540    if (json.has("responsible"))
17541      res.setResponsible(parseReference(json.getAsJsonObject("responsible")));
17542    if (json.has("reason"))
17543      res.setReason(parseCodeableConcept(json.getAsJsonObject("reason")));
17544    if (json.has("response"))
17545      res.setResponse(parseMessageHeaderMessageHeaderResponseComponent(json.getAsJsonObject("response"), res));
17546    if (json.has("focus")) {
17547      JsonArray array = json.getAsJsonArray("focus");
17548      for (int i = 0; i < array.size(); i++) {
17549        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
17550      }
17551    };
17552    if (json.has("definition"))
17553      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
17554    if (json.has("_definition"))
17555      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
17556  }
17557
17558  protected MessageHeader.MessageDestinationComponent parseMessageHeaderMessageDestinationComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
17559    MessageHeader.MessageDestinationComponent res = new MessageHeader.MessageDestinationComponent();
17560    parseMessageHeaderMessageDestinationComponentProperties(json, owner, res);
17561    return res;
17562  }
17563
17564  protected void parseMessageHeaderMessageDestinationComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageDestinationComponent res) throws IOException, FHIRFormatError {
17565    parseBackboneElementProperties(json, res);
17566    if (json.has("name"))
17567      res.setNameElement(parseString(json.get("name").getAsString()));
17568    if (json.has("_name"))
17569      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17570    if (json.has("target"))
17571      res.setTarget(parseReference(json.getAsJsonObject("target")));
17572    if (json.has("endpoint"))
17573      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
17574    if (json.has("_endpoint"))
17575      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
17576    if (json.has("receiver"))
17577      res.setReceiver(parseReference(json.getAsJsonObject("receiver")));
17578  }
17579
17580  protected MessageHeader.MessageSourceComponent parseMessageHeaderMessageSourceComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
17581    MessageHeader.MessageSourceComponent res = new MessageHeader.MessageSourceComponent();
17582    parseMessageHeaderMessageSourceComponentProperties(json, owner, res);
17583    return res;
17584  }
17585
17586  protected void parseMessageHeaderMessageSourceComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageSourceComponent res) throws IOException, FHIRFormatError {
17587    parseBackboneElementProperties(json, res);
17588    if (json.has("name"))
17589      res.setNameElement(parseString(json.get("name").getAsString()));
17590    if (json.has("_name"))
17591      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17592    if (json.has("software"))
17593      res.setSoftwareElement(parseString(json.get("software").getAsString()));
17594    if (json.has("_software"))
17595      parseElementProperties(json.getAsJsonObject("_software"), res.getSoftwareElement());
17596    if (json.has("version"))
17597      res.setVersionElement(parseString(json.get("version").getAsString()));
17598    if (json.has("_version"))
17599      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
17600    if (json.has("contact"))
17601      res.setContact(parseContactPoint(json.getAsJsonObject("contact")));
17602    if (json.has("endpoint"))
17603      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
17604    if (json.has("_endpoint"))
17605      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
17606  }
17607
17608  protected MessageHeader.MessageHeaderResponseComponent parseMessageHeaderMessageHeaderResponseComponent(JsonObject json, MessageHeader owner) throws IOException, FHIRFormatError {
17609    MessageHeader.MessageHeaderResponseComponent res = new MessageHeader.MessageHeaderResponseComponent();
17610    parseMessageHeaderMessageHeaderResponseComponentProperties(json, owner, res);
17611    return res;
17612  }
17613
17614  protected void parseMessageHeaderMessageHeaderResponseComponentProperties(JsonObject json, MessageHeader owner, MessageHeader.MessageHeaderResponseComponent res) throws IOException, FHIRFormatError {
17615    parseBackboneElementProperties(json, res);
17616    if (json.has("identifier"))
17617      res.setIdentifierElement(parseId(json.get("identifier").getAsString()));
17618    if (json.has("_identifier"))
17619      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
17620    if (json.has("code"))
17621      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), MessageHeader.ResponseType.NULL, new MessageHeader.ResponseTypeEnumFactory()));
17622    if (json.has("_code"))
17623      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
17624    if (json.has("details"))
17625      res.setDetails(parseReference(json.getAsJsonObject("details")));
17626  }
17627
17628  protected NamingSystem parseNamingSystem(JsonObject json) throws IOException, FHIRFormatError {
17629    NamingSystem res = new NamingSystem();
17630    parseNamingSystemProperties(json, res);
17631    return res;
17632  }
17633
17634  protected void parseNamingSystemProperties(JsonObject json, NamingSystem res) throws IOException, FHIRFormatError {
17635    parseDomainResourceProperties(json, res);
17636    if (json.has("name"))
17637      res.setNameElement(parseString(json.get("name").getAsString()));
17638    if (json.has("_name"))
17639      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
17640    if (json.has("status"))
17641      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
17642    if (json.has("_status"))
17643      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17644    if (json.has("kind"))
17645      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), NamingSystem.NamingSystemType.NULL, new NamingSystem.NamingSystemTypeEnumFactory()));
17646    if (json.has("_kind"))
17647      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
17648    if (json.has("date"))
17649      res.setDateElement(parseDateTime(json.get("date").getAsString()));
17650    if (json.has("_date"))
17651      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
17652    if (json.has("publisher"))
17653      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
17654    if (json.has("_publisher"))
17655      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
17656    if (json.has("contact")) {
17657      JsonArray array = json.getAsJsonArray("contact");
17658      for (int i = 0; i < array.size(); i++) {
17659        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
17660      }
17661    };
17662    if (json.has("responsible"))
17663      res.setResponsibleElement(parseString(json.get("responsible").getAsString()));
17664    if (json.has("_responsible"))
17665      parseElementProperties(json.getAsJsonObject("_responsible"), res.getResponsibleElement());
17666    if (json.has("type"))
17667      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17668    if (json.has("description"))
17669      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
17670    if (json.has("_description"))
17671      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
17672    if (json.has("useContext")) {
17673      JsonArray array = json.getAsJsonArray("useContext");
17674      for (int i = 0; i < array.size(); i++) {
17675        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
17676      }
17677    };
17678    if (json.has("jurisdiction")) {
17679      JsonArray array = json.getAsJsonArray("jurisdiction");
17680      for (int i = 0; i < array.size(); i++) {
17681        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17682      }
17683    };
17684    if (json.has("usage"))
17685      res.setUsageElement(parseString(json.get("usage").getAsString()));
17686    if (json.has("_usage"))
17687      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
17688    if (json.has("uniqueId")) {
17689      JsonArray array = json.getAsJsonArray("uniqueId");
17690      for (int i = 0; i < array.size(); i++) {
17691        res.getUniqueId().add(parseNamingSystemNamingSystemUniqueIdComponent(array.get(i).getAsJsonObject(), res));
17692      }
17693    };
17694  }
17695
17696  protected NamingSystem.NamingSystemUniqueIdComponent parseNamingSystemNamingSystemUniqueIdComponent(JsonObject json, NamingSystem owner) throws IOException, FHIRFormatError {
17697    NamingSystem.NamingSystemUniqueIdComponent res = new NamingSystem.NamingSystemUniqueIdComponent();
17698    parseNamingSystemNamingSystemUniqueIdComponentProperties(json, owner, res);
17699    return res;
17700  }
17701
17702  protected void parseNamingSystemNamingSystemUniqueIdComponentProperties(JsonObject json, NamingSystem owner, NamingSystem.NamingSystemUniqueIdComponent res) throws IOException, FHIRFormatError {
17703    parseBackboneElementProperties(json, res);
17704    if (json.has("type"))
17705      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), NamingSystem.NamingSystemIdentifierType.NULL, new NamingSystem.NamingSystemIdentifierTypeEnumFactory()));
17706    if (json.has("_type"))
17707      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
17708    if (json.has("value"))
17709      res.setValueElement(parseString(json.get("value").getAsString()));
17710    if (json.has("_value"))
17711      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
17712    if (json.has("preferred"))
17713      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
17714    if (json.has("_preferred"))
17715      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
17716    if (json.has("comment"))
17717      res.setCommentElement(parseString(json.get("comment").getAsString()));
17718    if (json.has("_comment"))
17719      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
17720    if (json.has("period"))
17721      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
17722  }
17723
17724  protected NutritionOrder parseNutritionOrder(JsonObject json) throws IOException, FHIRFormatError {
17725    NutritionOrder res = new NutritionOrder();
17726    parseNutritionOrderProperties(json, res);
17727    return res;
17728  }
17729
17730  protected void parseNutritionOrderProperties(JsonObject json, NutritionOrder res) throws IOException, FHIRFormatError {
17731    parseDomainResourceProperties(json, res);
17732    if (json.has("identifier")) {
17733      JsonArray array = json.getAsJsonArray("identifier");
17734      for (int i = 0; i < array.size(); i++) {
17735        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
17736      }
17737    };
17738    if (json.has("instantiatesCanonical")) {
17739      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
17740      for (int i = 0; i < array.size(); i++) {
17741        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
17742      }
17743    };
17744    if (json.has("_instantiatesCanonical")) {
17745      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
17746      for (int i = 0; i < array.size(); i++) {
17747        if (i == res.getInstantiatesCanonical().size())
17748          res.getInstantiatesCanonical().add(parseCanonical(null));
17749        if (array.get(i) instanceof JsonObject) 
17750          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
17751      }
17752    };
17753    if (json.has("instantiatesUri")) {
17754      JsonArray array = json.getAsJsonArray("instantiatesUri");
17755      for (int i = 0; i < array.size(); i++) {
17756        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
17757      }
17758    };
17759    if (json.has("_instantiatesUri")) {
17760      JsonArray array = json.getAsJsonArray("_instantiatesUri");
17761      for (int i = 0; i < array.size(); i++) {
17762        if (i == res.getInstantiatesUri().size())
17763          res.getInstantiatesUri().add(parseUri(null));
17764        if (array.get(i) instanceof JsonObject) 
17765          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
17766      }
17767    };
17768    if (json.has("instantiates")) {
17769      JsonArray array = json.getAsJsonArray("instantiates");
17770      for (int i = 0; i < array.size(); i++) {
17771        res.getInstantiates().add(parseUri(array.get(i).getAsString()));
17772      }
17773    };
17774    if (json.has("_instantiates")) {
17775      JsonArray array = json.getAsJsonArray("_instantiates");
17776      for (int i = 0; i < array.size(); i++) {
17777        if (i == res.getInstantiates().size())
17778          res.getInstantiates().add(parseUri(null));
17779        if (array.get(i) instanceof JsonObject) 
17780          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiates().get(i));
17781      }
17782    };
17783    if (json.has("status"))
17784      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), NutritionOrder.NutritionOrderStatus.NULL, new NutritionOrder.NutritionOrderStatusEnumFactory()));
17785    if (json.has("_status"))
17786      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
17787    if (json.has("intent"))
17788      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), NutritionOrder.NutritiionOrderIntent.NULL, new NutritionOrder.NutritiionOrderIntentEnumFactory()));
17789    if (json.has("_intent"))
17790      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
17791    if (json.has("patient"))
17792      res.setPatient(parseReference(json.getAsJsonObject("patient")));
17793    if (json.has("context"))
17794      res.setContext(parseReference(json.getAsJsonObject("context")));
17795    if (json.has("dateTime"))
17796      res.setDateTimeElement(parseDateTime(json.get("dateTime").getAsString()));
17797    if (json.has("_dateTime"))
17798      parseElementProperties(json.getAsJsonObject("_dateTime"), res.getDateTimeElement());
17799    if (json.has("orderer"))
17800      res.setOrderer(parseReference(json.getAsJsonObject("orderer")));
17801    if (json.has("allergyIntolerance")) {
17802      JsonArray array = json.getAsJsonArray("allergyIntolerance");
17803      for (int i = 0; i < array.size(); i++) {
17804        res.getAllergyIntolerance().add(parseReference(array.get(i).getAsJsonObject()));
17805      }
17806    };
17807    if (json.has("foodPreferenceModifier")) {
17808      JsonArray array = json.getAsJsonArray("foodPreferenceModifier");
17809      for (int i = 0; i < array.size(); i++) {
17810        res.getFoodPreferenceModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17811      }
17812    };
17813    if (json.has("excludeFoodModifier")) {
17814      JsonArray array = json.getAsJsonArray("excludeFoodModifier");
17815      for (int i = 0; i < array.size(); i++) {
17816        res.getExcludeFoodModifier().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17817      }
17818    };
17819    if (json.has("oralDiet"))
17820      res.setOralDiet(parseNutritionOrderNutritionOrderOralDietComponent(json.getAsJsonObject("oralDiet"), res));
17821    if (json.has("supplement")) {
17822      JsonArray array = json.getAsJsonArray("supplement");
17823      for (int i = 0; i < array.size(); i++) {
17824        res.getSupplement().add(parseNutritionOrderNutritionOrderSupplementComponent(array.get(i).getAsJsonObject(), res));
17825      }
17826    };
17827    if (json.has("enteralFormula"))
17828      res.setEnteralFormula(parseNutritionOrderNutritionOrderEnteralFormulaComponent(json.getAsJsonObject("enteralFormula"), res));
17829    if (json.has("note")) {
17830      JsonArray array = json.getAsJsonArray("note");
17831      for (int i = 0; i < array.size(); i++) {
17832        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
17833      }
17834    };
17835  }
17836
17837  protected NutritionOrder.NutritionOrderOralDietComponent parseNutritionOrderNutritionOrderOralDietComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
17838    NutritionOrder.NutritionOrderOralDietComponent res = new NutritionOrder.NutritionOrderOralDietComponent();
17839    parseNutritionOrderNutritionOrderOralDietComponentProperties(json, owner, res);
17840    return res;
17841  }
17842
17843  protected void parseNutritionOrderNutritionOrderOralDietComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietComponent res) throws IOException, FHIRFormatError {
17844    parseBackboneElementProperties(json, res);
17845    if (json.has("type")) {
17846      JsonArray array = json.getAsJsonArray("type");
17847      for (int i = 0; i < array.size(); i++) {
17848        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17849      }
17850    };
17851    if (json.has("schedule")) {
17852      JsonArray array = json.getAsJsonArray("schedule");
17853      for (int i = 0; i < array.size(); i++) {
17854        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
17855      }
17856    };
17857    if (json.has("nutrient")) {
17858      JsonArray array = json.getAsJsonArray("nutrient");
17859      for (int i = 0; i < array.size(); i++) {
17860        res.getNutrient().add(parseNutritionOrderNutritionOrderOralDietNutrientComponent(array.get(i).getAsJsonObject(), owner));
17861      }
17862    };
17863    if (json.has("texture")) {
17864      JsonArray array = json.getAsJsonArray("texture");
17865      for (int i = 0; i < array.size(); i++) {
17866        res.getTexture().add(parseNutritionOrderNutritionOrderOralDietTextureComponent(array.get(i).getAsJsonObject(), owner));
17867      }
17868    };
17869    if (json.has("fluidConsistencyType")) {
17870      JsonArray array = json.getAsJsonArray("fluidConsistencyType");
17871      for (int i = 0; i < array.size(); i++) {
17872        res.getFluidConsistencyType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
17873      }
17874    };
17875    if (json.has("instruction"))
17876      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
17877    if (json.has("_instruction"))
17878      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
17879  }
17880
17881  protected NutritionOrder.NutritionOrderOralDietNutrientComponent parseNutritionOrderNutritionOrderOralDietNutrientComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
17882    NutritionOrder.NutritionOrderOralDietNutrientComponent res = new NutritionOrder.NutritionOrderOralDietNutrientComponent();
17883    parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(json, owner, res);
17884    return res;
17885  }
17886
17887  protected void parseNutritionOrderNutritionOrderOralDietNutrientComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietNutrientComponent res) throws IOException, FHIRFormatError {
17888    parseBackboneElementProperties(json, res);
17889    if (json.has("modifier"))
17890      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
17891    if (json.has("amount"))
17892      res.setAmount(parseQuantity(json.getAsJsonObject("amount")));
17893  }
17894
17895  protected NutritionOrder.NutritionOrderOralDietTextureComponent parseNutritionOrderNutritionOrderOralDietTextureComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
17896    NutritionOrder.NutritionOrderOralDietTextureComponent res = new NutritionOrder.NutritionOrderOralDietTextureComponent();
17897    parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(json, owner, res);
17898    return res;
17899  }
17900
17901  protected void parseNutritionOrderNutritionOrderOralDietTextureComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderOralDietTextureComponent res) throws IOException, FHIRFormatError {
17902    parseBackboneElementProperties(json, res);
17903    if (json.has("modifier"))
17904      res.setModifier(parseCodeableConcept(json.getAsJsonObject("modifier")));
17905    if (json.has("foodType"))
17906      res.setFoodType(parseCodeableConcept(json.getAsJsonObject("foodType")));
17907  }
17908
17909  protected NutritionOrder.NutritionOrderSupplementComponent parseNutritionOrderNutritionOrderSupplementComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
17910    NutritionOrder.NutritionOrderSupplementComponent res = new NutritionOrder.NutritionOrderSupplementComponent();
17911    parseNutritionOrderNutritionOrderSupplementComponentProperties(json, owner, res);
17912    return res;
17913  }
17914
17915  protected void parseNutritionOrderNutritionOrderSupplementComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderSupplementComponent res) throws IOException, FHIRFormatError {
17916    parseBackboneElementProperties(json, res);
17917    if (json.has("type"))
17918      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
17919    if (json.has("productName"))
17920      res.setProductNameElement(parseString(json.get("productName").getAsString()));
17921    if (json.has("_productName"))
17922      parseElementProperties(json.getAsJsonObject("_productName"), res.getProductNameElement());
17923    if (json.has("schedule")) {
17924      JsonArray array = json.getAsJsonArray("schedule");
17925      for (int i = 0; i < array.size(); i++) {
17926        res.getSchedule().add(parseTiming(array.get(i).getAsJsonObject()));
17927      }
17928    };
17929    if (json.has("quantity"))
17930      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17931    if (json.has("instruction"))
17932      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
17933    if (json.has("_instruction"))
17934      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
17935  }
17936
17937  protected NutritionOrder.NutritionOrderEnteralFormulaComponent parseNutritionOrderNutritionOrderEnteralFormulaComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
17938    NutritionOrder.NutritionOrderEnteralFormulaComponent res = new NutritionOrder.NutritionOrderEnteralFormulaComponent();
17939    parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(json, owner, res);
17940    return res;
17941  }
17942
17943  protected void parseNutritionOrderNutritionOrderEnteralFormulaComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaComponent res) throws IOException, FHIRFormatError {
17944    parseBackboneElementProperties(json, res);
17945    if (json.has("baseFormulaType"))
17946      res.setBaseFormulaType(parseCodeableConcept(json.getAsJsonObject("baseFormulaType")));
17947    if (json.has("baseFormulaProductName"))
17948      res.setBaseFormulaProductNameElement(parseString(json.get("baseFormulaProductName").getAsString()));
17949    if (json.has("_baseFormulaProductName"))
17950      parseElementProperties(json.getAsJsonObject("_baseFormulaProductName"), res.getBaseFormulaProductNameElement());
17951    if (json.has("additiveType"))
17952      res.setAdditiveType(parseCodeableConcept(json.getAsJsonObject("additiveType")));
17953    if (json.has("additiveProductName"))
17954      res.setAdditiveProductNameElement(parseString(json.get("additiveProductName").getAsString()));
17955    if (json.has("_additiveProductName"))
17956      parseElementProperties(json.getAsJsonObject("_additiveProductName"), res.getAdditiveProductNameElement());
17957    if (json.has("caloricDensity"))
17958      res.setCaloricDensity(parseQuantity(json.getAsJsonObject("caloricDensity")));
17959    if (json.has("routeofAdministration"))
17960      res.setRouteofAdministration(parseCodeableConcept(json.getAsJsonObject("routeofAdministration")));
17961    if (json.has("administration")) {
17962      JsonArray array = json.getAsJsonArray("administration");
17963      for (int i = 0; i < array.size(); i++) {
17964        res.getAdministration().add(parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(array.get(i).getAsJsonObject(), owner));
17965      }
17966    };
17967    if (json.has("maxVolumeToDeliver"))
17968      res.setMaxVolumeToDeliver(parseQuantity(json.getAsJsonObject("maxVolumeToDeliver")));
17969    if (json.has("administrationInstruction"))
17970      res.setAdministrationInstructionElement(parseString(json.get("administrationInstruction").getAsString()));
17971    if (json.has("_administrationInstruction"))
17972      parseElementProperties(json.getAsJsonObject("_administrationInstruction"), res.getAdministrationInstructionElement());
17973  }
17974
17975  protected NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(JsonObject json, NutritionOrder owner) throws IOException, FHIRFormatError {
17976    NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res = new NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent();
17977    parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(json, owner, res);
17978    return res;
17979  }
17980
17981  protected void parseNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentProperties(JsonObject json, NutritionOrder owner, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent res) throws IOException, FHIRFormatError {
17982    parseBackboneElementProperties(json, res);
17983    if (json.has("schedule"))
17984      res.setSchedule(parseTiming(json.getAsJsonObject("schedule")));
17985    if (json.has("quantity"))
17986      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
17987    Type rate = parseType("rate", json);
17988    if (rate != null)
17989      res.setRate(rate);
17990  }
17991
17992  protected Observation parseObservation(JsonObject json) throws IOException, FHIRFormatError {
17993    Observation res = new Observation();
17994    parseObservationProperties(json, res);
17995    return res;
17996  }
17997
17998  protected void parseObservationProperties(JsonObject json, Observation res) throws IOException, FHIRFormatError {
17999    parseDomainResourceProperties(json, res);
18000    if (json.has("identifier")) {
18001      JsonArray array = json.getAsJsonArray("identifier");
18002      for (int i = 0; i < array.size(); i++) {
18003        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18004      }
18005    };
18006    if (json.has("basedOn")) {
18007      JsonArray array = json.getAsJsonArray("basedOn");
18008      for (int i = 0; i < array.size(); i++) {
18009        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
18010      }
18011    };
18012    if (json.has("partOf")) {
18013      JsonArray array = json.getAsJsonArray("partOf");
18014      for (int i = 0; i < array.size(); i++) {
18015        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
18016      }
18017    };
18018    if (json.has("status"))
18019      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Observation.ObservationStatus.NULL, new Observation.ObservationStatusEnumFactory()));
18020    if (json.has("_status"))
18021      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18022    if (json.has("category")) {
18023      JsonArray array = json.getAsJsonArray("category");
18024      for (int i = 0; i < array.size(); i++) {
18025        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18026      }
18027    };
18028    if (json.has("code"))
18029      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
18030    if (json.has("subject"))
18031      res.setSubject(parseReference(json.getAsJsonObject("subject")));
18032    if (json.has("focus")) {
18033      JsonArray array = json.getAsJsonArray("focus");
18034      for (int i = 0; i < array.size(); i++) {
18035        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
18036      }
18037    };
18038    if (json.has("encounter"))
18039      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
18040    Type effective = parseType("effective", json);
18041    if (effective != null)
18042      res.setEffective(effective);
18043    if (json.has("issued"))
18044      res.setIssuedElement(parseInstant(json.get("issued").getAsString()));
18045    if (json.has("_issued"))
18046      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
18047    if (json.has("performer")) {
18048      JsonArray array = json.getAsJsonArray("performer");
18049      for (int i = 0; i < array.size(); i++) {
18050        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
18051      }
18052    };
18053    Type value = parseType("value", json);
18054    if (value != null)
18055      res.setValue(value);
18056    if (json.has("dataAbsentReason"))
18057      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
18058    if (json.has("interpretation")) {
18059      JsonArray array = json.getAsJsonArray("interpretation");
18060      for (int i = 0; i < array.size(); i++) {
18061        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18062      }
18063    };
18064    if (json.has("comment"))
18065      res.setCommentElement(parseString(json.get("comment").getAsString()));
18066    if (json.has("_comment"))
18067      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
18068    if (json.has("bodySite"))
18069      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
18070    if (json.has("method"))
18071      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
18072    if (json.has("specimen"))
18073      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
18074    if (json.has("device"))
18075      res.setDevice(parseReference(json.getAsJsonObject("device")));
18076    if (json.has("referenceRange")) {
18077      JsonArray array = json.getAsJsonArray("referenceRange");
18078      for (int i = 0; i < array.size(); i++) {
18079        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), res));
18080      }
18081    };
18082    if (json.has("hasMember")) {
18083      JsonArray array = json.getAsJsonArray("hasMember");
18084      for (int i = 0; i < array.size(); i++) {
18085        res.getHasMember().add(parseReference(array.get(i).getAsJsonObject()));
18086      }
18087    };
18088    if (json.has("derivedFrom")) {
18089      JsonArray array = json.getAsJsonArray("derivedFrom");
18090      for (int i = 0; i < array.size(); i++) {
18091        res.getDerivedFrom().add(parseReference(array.get(i).getAsJsonObject()));
18092      }
18093    };
18094    if (json.has("component")) {
18095      JsonArray array = json.getAsJsonArray("component");
18096      for (int i = 0; i < array.size(); i++) {
18097        res.getComponent().add(parseObservationObservationComponentComponent(array.get(i).getAsJsonObject(), res));
18098      }
18099    };
18100  }
18101
18102  protected Observation.ObservationReferenceRangeComponent parseObservationObservationReferenceRangeComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
18103    Observation.ObservationReferenceRangeComponent res = new Observation.ObservationReferenceRangeComponent();
18104    parseObservationObservationReferenceRangeComponentProperties(json, owner, res);
18105    return res;
18106  }
18107
18108  protected void parseObservationObservationReferenceRangeComponentProperties(JsonObject json, Observation owner, Observation.ObservationReferenceRangeComponent res) throws IOException, FHIRFormatError {
18109    parseBackboneElementProperties(json, res);
18110    if (json.has("low"))
18111      res.setLow(parseQuantity(json.getAsJsonObject("low")));
18112    if (json.has("high"))
18113      res.setHigh(parseQuantity(json.getAsJsonObject("high")));
18114    if (json.has("type"))
18115      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18116    if (json.has("appliesTo")) {
18117      JsonArray array = json.getAsJsonArray("appliesTo");
18118      for (int i = 0; i < array.size(); i++) {
18119        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18120      }
18121    };
18122    if (json.has("age"))
18123      res.setAge(parseRange(json.getAsJsonObject("age")));
18124    if (json.has("text"))
18125      res.setTextElement(parseString(json.get("text").getAsString()));
18126    if (json.has("_text"))
18127      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
18128  }
18129
18130  protected Observation.ObservationComponentComponent parseObservationObservationComponentComponent(JsonObject json, Observation owner) throws IOException, FHIRFormatError {
18131    Observation.ObservationComponentComponent res = new Observation.ObservationComponentComponent();
18132    parseObservationObservationComponentComponentProperties(json, owner, res);
18133    return res;
18134  }
18135
18136  protected void parseObservationObservationComponentComponentProperties(JsonObject json, Observation owner, Observation.ObservationComponentComponent res) throws IOException, FHIRFormatError {
18137    parseBackboneElementProperties(json, res);
18138    if (json.has("code"))
18139      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
18140    Type value = parseType("value", json);
18141    if (value != null)
18142      res.setValue(value);
18143    if (json.has("dataAbsentReason"))
18144      res.setDataAbsentReason(parseCodeableConcept(json.getAsJsonObject("dataAbsentReason")));
18145    if (json.has("interpretation")) {
18146      JsonArray array = json.getAsJsonArray("interpretation");
18147      for (int i = 0; i < array.size(); i++) {
18148        res.getInterpretation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18149      }
18150    };
18151    if (json.has("referenceRange")) {
18152      JsonArray array = json.getAsJsonArray("referenceRange");
18153      for (int i = 0; i < array.size(); i++) {
18154        res.getReferenceRange().add(parseObservationObservationReferenceRangeComponent(array.get(i).getAsJsonObject(), owner));
18155      }
18156    };
18157  }
18158
18159  protected ObservationDefinition parseObservationDefinition(JsonObject json) throws IOException, FHIRFormatError {
18160    ObservationDefinition res = new ObservationDefinition();
18161    parseObservationDefinitionProperties(json, res);
18162    return res;
18163  }
18164
18165  protected void parseObservationDefinitionProperties(JsonObject json, ObservationDefinition res) throws IOException, FHIRFormatError {
18166    parseDomainResourceProperties(json, res);
18167    if (json.has("category"))
18168      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
18169    if (json.has("code"))
18170      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
18171    if (json.has("identifier")) {
18172      JsonArray array = json.getAsJsonArray("identifier");
18173      for (int i = 0; i < array.size(); i++) {
18174        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18175      }
18176    };
18177    if (json.has("permittedDataType")) {
18178      JsonArray array = json.getAsJsonArray("permittedDataType");
18179      for (int i = 0; i < array.size(); i++) {
18180        res.getPermittedDataType().add(parseCoding(array.get(i).getAsJsonObject()));
18181      }
18182    };
18183    if (json.has("multipleResultsAllowed"))
18184      res.setMultipleResultsAllowedElement(parseBoolean(json.get("multipleResultsAllowed").getAsBoolean()));
18185    if (json.has("_multipleResultsAllowed"))
18186      parseElementProperties(json.getAsJsonObject("_multipleResultsAllowed"), res.getMultipleResultsAllowedElement());
18187    if (json.has("method"))
18188      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
18189    if (json.has("preferredReportName"))
18190      res.setPreferredReportNameElement(parseString(json.get("preferredReportName").getAsString()));
18191    if (json.has("_preferredReportName"))
18192      parseElementProperties(json.getAsJsonObject("_preferredReportName"), res.getPreferredReportNameElement());
18193    if (json.has("quantitativeDetails"))
18194      res.setQuantitativeDetails(parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(json.getAsJsonObject("quantitativeDetails"), res));
18195    if (json.has("qualifiedInterval")) {
18196      JsonArray array = json.getAsJsonArray("qualifiedInterval");
18197      for (int i = 0; i < array.size(); i++) {
18198        res.getQualifiedInterval().add(parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(array.get(i).getAsJsonObject(), res));
18199      }
18200    };
18201    if (json.has("validCodedValueSet"))
18202      res.setValidCodedValueSetElement(parseUri(json.get("validCodedValueSet").getAsString()));
18203    if (json.has("_validCodedValueSet"))
18204      parseElementProperties(json.getAsJsonObject("_validCodedValueSet"), res.getValidCodedValueSetElement());
18205    if (json.has("normalCodedValueSet"))
18206      res.setNormalCodedValueSetElement(parseUri(json.get("normalCodedValueSet").getAsString()));
18207    if (json.has("_normalCodedValueSet"))
18208      parseElementProperties(json.getAsJsonObject("_normalCodedValueSet"), res.getNormalCodedValueSetElement());
18209    if (json.has("abnormalCodedValueSet"))
18210      res.setAbnormalCodedValueSetElement(parseUri(json.get("abnormalCodedValueSet").getAsString()));
18211    if (json.has("_abnormalCodedValueSet"))
18212      parseElementProperties(json.getAsJsonObject("_abnormalCodedValueSet"), res.getAbnormalCodedValueSetElement());
18213    if (json.has("criticalCodedValueSet"))
18214      res.setCriticalCodedValueSetElement(parseUri(json.get("criticalCodedValueSet").getAsString()));
18215    if (json.has("_criticalCodedValueSet"))
18216      parseElementProperties(json.getAsJsonObject("_criticalCodedValueSet"), res.getCriticalCodedValueSetElement());
18217  }
18218
18219  protected ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
18220    ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res = new ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent();
18221    parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(json, owner, res);
18222    return res;
18223  }
18224
18225  protected void parseObservationDefinitionObservationDefinitionQuantitativeDetailsComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent res) throws IOException, FHIRFormatError {
18226    parseBackboneElementProperties(json, res);
18227    if (json.has("customaryUnit"))
18228      res.setCustomaryUnit(parseCoding(json.getAsJsonObject("customaryUnit")));
18229    if (json.has("unit"))
18230      res.setUnit(parseCoding(json.getAsJsonObject("unit")));
18231    if (json.has("conversionFactor"))
18232      res.setConversionFactorElement(parseDecimal(json.get("conversionFactor").getAsBigDecimal()));
18233    if (json.has("_conversionFactor"))
18234      parseElementProperties(json.getAsJsonObject("_conversionFactor"), res.getConversionFactorElement());
18235    if (json.has("decimalPrecision"))
18236      res.setDecimalPrecisionElement(parseInteger(json.get("decimalPrecision").getAsLong()));
18237    if (json.has("_decimalPrecision"))
18238      parseElementProperties(json.getAsJsonObject("_decimalPrecision"), res.getDecimalPrecisionElement());
18239  }
18240
18241  protected ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent parseObservationDefinitionObservationDefinitionQualifiedIntervalComponent(JsonObject json, ObservationDefinition owner) throws IOException, FHIRFormatError {
18242    ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res = new ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent();
18243    parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(json, owner, res);
18244    return res;
18245  }
18246
18247  protected void parseObservationDefinitionObservationDefinitionQualifiedIntervalComponentProperties(JsonObject json, ObservationDefinition owner, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent res) throws IOException, FHIRFormatError {
18248    parseBackboneElementProperties(json, res);
18249    if (json.has("category"))
18250      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
18251    if (json.has("range"))
18252      res.setRange(parseRange(json.getAsJsonObject("range")));
18253    if (json.has("type"))
18254      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
18255    if (json.has("appliesTo")) {
18256      JsonArray array = json.getAsJsonArray("appliesTo");
18257      for (int i = 0; i < array.size(); i++) {
18258        res.getAppliesTo().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18259      }
18260    };
18261    if (json.has("age"))
18262      res.setAge(parseRange(json.getAsJsonObject("age")));
18263    if (json.has("gestationalAge"))
18264      res.setGestationalAge(parseRange(json.getAsJsonObject("gestationalAge")));
18265    if (json.has("condition"))
18266      res.setConditionElement(parseString(json.get("condition").getAsString()));
18267    if (json.has("_condition"))
18268      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
18269  }
18270
18271  protected OperationDefinition parseOperationDefinition(JsonObject json) throws IOException, FHIRFormatError {
18272    OperationDefinition res = new OperationDefinition();
18273    parseOperationDefinitionProperties(json, res);
18274    return res;
18275  }
18276
18277  protected void parseOperationDefinitionProperties(JsonObject json, OperationDefinition res) throws IOException, FHIRFormatError {
18278    parseDomainResourceProperties(json, res);
18279    if (json.has("url"))
18280      res.setUrlElement(parseUri(json.get("url").getAsString()));
18281    if (json.has("_url"))
18282      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
18283    if (json.has("version"))
18284      res.setVersionElement(parseString(json.get("version").getAsString()));
18285    if (json.has("_version"))
18286      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
18287    if (json.has("name"))
18288      res.setNameElement(parseString(json.get("name").getAsString()));
18289    if (json.has("_name"))
18290      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18291    if (json.has("title"))
18292      res.setTitleElement(parseString(json.get("title").getAsString()));
18293    if (json.has("_title"))
18294      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
18295    if (json.has("status"))
18296      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
18297    if (json.has("_status"))
18298      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18299    if (json.has("kind"))
18300      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), OperationDefinition.OperationKind.NULL, new OperationDefinition.OperationKindEnumFactory()));
18301    if (json.has("_kind"))
18302      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
18303    if (json.has("experimental"))
18304      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
18305    if (json.has("_experimental"))
18306      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
18307    if (json.has("date"))
18308      res.setDateElement(parseDateTime(json.get("date").getAsString()));
18309    if (json.has("_date"))
18310      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
18311    if (json.has("publisher"))
18312      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
18313    if (json.has("_publisher"))
18314      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
18315    if (json.has("contact")) {
18316      JsonArray array = json.getAsJsonArray("contact");
18317      for (int i = 0; i < array.size(); i++) {
18318        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
18319      }
18320    };
18321    if (json.has("description"))
18322      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
18323    if (json.has("_description"))
18324      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
18325    if (json.has("useContext")) {
18326      JsonArray array = json.getAsJsonArray("useContext");
18327      for (int i = 0; i < array.size(); i++) {
18328        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
18329      }
18330    };
18331    if (json.has("jurisdiction")) {
18332      JsonArray array = json.getAsJsonArray("jurisdiction");
18333      for (int i = 0; i < array.size(); i++) {
18334        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18335      }
18336    };
18337    if (json.has("purpose"))
18338      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
18339    if (json.has("_purpose"))
18340      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
18341    if (json.has("affectsState"))
18342      res.setAffectsStateElement(parseBoolean(json.get("affectsState").getAsBoolean()));
18343    if (json.has("_affectsState"))
18344      parseElementProperties(json.getAsJsonObject("_affectsState"), res.getAffectsStateElement());
18345    if (json.has("code"))
18346      res.setCodeElement(parseCode(json.get("code").getAsString()));
18347    if (json.has("_code"))
18348      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
18349    if (json.has("comment"))
18350      res.setCommentElement(parseMarkdown(json.get("comment").getAsString()));
18351    if (json.has("_comment"))
18352      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
18353    if (json.has("base"))
18354      res.setBaseElement(parseCanonical(json.get("base").getAsString()));
18355    if (json.has("_base"))
18356      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
18357    if (json.has("resource")) {
18358      JsonArray array = json.getAsJsonArray("resource");
18359      for (int i = 0; i < array.size(); i++) {
18360        res.getResource().add(parseCode(array.get(i).getAsString()));
18361      }
18362    };
18363    if (json.has("_resource")) {
18364      JsonArray array = json.getAsJsonArray("_resource");
18365      for (int i = 0; i < array.size(); i++) {
18366        if (i == res.getResource().size())
18367          res.getResource().add(parseCode(null));
18368        if (array.get(i) instanceof JsonObject) 
18369          parseElementProperties(array.get(i).getAsJsonObject(), res.getResource().get(i));
18370      }
18371    };
18372    if (json.has("system"))
18373      res.setSystemElement(parseBoolean(json.get("system").getAsBoolean()));
18374    if (json.has("_system"))
18375      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
18376    if (json.has("type"))
18377      res.setTypeElement(parseBoolean(json.get("type").getAsBoolean()));
18378    if (json.has("_type"))
18379      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18380    if (json.has("instance"))
18381      res.setInstanceElement(parseBoolean(json.get("instance").getAsBoolean()));
18382    if (json.has("_instance"))
18383      parseElementProperties(json.getAsJsonObject("_instance"), res.getInstanceElement());
18384    if (json.has("inputProfile"))
18385      res.setInputProfileElement(parseCanonical(json.get("inputProfile").getAsString()));
18386    if (json.has("_inputProfile"))
18387      parseElementProperties(json.getAsJsonObject("_inputProfile"), res.getInputProfileElement());
18388    if (json.has("outputProfile"))
18389      res.setOutputProfileElement(parseCanonical(json.get("outputProfile").getAsString()));
18390    if (json.has("_outputProfile"))
18391      parseElementProperties(json.getAsJsonObject("_outputProfile"), res.getOutputProfileElement());
18392    if (json.has("parameter")) {
18393      JsonArray array = json.getAsJsonArray("parameter");
18394      for (int i = 0; i < array.size(); i++) {
18395        res.getParameter().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), res));
18396      }
18397    };
18398    if (json.has("overload")) {
18399      JsonArray array = json.getAsJsonArray("overload");
18400      for (int i = 0; i < array.size(); i++) {
18401        res.getOverload().add(parseOperationDefinitionOperationDefinitionOverloadComponent(array.get(i).getAsJsonObject(), res));
18402      }
18403    };
18404  }
18405
18406  protected OperationDefinition.OperationDefinitionParameterComponent parseOperationDefinitionOperationDefinitionParameterComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
18407    OperationDefinition.OperationDefinitionParameterComponent res = new OperationDefinition.OperationDefinitionParameterComponent();
18408    parseOperationDefinitionOperationDefinitionParameterComponentProperties(json, owner, res);
18409    return res;
18410  }
18411
18412  protected void parseOperationDefinitionOperationDefinitionParameterComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterComponent res) throws IOException, FHIRFormatError {
18413    parseBackboneElementProperties(json, res);
18414    if (json.has("name"))
18415      res.setNameElement(parseCode(json.get("name").getAsString()));
18416    if (json.has("_name"))
18417      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18418    if (json.has("use"))
18419      res.setUseElement(parseEnumeration(json.get("use").getAsString(), OperationDefinition.OperationParameterUse.NULL, new OperationDefinition.OperationParameterUseEnumFactory()));
18420    if (json.has("_use"))
18421      parseElementProperties(json.getAsJsonObject("_use"), res.getUseElement());
18422    if (json.has("min"))
18423      res.setMinElement(parseInteger(json.get("min").getAsLong()));
18424    if (json.has("_min"))
18425      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
18426    if (json.has("max"))
18427      res.setMaxElement(parseString(json.get("max").getAsString()));
18428    if (json.has("_max"))
18429      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
18430    if (json.has("documentation"))
18431      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
18432    if (json.has("_documentation"))
18433      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
18434    if (json.has("type"))
18435      res.setTypeElement(parseCode(json.get("type").getAsString()));
18436    if (json.has("_type"))
18437      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18438    if (json.has("targetProfile")) {
18439      JsonArray array = json.getAsJsonArray("targetProfile");
18440      for (int i = 0; i < array.size(); i++) {
18441        res.getTargetProfile().add(parseCanonical(array.get(i).getAsString()));
18442      }
18443    };
18444    if (json.has("_targetProfile")) {
18445      JsonArray array = json.getAsJsonArray("_targetProfile");
18446      for (int i = 0; i < array.size(); i++) {
18447        if (i == res.getTargetProfile().size())
18448          res.getTargetProfile().add(parseCanonical(null));
18449        if (array.get(i) instanceof JsonObject) 
18450          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetProfile().get(i));
18451      }
18452    };
18453    if (json.has("searchType"))
18454      res.setSearchTypeElement(parseEnumeration(json.get("searchType").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
18455    if (json.has("_searchType"))
18456      parseElementProperties(json.getAsJsonObject("_searchType"), res.getSearchTypeElement());
18457    if (json.has("binding"))
18458      res.setBinding(parseOperationDefinitionOperationDefinitionParameterBindingComponent(json.getAsJsonObject("binding"), owner));
18459    if (json.has("referencedFrom")) {
18460      JsonArray array = json.getAsJsonArray("referencedFrom");
18461      for (int i = 0; i < array.size(); i++) {
18462        res.getReferencedFrom().add(parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(array.get(i).getAsJsonObject(), owner));
18463      }
18464    };
18465    if (json.has("part")) {
18466      JsonArray array = json.getAsJsonArray("part");
18467      for (int i = 0; i < array.size(); i++) {
18468        res.getPart().add(parseOperationDefinitionOperationDefinitionParameterComponent(array.get(i).getAsJsonObject(), owner));
18469      }
18470    };
18471  }
18472
18473  protected OperationDefinition.OperationDefinitionParameterBindingComponent parseOperationDefinitionOperationDefinitionParameterBindingComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
18474    OperationDefinition.OperationDefinitionParameterBindingComponent res = new OperationDefinition.OperationDefinitionParameterBindingComponent();
18475    parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(json, owner, res);
18476    return res;
18477  }
18478
18479  protected void parseOperationDefinitionOperationDefinitionParameterBindingComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterBindingComponent res) throws IOException, FHIRFormatError {
18480    parseBackboneElementProperties(json, res);
18481    if (json.has("strength"))
18482      res.setStrengthElement(parseEnumeration(json.get("strength").getAsString(), Enumerations.BindingStrength.NULL, new Enumerations.BindingStrengthEnumFactory()));
18483    if (json.has("_strength"))
18484      parseElementProperties(json.getAsJsonObject("_strength"), res.getStrengthElement());
18485    if (json.has("valueSet"))
18486      res.setValueSetElement(parseCanonical(json.get("valueSet").getAsString()));
18487    if (json.has("_valueSet"))
18488      parseElementProperties(json.getAsJsonObject("_valueSet"), res.getValueSetElement());
18489  }
18490
18491  protected OperationDefinition.OperationDefinitionParameterReferencedFromComponent parseOperationDefinitionOperationDefinitionParameterReferencedFromComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
18492    OperationDefinition.OperationDefinitionParameterReferencedFromComponent res = new OperationDefinition.OperationDefinitionParameterReferencedFromComponent();
18493    parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(json, owner, res);
18494    return res;
18495  }
18496
18497  protected void parseOperationDefinitionOperationDefinitionParameterReferencedFromComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionParameterReferencedFromComponent res) throws IOException, FHIRFormatError {
18498    parseBackboneElementProperties(json, res);
18499    if (json.has("source"))
18500      res.setSourceElement(parseString(json.get("source").getAsString()));
18501    if (json.has("_source"))
18502      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
18503    if (json.has("sourceId"))
18504      res.setSourceIdElement(parseString(json.get("sourceId").getAsString()));
18505    if (json.has("_sourceId"))
18506      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
18507  }
18508
18509  protected OperationDefinition.OperationDefinitionOverloadComponent parseOperationDefinitionOperationDefinitionOverloadComponent(JsonObject json, OperationDefinition owner) throws IOException, FHIRFormatError {
18510    OperationDefinition.OperationDefinitionOverloadComponent res = new OperationDefinition.OperationDefinitionOverloadComponent();
18511    parseOperationDefinitionOperationDefinitionOverloadComponentProperties(json, owner, res);
18512    return res;
18513  }
18514
18515  protected void parseOperationDefinitionOperationDefinitionOverloadComponentProperties(JsonObject json, OperationDefinition owner, OperationDefinition.OperationDefinitionOverloadComponent res) throws IOException, FHIRFormatError {
18516    parseBackboneElementProperties(json, res);
18517    if (json.has("parameterName")) {
18518      JsonArray array = json.getAsJsonArray("parameterName");
18519      for (int i = 0; i < array.size(); i++) {
18520        res.getParameterName().add(parseString(array.get(i).getAsString()));
18521      }
18522    };
18523    if (json.has("_parameterName")) {
18524      JsonArray array = json.getAsJsonArray("_parameterName");
18525      for (int i = 0; i < array.size(); i++) {
18526        if (i == res.getParameterName().size())
18527          res.getParameterName().add(parseString(null));
18528        if (array.get(i) instanceof JsonObject) 
18529          parseElementProperties(array.get(i).getAsJsonObject(), res.getParameterName().get(i));
18530      }
18531    };
18532    if (json.has("comment"))
18533      res.setCommentElement(parseString(json.get("comment").getAsString()));
18534    if (json.has("_comment"))
18535      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
18536  }
18537
18538  protected OperationOutcome parseOperationOutcome(JsonObject json) throws IOException, FHIRFormatError {
18539    OperationOutcome res = new OperationOutcome();
18540    parseOperationOutcomeProperties(json, res);
18541    return res;
18542  }
18543
18544  protected void parseOperationOutcomeProperties(JsonObject json, OperationOutcome res) throws IOException, FHIRFormatError {
18545    parseDomainResourceProperties(json, res);
18546    if (json.has("issue")) {
18547      JsonArray array = json.getAsJsonArray("issue");
18548      for (int i = 0; i < array.size(); i++) {
18549        res.getIssue().add(parseOperationOutcomeOperationOutcomeIssueComponent(array.get(i).getAsJsonObject(), res));
18550      }
18551    };
18552  }
18553
18554  protected OperationOutcome.OperationOutcomeIssueComponent parseOperationOutcomeOperationOutcomeIssueComponent(JsonObject json, OperationOutcome owner) throws IOException, FHIRFormatError {
18555    OperationOutcome.OperationOutcomeIssueComponent res = new OperationOutcome.OperationOutcomeIssueComponent();
18556    parseOperationOutcomeOperationOutcomeIssueComponentProperties(json, owner, res);
18557    return res;
18558  }
18559
18560  protected void parseOperationOutcomeOperationOutcomeIssueComponentProperties(JsonObject json, OperationOutcome owner, OperationOutcome.OperationOutcomeIssueComponent res) throws IOException, FHIRFormatError {
18561    parseBackboneElementProperties(json, res);
18562    if (json.has("severity"))
18563      res.setSeverityElement(parseEnumeration(json.get("severity").getAsString(), OperationOutcome.IssueSeverity.NULL, new OperationOutcome.IssueSeverityEnumFactory()));
18564    if (json.has("_severity"))
18565      parseElementProperties(json.getAsJsonObject("_severity"), res.getSeverityElement());
18566    if (json.has("code"))
18567      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), OperationOutcome.IssueType.NULL, new OperationOutcome.IssueTypeEnumFactory()));
18568    if (json.has("_code"))
18569      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
18570    if (json.has("details"))
18571      res.setDetails(parseCodeableConcept(json.getAsJsonObject("details")));
18572    if (json.has("diagnostics"))
18573      res.setDiagnosticsElement(parseString(json.get("diagnostics").getAsString()));
18574    if (json.has("_diagnostics"))
18575      parseElementProperties(json.getAsJsonObject("_diagnostics"), res.getDiagnosticsElement());
18576    if (json.has("location")) {
18577      JsonArray array = json.getAsJsonArray("location");
18578      for (int i = 0; i < array.size(); i++) {
18579        res.getLocation().add(parseString(array.get(i).getAsString()));
18580      }
18581    };
18582    if (json.has("_location")) {
18583      JsonArray array = json.getAsJsonArray("_location");
18584      for (int i = 0; i < array.size(); i++) {
18585        if (i == res.getLocation().size())
18586          res.getLocation().add(parseString(null));
18587        if (array.get(i) instanceof JsonObject) 
18588          parseElementProperties(array.get(i).getAsJsonObject(), res.getLocation().get(i));
18589      }
18590    };
18591    if (json.has("expression")) {
18592      JsonArray array = json.getAsJsonArray("expression");
18593      for (int i = 0; i < array.size(); i++) {
18594        res.getExpression().add(parseString(array.get(i).getAsString()));
18595      }
18596    };
18597    if (json.has("_expression")) {
18598      JsonArray array = json.getAsJsonArray("_expression");
18599      for (int i = 0; i < array.size(); i++) {
18600        if (i == res.getExpression().size())
18601          res.getExpression().add(parseString(null));
18602        if (array.get(i) instanceof JsonObject) 
18603          parseElementProperties(array.get(i).getAsJsonObject(), res.getExpression().get(i));
18604      }
18605    };
18606  }
18607
18608  protected Organization parseOrganization(JsonObject json) throws IOException, FHIRFormatError {
18609    Organization res = new Organization();
18610    parseOrganizationProperties(json, res);
18611    return res;
18612  }
18613
18614  protected void parseOrganizationProperties(JsonObject json, Organization res) throws IOException, FHIRFormatError {
18615    parseDomainResourceProperties(json, res);
18616    if (json.has("identifier")) {
18617      JsonArray array = json.getAsJsonArray("identifier");
18618      for (int i = 0; i < array.size(); i++) {
18619        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18620      }
18621    };
18622    if (json.has("active"))
18623      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
18624    if (json.has("_active"))
18625      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
18626    if (json.has("type")) {
18627      JsonArray array = json.getAsJsonArray("type");
18628      for (int i = 0; i < array.size(); i++) {
18629        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18630      }
18631    };
18632    if (json.has("name"))
18633      res.setNameElement(parseString(json.get("name").getAsString()));
18634    if (json.has("_name"))
18635      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
18636    if (json.has("alias")) {
18637      JsonArray array = json.getAsJsonArray("alias");
18638      for (int i = 0; i < array.size(); i++) {
18639        res.getAlias().add(parseString(array.get(i).getAsString()));
18640      }
18641    };
18642    if (json.has("_alias")) {
18643      JsonArray array = json.getAsJsonArray("_alias");
18644      for (int i = 0; i < array.size(); i++) {
18645        if (i == res.getAlias().size())
18646          res.getAlias().add(parseString(null));
18647        if (array.get(i) instanceof JsonObject) 
18648          parseElementProperties(array.get(i).getAsJsonObject(), res.getAlias().get(i));
18649      }
18650    };
18651    if (json.has("telecom")) {
18652      JsonArray array = json.getAsJsonArray("telecom");
18653      for (int i = 0; i < array.size(); i++) {
18654        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
18655      }
18656    };
18657    if (json.has("address")) {
18658      JsonArray array = json.getAsJsonArray("address");
18659      for (int i = 0; i < array.size(); i++) {
18660        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
18661      }
18662    };
18663    if (json.has("partOf"))
18664      res.setPartOf(parseReference(json.getAsJsonObject("partOf")));
18665    if (json.has("contact")) {
18666      JsonArray array = json.getAsJsonArray("contact");
18667      for (int i = 0; i < array.size(); i++) {
18668        res.getContact().add(parseOrganizationOrganizationContactComponent(array.get(i).getAsJsonObject(), res));
18669      }
18670    };
18671    if (json.has("endpoint")) {
18672      JsonArray array = json.getAsJsonArray("endpoint");
18673      for (int i = 0; i < array.size(); i++) {
18674        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
18675      }
18676    };
18677  }
18678
18679  protected Organization.OrganizationContactComponent parseOrganizationOrganizationContactComponent(JsonObject json, Organization owner) throws IOException, FHIRFormatError {
18680    Organization.OrganizationContactComponent res = new Organization.OrganizationContactComponent();
18681    parseOrganizationOrganizationContactComponentProperties(json, owner, res);
18682    return res;
18683  }
18684
18685  protected void parseOrganizationOrganizationContactComponentProperties(JsonObject json, Organization owner, Organization.OrganizationContactComponent res) throws IOException, FHIRFormatError {
18686    parseBackboneElementProperties(json, res);
18687    if (json.has("purpose"))
18688      res.setPurpose(parseCodeableConcept(json.getAsJsonObject("purpose")));
18689    if (json.has("name"))
18690      res.setName(parseHumanName(json.getAsJsonObject("name")));
18691    if (json.has("telecom")) {
18692      JsonArray array = json.getAsJsonArray("telecom");
18693      for (int i = 0; i < array.size(); i++) {
18694        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
18695      }
18696    };
18697    if (json.has("address"))
18698      res.setAddress(parseAddress(json.getAsJsonObject("address")));
18699  }
18700
18701  protected OrganizationAffiliation parseOrganizationAffiliation(JsonObject json) throws IOException, FHIRFormatError {
18702    OrganizationAffiliation res = new OrganizationAffiliation();
18703    parseOrganizationAffiliationProperties(json, res);
18704    return res;
18705  }
18706
18707  protected void parseOrganizationAffiliationProperties(JsonObject json, OrganizationAffiliation res) throws IOException, FHIRFormatError {
18708    parseDomainResourceProperties(json, res);
18709    if (json.has("identifier")) {
18710      JsonArray array = json.getAsJsonArray("identifier");
18711      for (int i = 0; i < array.size(); i++) {
18712        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18713      }
18714    };
18715    if (json.has("active"))
18716      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
18717    if (json.has("_active"))
18718      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
18719    if (json.has("period"))
18720      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
18721    if (json.has("organization"))
18722      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
18723    if (json.has("participatingOrganization"))
18724      res.setParticipatingOrganization(parseReference(json.getAsJsonObject("participatingOrganization")));
18725    if (json.has("network")) {
18726      JsonArray array = json.getAsJsonArray("network");
18727      for (int i = 0; i < array.size(); i++) {
18728        res.getNetwork().add(parseReference(array.get(i).getAsJsonObject()));
18729      }
18730    };
18731    if (json.has("code")) {
18732      JsonArray array = json.getAsJsonArray("code");
18733      for (int i = 0; i < array.size(); i++) {
18734        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18735      }
18736    };
18737    if (json.has("specialty")) {
18738      JsonArray array = json.getAsJsonArray("specialty");
18739      for (int i = 0; i < array.size(); i++) {
18740        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18741      }
18742    };
18743    if (json.has("location")) {
18744      JsonArray array = json.getAsJsonArray("location");
18745      for (int i = 0; i < array.size(); i++) {
18746        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
18747      }
18748    };
18749    if (json.has("healthcareService")) {
18750      JsonArray array = json.getAsJsonArray("healthcareService");
18751      for (int i = 0; i < array.size(); i++) {
18752        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
18753      }
18754    };
18755    if (json.has("telecom")) {
18756      JsonArray array = json.getAsJsonArray("telecom");
18757      for (int i = 0; i < array.size(); i++) {
18758        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
18759      }
18760    };
18761    if (json.has("endpoint")) {
18762      JsonArray array = json.getAsJsonArray("endpoint");
18763      for (int i = 0; i < array.size(); i++) {
18764        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
18765      }
18766    };
18767  }
18768
18769  protected Patient parsePatient(JsonObject json) throws IOException, FHIRFormatError {
18770    Patient res = new Patient();
18771    parsePatientProperties(json, res);
18772    return res;
18773  }
18774
18775  protected void parsePatientProperties(JsonObject json, Patient res) throws IOException, FHIRFormatError {
18776    parseDomainResourceProperties(json, res);
18777    if (json.has("identifier")) {
18778      JsonArray array = json.getAsJsonArray("identifier");
18779      for (int i = 0; i < array.size(); i++) {
18780        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18781      }
18782    };
18783    if (json.has("active"))
18784      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
18785    if (json.has("_active"))
18786      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
18787    if (json.has("name")) {
18788      JsonArray array = json.getAsJsonArray("name");
18789      for (int i = 0; i < array.size(); i++) {
18790        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
18791      }
18792    };
18793    if (json.has("telecom")) {
18794      JsonArray array = json.getAsJsonArray("telecom");
18795      for (int i = 0; i < array.size(); i++) {
18796        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
18797      }
18798    };
18799    if (json.has("gender"))
18800      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
18801    if (json.has("_gender"))
18802      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
18803    if (json.has("birthDate"))
18804      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
18805    if (json.has("_birthDate"))
18806      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
18807    Type deceased = parseType("deceased", json);
18808    if (deceased != null)
18809      res.setDeceased(deceased);
18810    if (json.has("address")) {
18811      JsonArray array = json.getAsJsonArray("address");
18812      for (int i = 0; i < array.size(); i++) {
18813        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
18814      }
18815    };
18816    if (json.has("maritalStatus"))
18817      res.setMaritalStatus(parseCodeableConcept(json.getAsJsonObject("maritalStatus")));
18818    Type multipleBirth = parseType("multipleBirth", json);
18819    if (multipleBirth != null)
18820      res.setMultipleBirth(multipleBirth);
18821    if (json.has("photo")) {
18822      JsonArray array = json.getAsJsonArray("photo");
18823      for (int i = 0; i < array.size(); i++) {
18824        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
18825      }
18826    };
18827    if (json.has("contact")) {
18828      JsonArray array = json.getAsJsonArray("contact");
18829      for (int i = 0; i < array.size(); i++) {
18830        res.getContact().add(parsePatientContactComponent(array.get(i).getAsJsonObject(), res));
18831      }
18832    };
18833    if (json.has("communication")) {
18834      JsonArray array = json.getAsJsonArray("communication");
18835      for (int i = 0; i < array.size(); i++) {
18836        res.getCommunication().add(parsePatientPatientCommunicationComponent(array.get(i).getAsJsonObject(), res));
18837      }
18838    };
18839    if (json.has("generalPractitioner")) {
18840      JsonArray array = json.getAsJsonArray("generalPractitioner");
18841      for (int i = 0; i < array.size(); i++) {
18842        res.getGeneralPractitioner().add(parseReference(array.get(i).getAsJsonObject()));
18843      }
18844    };
18845    if (json.has("managingOrganization"))
18846      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
18847    if (json.has("link")) {
18848      JsonArray array = json.getAsJsonArray("link");
18849      for (int i = 0; i < array.size(); i++) {
18850        res.getLink().add(parsePatientPatientLinkComponent(array.get(i).getAsJsonObject(), res));
18851      }
18852    };
18853  }
18854
18855  protected Patient.ContactComponent parsePatientContactComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
18856    Patient.ContactComponent res = new Patient.ContactComponent();
18857    parsePatientContactComponentProperties(json, owner, res);
18858    return res;
18859  }
18860
18861  protected void parsePatientContactComponentProperties(JsonObject json, Patient owner, Patient.ContactComponent res) throws IOException, FHIRFormatError {
18862    parseBackboneElementProperties(json, res);
18863    if (json.has("relationship")) {
18864      JsonArray array = json.getAsJsonArray("relationship");
18865      for (int i = 0; i < array.size(); i++) {
18866        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
18867      }
18868    };
18869    if (json.has("name"))
18870      res.setName(parseHumanName(json.getAsJsonObject("name")));
18871    if (json.has("telecom")) {
18872      JsonArray array = json.getAsJsonArray("telecom");
18873      for (int i = 0; i < array.size(); i++) {
18874        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
18875      }
18876    };
18877    if (json.has("address"))
18878      res.setAddress(parseAddress(json.getAsJsonObject("address")));
18879    if (json.has("gender"))
18880      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
18881    if (json.has("_gender"))
18882      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
18883    if (json.has("organization"))
18884      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
18885    if (json.has("period"))
18886      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
18887  }
18888
18889  protected Patient.PatientCommunicationComponent parsePatientPatientCommunicationComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
18890    Patient.PatientCommunicationComponent res = new Patient.PatientCommunicationComponent();
18891    parsePatientPatientCommunicationComponentProperties(json, owner, res);
18892    return res;
18893  }
18894
18895  protected void parsePatientPatientCommunicationComponentProperties(JsonObject json, Patient owner, Patient.PatientCommunicationComponent res) throws IOException, FHIRFormatError {
18896    parseBackboneElementProperties(json, res);
18897    if (json.has("language"))
18898      res.setLanguage(parseCodeableConcept(json.getAsJsonObject("language")));
18899    if (json.has("preferred"))
18900      res.setPreferredElement(parseBoolean(json.get("preferred").getAsBoolean()));
18901    if (json.has("_preferred"))
18902      parseElementProperties(json.getAsJsonObject("_preferred"), res.getPreferredElement());
18903  }
18904
18905  protected Patient.PatientLinkComponent parsePatientPatientLinkComponent(JsonObject json, Patient owner) throws IOException, FHIRFormatError {
18906    Patient.PatientLinkComponent res = new Patient.PatientLinkComponent();
18907    parsePatientPatientLinkComponentProperties(json, owner, res);
18908    return res;
18909  }
18910
18911  protected void parsePatientPatientLinkComponentProperties(JsonObject json, Patient owner, Patient.PatientLinkComponent res) throws IOException, FHIRFormatError {
18912    parseBackboneElementProperties(json, res);
18913    if (json.has("other"))
18914      res.setOther(parseReference(json.getAsJsonObject("other")));
18915    if (json.has("type"))
18916      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Patient.LinkType.NULL, new Patient.LinkTypeEnumFactory()));
18917    if (json.has("_type"))
18918      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
18919  }
18920
18921  protected PaymentNotice parsePaymentNotice(JsonObject json) throws IOException, FHIRFormatError {
18922    PaymentNotice res = new PaymentNotice();
18923    parsePaymentNoticeProperties(json, res);
18924    return res;
18925  }
18926
18927  protected void parsePaymentNoticeProperties(JsonObject json, PaymentNotice res) throws IOException, FHIRFormatError {
18928    parseDomainResourceProperties(json, res);
18929    if (json.has("identifier")) {
18930      JsonArray array = json.getAsJsonArray("identifier");
18931      for (int i = 0; i < array.size(); i++) {
18932        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18933      }
18934    };
18935    if (json.has("status"))
18936      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentNotice.PaymentNoticeStatus.NULL, new PaymentNotice.PaymentNoticeStatusEnumFactory()));
18937    if (json.has("_status"))
18938      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18939    if (json.has("request"))
18940      res.setRequest(parseReference(json.getAsJsonObject("request")));
18941    if (json.has("response"))
18942      res.setResponse(parseReference(json.getAsJsonObject("response")));
18943    if (json.has("statusDate"))
18944      res.setStatusDateElement(parseDate(json.get("statusDate").getAsString()));
18945    if (json.has("_statusDate"))
18946      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
18947    if (json.has("created"))
18948      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
18949    if (json.has("_created"))
18950      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
18951    if (json.has("target"))
18952      res.setTarget(parseReference(json.getAsJsonObject("target")));
18953    if (json.has("provider"))
18954      res.setProvider(parseReference(json.getAsJsonObject("provider")));
18955    if (json.has("paymentStatus"))
18956      res.setPaymentStatus(parseCodeableConcept(json.getAsJsonObject("paymentStatus")));
18957  }
18958
18959  protected PaymentReconciliation parsePaymentReconciliation(JsonObject json) throws IOException, FHIRFormatError {
18960    PaymentReconciliation res = new PaymentReconciliation();
18961    parsePaymentReconciliationProperties(json, res);
18962    return res;
18963  }
18964
18965  protected void parsePaymentReconciliationProperties(JsonObject json, PaymentReconciliation res) throws IOException, FHIRFormatError {
18966    parseDomainResourceProperties(json, res);
18967    if (json.has("identifier")) {
18968      JsonArray array = json.getAsJsonArray("identifier");
18969      for (int i = 0; i < array.size(); i++) {
18970        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
18971      }
18972    };
18973    if (json.has("status"))
18974      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), PaymentReconciliation.PaymentReconciliationStatus.NULL, new PaymentReconciliation.PaymentReconciliationStatusEnumFactory()));
18975    if (json.has("_status"))
18976      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
18977    if (json.has("period"))
18978      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
18979    if (json.has("created"))
18980      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
18981    if (json.has("_created"))
18982      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
18983    if (json.has("organization"))
18984      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
18985    if (json.has("request"))
18986      res.setRequest(parseReference(json.getAsJsonObject("request")));
18987    if (json.has("outcome"))
18988      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), Enumerations.RemittanceOutcome.NULL, new Enumerations.RemittanceOutcomeEnumFactory()));
18989    if (json.has("_outcome"))
18990      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
18991    if (json.has("disposition"))
18992      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
18993    if (json.has("_disposition"))
18994      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
18995    if (json.has("requestProvider"))
18996      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
18997    if (json.has("detail")) {
18998      JsonArray array = json.getAsJsonArray("detail");
18999      for (int i = 0; i < array.size(); i++) {
19000        res.getDetail().add(parsePaymentReconciliationDetailsComponent(array.get(i).getAsJsonObject(), res));
19001      }
19002    };
19003    if (json.has("form"))
19004      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
19005    if (json.has("total"))
19006      res.setTotal(parseMoney(json.getAsJsonObject("total")));
19007    if (json.has("processNote")) {
19008      JsonArray array = json.getAsJsonArray("processNote");
19009      for (int i = 0; i < array.size(); i++) {
19010        res.getProcessNote().add(parsePaymentReconciliationNotesComponent(array.get(i).getAsJsonObject(), res));
19011      }
19012    };
19013  }
19014
19015  protected PaymentReconciliation.DetailsComponent parsePaymentReconciliationDetailsComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
19016    PaymentReconciliation.DetailsComponent res = new PaymentReconciliation.DetailsComponent();
19017    parsePaymentReconciliationDetailsComponentProperties(json, owner, res);
19018    return res;
19019  }
19020
19021  protected void parsePaymentReconciliationDetailsComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.DetailsComponent res) throws IOException, FHIRFormatError {
19022    parseBackboneElementProperties(json, res);
19023    if (json.has("type"))
19024      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19025    if (json.has("request"))
19026      res.setRequest(parseReference(json.getAsJsonObject("request")));
19027    if (json.has("response"))
19028      res.setResponse(parseReference(json.getAsJsonObject("response")));
19029    if (json.has("submitter"))
19030      res.setSubmitter(parseReference(json.getAsJsonObject("submitter")));
19031    if (json.has("payee"))
19032      res.setPayee(parseReference(json.getAsJsonObject("payee")));
19033    if (json.has("date"))
19034      res.setDateElement(parseDate(json.get("date").getAsString()));
19035    if (json.has("_date"))
19036      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19037    if (json.has("amount"))
19038      res.setAmount(parseMoney(json.getAsJsonObject("amount")));
19039  }
19040
19041  protected PaymentReconciliation.NotesComponent parsePaymentReconciliationNotesComponent(JsonObject json, PaymentReconciliation owner) throws IOException, FHIRFormatError {
19042    PaymentReconciliation.NotesComponent res = new PaymentReconciliation.NotesComponent();
19043    parsePaymentReconciliationNotesComponentProperties(json, owner, res);
19044    return res;
19045  }
19046
19047  protected void parsePaymentReconciliationNotesComponentProperties(JsonObject json, PaymentReconciliation owner, PaymentReconciliation.NotesComponent res) throws IOException, FHIRFormatError {
19048    parseBackboneElementProperties(json, res);
19049    if (json.has("type"))
19050      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
19051    if (json.has("_type"))
19052      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19053    if (json.has("text"))
19054      res.setTextElement(parseString(json.get("text").getAsString()));
19055    if (json.has("_text"))
19056      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
19057  }
19058
19059  protected Person parsePerson(JsonObject json) throws IOException, FHIRFormatError {
19060    Person res = new Person();
19061    parsePersonProperties(json, res);
19062    return res;
19063  }
19064
19065  protected void parsePersonProperties(JsonObject json, Person res) throws IOException, FHIRFormatError {
19066    parseDomainResourceProperties(json, res);
19067    if (json.has("identifier")) {
19068      JsonArray array = json.getAsJsonArray("identifier");
19069      for (int i = 0; i < array.size(); i++) {
19070        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19071      }
19072    };
19073    if (json.has("name")) {
19074      JsonArray array = json.getAsJsonArray("name");
19075      for (int i = 0; i < array.size(); i++) {
19076        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
19077      }
19078    };
19079    if (json.has("telecom")) {
19080      JsonArray array = json.getAsJsonArray("telecom");
19081      for (int i = 0; i < array.size(); i++) {
19082        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19083      }
19084    };
19085    if (json.has("gender"))
19086      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19087    if (json.has("_gender"))
19088      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
19089    if (json.has("birthDate"))
19090      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
19091    if (json.has("_birthDate"))
19092      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
19093    if (json.has("address")) {
19094      JsonArray array = json.getAsJsonArray("address");
19095      for (int i = 0; i < array.size(); i++) {
19096        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
19097      }
19098    };
19099    if (json.has("photo"))
19100      res.setPhoto(parseAttachment(json.getAsJsonObject("photo")));
19101    if (json.has("managingOrganization"))
19102      res.setManagingOrganization(parseReference(json.getAsJsonObject("managingOrganization")));
19103    if (json.has("active"))
19104      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19105    if (json.has("_active"))
19106      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
19107    if (json.has("link")) {
19108      JsonArray array = json.getAsJsonArray("link");
19109      for (int i = 0; i < array.size(); i++) {
19110        res.getLink().add(parsePersonPersonLinkComponent(array.get(i).getAsJsonObject(), res));
19111      }
19112    };
19113  }
19114
19115  protected Person.PersonLinkComponent parsePersonPersonLinkComponent(JsonObject json, Person owner) throws IOException, FHIRFormatError {
19116    Person.PersonLinkComponent res = new Person.PersonLinkComponent();
19117    parsePersonPersonLinkComponentProperties(json, owner, res);
19118    return res;
19119  }
19120
19121  protected void parsePersonPersonLinkComponentProperties(JsonObject json, Person owner, Person.PersonLinkComponent res) throws IOException, FHIRFormatError {
19122    parseBackboneElementProperties(json, res);
19123    if (json.has("target"))
19124      res.setTarget(parseReference(json.getAsJsonObject("target")));
19125    if (json.has("assurance"))
19126      res.setAssuranceElement(parseEnumeration(json.get("assurance").getAsString(), Person.IdentityAssuranceLevel.NULL, new Person.IdentityAssuranceLevelEnumFactory()));
19127    if (json.has("_assurance"))
19128      parseElementProperties(json.getAsJsonObject("_assurance"), res.getAssuranceElement());
19129  }
19130
19131  protected PlanDefinition parsePlanDefinition(JsonObject json) throws IOException, FHIRFormatError {
19132    PlanDefinition res = new PlanDefinition();
19133    parsePlanDefinitionProperties(json, res);
19134    return res;
19135  }
19136
19137  protected void parsePlanDefinitionProperties(JsonObject json, PlanDefinition res) throws IOException, FHIRFormatError {
19138    parseDomainResourceProperties(json, res);
19139    if (json.has("url"))
19140      res.setUrlElement(parseUri(json.get("url").getAsString()));
19141    if (json.has("_url"))
19142      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
19143    if (json.has("identifier")) {
19144      JsonArray array = json.getAsJsonArray("identifier");
19145      for (int i = 0; i < array.size(); i++) {
19146        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19147      }
19148    };
19149    if (json.has("version"))
19150      res.setVersionElement(parseString(json.get("version").getAsString()));
19151    if (json.has("_version"))
19152      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
19153    if (json.has("name"))
19154      res.setNameElement(parseString(json.get("name").getAsString()));
19155    if (json.has("_name"))
19156      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
19157    if (json.has("title"))
19158      res.setTitleElement(parseString(json.get("title").getAsString()));
19159    if (json.has("_title"))
19160      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
19161    if (json.has("subtitle"))
19162      res.setSubtitleElement(parseString(json.get("subtitle").getAsString()));
19163    if (json.has("_subtitle"))
19164      parseElementProperties(json.getAsJsonObject("_subtitle"), res.getSubtitleElement());
19165    if (json.has("type"))
19166      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19167    if (json.has("status"))
19168      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
19169    if (json.has("_status"))
19170      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19171    if (json.has("experimental"))
19172      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
19173    if (json.has("_experimental"))
19174      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
19175    Type subject = parseType("subject", json);
19176    if (subject != null)
19177      res.setSubject(subject);
19178    if (json.has("date"))
19179      res.setDateElement(parseDateTime(json.get("date").getAsString()));
19180    if (json.has("_date"))
19181      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
19182    if (json.has("publisher"))
19183      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
19184    if (json.has("_publisher"))
19185      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
19186    if (json.has("contact")) {
19187      JsonArray array = json.getAsJsonArray("contact");
19188      for (int i = 0; i < array.size(); i++) {
19189        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
19190      }
19191    };
19192    if (json.has("description"))
19193      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
19194    if (json.has("_description"))
19195      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19196    if (json.has("useContext")) {
19197      JsonArray array = json.getAsJsonArray("useContext");
19198      for (int i = 0; i < array.size(); i++) {
19199        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
19200      }
19201    };
19202    if (json.has("jurisdiction")) {
19203      JsonArray array = json.getAsJsonArray("jurisdiction");
19204      for (int i = 0; i < array.size(); i++) {
19205        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19206      }
19207    };
19208    if (json.has("purpose"))
19209      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
19210    if (json.has("_purpose"))
19211      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
19212    if (json.has("usage"))
19213      res.setUsageElement(parseString(json.get("usage").getAsString()));
19214    if (json.has("_usage"))
19215      parseElementProperties(json.getAsJsonObject("_usage"), res.getUsageElement());
19216    if (json.has("copyright"))
19217      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
19218    if (json.has("_copyright"))
19219      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
19220    if (json.has("approvalDate"))
19221      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
19222    if (json.has("_approvalDate"))
19223      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
19224    if (json.has("lastReviewDate"))
19225      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
19226    if (json.has("_lastReviewDate"))
19227      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
19228    if (json.has("effectivePeriod"))
19229      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
19230    if (json.has("topic")) {
19231      JsonArray array = json.getAsJsonArray("topic");
19232      for (int i = 0; i < array.size(); i++) {
19233        res.getTopic().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19234      }
19235    };
19236    if (json.has("author")) {
19237      JsonArray array = json.getAsJsonArray("author");
19238      for (int i = 0; i < array.size(); i++) {
19239        res.getAuthor().add(parseContactDetail(array.get(i).getAsJsonObject()));
19240      }
19241    };
19242    if (json.has("editor")) {
19243      JsonArray array = json.getAsJsonArray("editor");
19244      for (int i = 0; i < array.size(); i++) {
19245        res.getEditor().add(parseContactDetail(array.get(i).getAsJsonObject()));
19246      }
19247    };
19248    if (json.has("reviewer")) {
19249      JsonArray array = json.getAsJsonArray("reviewer");
19250      for (int i = 0; i < array.size(); i++) {
19251        res.getReviewer().add(parseContactDetail(array.get(i).getAsJsonObject()));
19252      }
19253    };
19254    if (json.has("endorser")) {
19255      JsonArray array = json.getAsJsonArray("endorser");
19256      for (int i = 0; i < array.size(); i++) {
19257        res.getEndorser().add(parseContactDetail(array.get(i).getAsJsonObject()));
19258      }
19259    };
19260    if (json.has("relatedArtifact")) {
19261      JsonArray array = json.getAsJsonArray("relatedArtifact");
19262      for (int i = 0; i < array.size(); i++) {
19263        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
19264      }
19265    };
19266    if (json.has("library")) {
19267      JsonArray array = json.getAsJsonArray("library");
19268      for (int i = 0; i < array.size(); i++) {
19269        res.getLibrary().add(parseCanonical(array.get(i).getAsString()));
19270      }
19271    };
19272    if (json.has("_library")) {
19273      JsonArray array = json.getAsJsonArray("_library");
19274      for (int i = 0; i < array.size(); i++) {
19275        if (i == res.getLibrary().size())
19276          res.getLibrary().add(parseCanonical(null));
19277        if (array.get(i) instanceof JsonObject) 
19278          parseElementProperties(array.get(i).getAsJsonObject(), res.getLibrary().get(i));
19279      }
19280    };
19281    if (json.has("goal")) {
19282      JsonArray array = json.getAsJsonArray("goal");
19283      for (int i = 0; i < array.size(); i++) {
19284        res.getGoal().add(parsePlanDefinitionPlanDefinitionGoalComponent(array.get(i).getAsJsonObject(), res));
19285      }
19286    };
19287    if (json.has("action")) {
19288      JsonArray array = json.getAsJsonArray("action");
19289      for (int i = 0; i < array.size(); i++) {
19290        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), res));
19291      }
19292    };
19293  }
19294
19295  protected PlanDefinition.PlanDefinitionGoalComponent parsePlanDefinitionPlanDefinitionGoalComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
19296    PlanDefinition.PlanDefinitionGoalComponent res = new PlanDefinition.PlanDefinitionGoalComponent();
19297    parsePlanDefinitionPlanDefinitionGoalComponentProperties(json, owner, res);
19298    return res;
19299  }
19300
19301  protected void parsePlanDefinitionPlanDefinitionGoalComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalComponent res) throws IOException, FHIRFormatError {
19302    parseBackboneElementProperties(json, res);
19303    if (json.has("category"))
19304      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
19305    if (json.has("description"))
19306      res.setDescription(parseCodeableConcept(json.getAsJsonObject("description")));
19307    if (json.has("priority"))
19308      res.setPriority(parseCodeableConcept(json.getAsJsonObject("priority")));
19309    if (json.has("start"))
19310      res.setStart(parseCodeableConcept(json.getAsJsonObject("start")));
19311    if (json.has("addresses")) {
19312      JsonArray array = json.getAsJsonArray("addresses");
19313      for (int i = 0; i < array.size(); i++) {
19314        res.getAddresses().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19315      }
19316    };
19317    if (json.has("documentation")) {
19318      JsonArray array = json.getAsJsonArray("documentation");
19319      for (int i = 0; i < array.size(); i++) {
19320        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
19321      }
19322    };
19323    if (json.has("target")) {
19324      JsonArray array = json.getAsJsonArray("target");
19325      for (int i = 0; i < array.size(); i++) {
19326        res.getTarget().add(parsePlanDefinitionPlanDefinitionGoalTargetComponent(array.get(i).getAsJsonObject(), owner));
19327      }
19328    };
19329  }
19330
19331  protected PlanDefinition.PlanDefinitionGoalTargetComponent parsePlanDefinitionPlanDefinitionGoalTargetComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
19332    PlanDefinition.PlanDefinitionGoalTargetComponent res = new PlanDefinition.PlanDefinitionGoalTargetComponent();
19333    parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(json, owner, res);
19334    return res;
19335  }
19336
19337  protected void parsePlanDefinitionPlanDefinitionGoalTargetComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionGoalTargetComponent res) throws IOException, FHIRFormatError {
19338    parseBackboneElementProperties(json, res);
19339    if (json.has("measure"))
19340      res.setMeasure(parseCodeableConcept(json.getAsJsonObject("measure")));
19341    Type detail = parseType("detail", json);
19342    if (detail != null)
19343      res.setDetail(detail);
19344    if (json.has("due"))
19345      res.setDue(parseDuration(json.getAsJsonObject("due")));
19346  }
19347
19348  protected PlanDefinition.PlanDefinitionActionComponent parsePlanDefinitionPlanDefinitionActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
19349    PlanDefinition.PlanDefinitionActionComponent res = new PlanDefinition.PlanDefinitionActionComponent();
19350    parsePlanDefinitionPlanDefinitionActionComponentProperties(json, owner, res);
19351    return res;
19352  }
19353
19354  protected void parsePlanDefinitionPlanDefinitionActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionComponent res) throws IOException, FHIRFormatError {
19355    parseBackboneElementProperties(json, res);
19356    if (json.has("prefix"))
19357      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
19358    if (json.has("_prefix"))
19359      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
19360    if (json.has("title"))
19361      res.setTitleElement(parseString(json.get("title").getAsString()));
19362    if (json.has("_title"))
19363      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
19364    if (json.has("description"))
19365      res.setDescriptionElement(parseString(json.get("description").getAsString()));
19366    if (json.has("_description"))
19367      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19368    if (json.has("textEquivalent"))
19369      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
19370    if (json.has("_textEquivalent"))
19371      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
19372    if (json.has("priority"))
19373      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), PlanDefinition.RequestPriority.NULL, new PlanDefinition.RequestPriorityEnumFactory()));
19374    if (json.has("_priority"))
19375      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
19376    if (json.has("code")) {
19377      JsonArray array = json.getAsJsonArray("code");
19378      for (int i = 0; i < array.size(); i++) {
19379        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19380      }
19381    };
19382    if (json.has("reason")) {
19383      JsonArray array = json.getAsJsonArray("reason");
19384      for (int i = 0; i < array.size(); i++) {
19385        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19386      }
19387    };
19388    if (json.has("documentation")) {
19389      JsonArray array = json.getAsJsonArray("documentation");
19390      for (int i = 0; i < array.size(); i++) {
19391        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
19392      }
19393    };
19394    if (json.has("goalId")) {
19395      JsonArray array = json.getAsJsonArray("goalId");
19396      for (int i = 0; i < array.size(); i++) {
19397        res.getGoalId().add(parseId(array.get(i).getAsString()));
19398      }
19399    };
19400    if (json.has("_goalId")) {
19401      JsonArray array = json.getAsJsonArray("_goalId");
19402      for (int i = 0; i < array.size(); i++) {
19403        if (i == res.getGoalId().size())
19404          res.getGoalId().add(parseId(null));
19405        if (array.get(i) instanceof JsonObject) 
19406          parseElementProperties(array.get(i).getAsJsonObject(), res.getGoalId().get(i));
19407      }
19408    };
19409    if (json.has("trigger")) {
19410      JsonArray array = json.getAsJsonArray("trigger");
19411      for (int i = 0; i < array.size(); i++) {
19412        res.getTrigger().add(parseTriggerDefinition(array.get(i).getAsJsonObject()));
19413      }
19414    };
19415    if (json.has("condition")) {
19416      JsonArray array = json.getAsJsonArray("condition");
19417      for (int i = 0; i < array.size(); i++) {
19418        res.getCondition().add(parsePlanDefinitionPlanDefinitionActionConditionComponent(array.get(i).getAsJsonObject(), owner));
19419      }
19420    };
19421    if (json.has("input")) {
19422      JsonArray array = json.getAsJsonArray("input");
19423      for (int i = 0; i < array.size(); i++) {
19424        res.getInput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
19425      }
19426    };
19427    if (json.has("output")) {
19428      JsonArray array = json.getAsJsonArray("output");
19429      for (int i = 0; i < array.size(); i++) {
19430        res.getOutput().add(parseDataRequirement(array.get(i).getAsJsonObject()));
19431      }
19432    };
19433    if (json.has("relatedAction")) {
19434      JsonArray array = json.getAsJsonArray("relatedAction");
19435      for (int i = 0; i < array.size(); i++) {
19436        res.getRelatedAction().add(parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
19437      }
19438    };
19439    Type timing = parseType("timing", json);
19440    if (timing != null)
19441      res.setTiming(timing);
19442    if (json.has("participant")) {
19443      JsonArray array = json.getAsJsonArray("participant");
19444      for (int i = 0; i < array.size(); i++) {
19445        res.getParticipant().add(parsePlanDefinitionPlanDefinitionActionParticipantComponent(array.get(i).getAsJsonObject(), owner));
19446      }
19447    };
19448    if (json.has("type"))
19449      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
19450    if (json.has("groupingBehavior"))
19451      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), PlanDefinition.ActionGroupingBehavior.NULL, new PlanDefinition.ActionGroupingBehaviorEnumFactory()));
19452    if (json.has("_groupingBehavior"))
19453      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
19454    if (json.has("selectionBehavior"))
19455      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), PlanDefinition.ActionSelectionBehavior.NULL, new PlanDefinition.ActionSelectionBehaviorEnumFactory()));
19456    if (json.has("_selectionBehavior"))
19457      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
19458    if (json.has("requiredBehavior"))
19459      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), PlanDefinition.ActionRequiredBehavior.NULL, new PlanDefinition.ActionRequiredBehaviorEnumFactory()));
19460    if (json.has("_requiredBehavior"))
19461      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
19462    if (json.has("precheckBehavior"))
19463      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), PlanDefinition.ActionPrecheckBehavior.NULL, new PlanDefinition.ActionPrecheckBehaviorEnumFactory()));
19464    if (json.has("_precheckBehavior"))
19465      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
19466    if (json.has("cardinalityBehavior"))
19467      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), PlanDefinition.ActionCardinalityBehavior.NULL, new PlanDefinition.ActionCardinalityBehaviorEnumFactory()));
19468    if (json.has("_cardinalityBehavior"))
19469      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
19470    if (json.has("definition"))
19471      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
19472    if (json.has("_definition"))
19473      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
19474    if (json.has("transform"))
19475      res.setTransformElement(parseCanonical(json.get("transform").getAsString()));
19476    if (json.has("_transform"))
19477      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
19478    if (json.has("dynamicValue")) {
19479      JsonArray array = json.getAsJsonArray("dynamicValue");
19480      for (int i = 0; i < array.size(); i++) {
19481        res.getDynamicValue().add(parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(array.get(i).getAsJsonObject(), owner));
19482      }
19483    };
19484    if (json.has("action")) {
19485      JsonArray array = json.getAsJsonArray("action");
19486      for (int i = 0; i < array.size(); i++) {
19487        res.getAction().add(parsePlanDefinitionPlanDefinitionActionComponent(array.get(i).getAsJsonObject(), owner));
19488      }
19489    };
19490  }
19491
19492  protected PlanDefinition.PlanDefinitionActionConditionComponent parsePlanDefinitionPlanDefinitionActionConditionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
19493    PlanDefinition.PlanDefinitionActionConditionComponent res = new PlanDefinition.PlanDefinitionActionConditionComponent();
19494    parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(json, owner, res);
19495    return res;
19496  }
19497
19498  protected void parsePlanDefinitionPlanDefinitionActionConditionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionConditionComponent res) throws IOException, FHIRFormatError {
19499    parseBackboneElementProperties(json, res);
19500    if (json.has("kind"))
19501      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), PlanDefinition.ActionConditionKind.NULL, new PlanDefinition.ActionConditionKindEnumFactory()));
19502    if (json.has("_kind"))
19503      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
19504    if (json.has("expression"))
19505      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
19506  }
19507
19508  protected PlanDefinition.PlanDefinitionActionRelatedActionComponent parsePlanDefinitionPlanDefinitionActionRelatedActionComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
19509    PlanDefinition.PlanDefinitionActionRelatedActionComponent res = new PlanDefinition.PlanDefinitionActionRelatedActionComponent();
19510    parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(json, owner, res);
19511    return res;
19512  }
19513
19514  protected void parsePlanDefinitionPlanDefinitionActionRelatedActionComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionRelatedActionComponent res) throws IOException, FHIRFormatError {
19515    parseBackboneElementProperties(json, res);
19516    if (json.has("actionId"))
19517      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
19518    if (json.has("_actionId"))
19519      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
19520    if (json.has("relationship"))
19521      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), PlanDefinition.ActionRelationshipType.NULL, new PlanDefinition.ActionRelationshipTypeEnumFactory()));
19522    if (json.has("_relationship"))
19523      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
19524    Type offset = parseType("offset", json);
19525    if (offset != null)
19526      res.setOffset(offset);
19527  }
19528
19529  protected PlanDefinition.PlanDefinitionActionParticipantComponent parsePlanDefinitionPlanDefinitionActionParticipantComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
19530    PlanDefinition.PlanDefinitionActionParticipantComponent res = new PlanDefinition.PlanDefinitionActionParticipantComponent();
19531    parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(json, owner, res);
19532    return res;
19533  }
19534
19535  protected void parsePlanDefinitionPlanDefinitionActionParticipantComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionParticipantComponent res) throws IOException, FHIRFormatError {
19536    parseBackboneElementProperties(json, res);
19537    if (json.has("type"))
19538      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), PlanDefinition.ActionParticipantType.NULL, new PlanDefinition.ActionParticipantTypeEnumFactory()));
19539    if (json.has("_type"))
19540      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
19541    if (json.has("role"))
19542      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
19543  }
19544
19545  protected PlanDefinition.PlanDefinitionActionDynamicValueComponent parsePlanDefinitionPlanDefinitionActionDynamicValueComponent(JsonObject json, PlanDefinition owner) throws IOException, FHIRFormatError {
19546    PlanDefinition.PlanDefinitionActionDynamicValueComponent res = new PlanDefinition.PlanDefinitionActionDynamicValueComponent();
19547    parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(json, owner, res);
19548    return res;
19549  }
19550
19551  protected void parsePlanDefinitionPlanDefinitionActionDynamicValueComponentProperties(JsonObject json, PlanDefinition owner, PlanDefinition.PlanDefinitionActionDynamicValueComponent res) throws IOException, FHIRFormatError {
19552    parseBackboneElementProperties(json, res);
19553    if (json.has("path"))
19554      res.setPathElement(parseString(json.get("path").getAsString()));
19555    if (json.has("_path"))
19556      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
19557    if (json.has("expression"))
19558      res.setExpression(parseExpression(json.getAsJsonObject("expression")));
19559  }
19560
19561  protected Practitioner parsePractitioner(JsonObject json) throws IOException, FHIRFormatError {
19562    Practitioner res = new Practitioner();
19563    parsePractitionerProperties(json, res);
19564    return res;
19565  }
19566
19567  protected void parsePractitionerProperties(JsonObject json, Practitioner res) throws IOException, FHIRFormatError {
19568    parseDomainResourceProperties(json, res);
19569    if (json.has("identifier")) {
19570      JsonArray array = json.getAsJsonArray("identifier");
19571      for (int i = 0; i < array.size(); i++) {
19572        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19573      }
19574    };
19575    if (json.has("active"))
19576      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19577    if (json.has("_active"))
19578      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
19579    if (json.has("name")) {
19580      JsonArray array = json.getAsJsonArray("name");
19581      for (int i = 0; i < array.size(); i++) {
19582        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
19583      }
19584    };
19585    if (json.has("telecom")) {
19586      JsonArray array = json.getAsJsonArray("telecom");
19587      for (int i = 0; i < array.size(); i++) {
19588        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19589      }
19590    };
19591    if (json.has("address")) {
19592      JsonArray array = json.getAsJsonArray("address");
19593      for (int i = 0; i < array.size(); i++) {
19594        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
19595      }
19596    };
19597    if (json.has("gender"))
19598      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
19599    if (json.has("_gender"))
19600      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
19601    if (json.has("birthDate"))
19602      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
19603    if (json.has("_birthDate"))
19604      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
19605    if (json.has("photo")) {
19606      JsonArray array = json.getAsJsonArray("photo");
19607      for (int i = 0; i < array.size(); i++) {
19608        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
19609      }
19610    };
19611    if (json.has("qualification")) {
19612      JsonArray array = json.getAsJsonArray("qualification");
19613      for (int i = 0; i < array.size(); i++) {
19614        res.getQualification().add(parsePractitionerPractitionerQualificationComponent(array.get(i).getAsJsonObject(), res));
19615      }
19616    };
19617    if (json.has("communication")) {
19618      JsonArray array = json.getAsJsonArray("communication");
19619      for (int i = 0; i < array.size(); i++) {
19620        res.getCommunication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19621      }
19622    };
19623  }
19624
19625  protected Practitioner.PractitionerQualificationComponent parsePractitionerPractitionerQualificationComponent(JsonObject json, Practitioner owner) throws IOException, FHIRFormatError {
19626    Practitioner.PractitionerQualificationComponent res = new Practitioner.PractitionerQualificationComponent();
19627    parsePractitionerPractitionerQualificationComponentProperties(json, owner, res);
19628    return res;
19629  }
19630
19631  protected void parsePractitionerPractitionerQualificationComponentProperties(JsonObject json, Practitioner owner, Practitioner.PractitionerQualificationComponent res) throws IOException, FHIRFormatError {
19632    parseBackboneElementProperties(json, res);
19633    if (json.has("identifier")) {
19634      JsonArray array = json.getAsJsonArray("identifier");
19635      for (int i = 0; i < array.size(); i++) {
19636        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19637      }
19638    };
19639    if (json.has("code"))
19640      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19641    if (json.has("period"))
19642      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19643    if (json.has("issuer"))
19644      res.setIssuer(parseReference(json.getAsJsonObject("issuer")));
19645  }
19646
19647  protected PractitionerRole parsePractitionerRole(JsonObject json) throws IOException, FHIRFormatError {
19648    PractitionerRole res = new PractitionerRole();
19649    parsePractitionerRoleProperties(json, res);
19650    return res;
19651  }
19652
19653  protected void parsePractitionerRoleProperties(JsonObject json, PractitionerRole res) throws IOException, FHIRFormatError {
19654    parseDomainResourceProperties(json, res);
19655    if (json.has("identifier")) {
19656      JsonArray array = json.getAsJsonArray("identifier");
19657      for (int i = 0; i < array.size(); i++) {
19658        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19659      }
19660    };
19661    if (json.has("active"))
19662      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
19663    if (json.has("_active"))
19664      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
19665    if (json.has("period"))
19666      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
19667    if (json.has("practitioner"))
19668      res.setPractitioner(parseReference(json.getAsJsonObject("practitioner")));
19669    if (json.has("organization"))
19670      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
19671    if (json.has("code")) {
19672      JsonArray array = json.getAsJsonArray("code");
19673      for (int i = 0; i < array.size(); i++) {
19674        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19675      }
19676    };
19677    if (json.has("specialty")) {
19678      JsonArray array = json.getAsJsonArray("specialty");
19679      for (int i = 0; i < array.size(); i++) {
19680        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19681      }
19682    };
19683    if (json.has("location")) {
19684      JsonArray array = json.getAsJsonArray("location");
19685      for (int i = 0; i < array.size(); i++) {
19686        res.getLocation().add(parseReference(array.get(i).getAsJsonObject()));
19687      }
19688    };
19689    if (json.has("healthcareService")) {
19690      JsonArray array = json.getAsJsonArray("healthcareService");
19691      for (int i = 0; i < array.size(); i++) {
19692        res.getHealthcareService().add(parseReference(array.get(i).getAsJsonObject()));
19693      }
19694    };
19695    if (json.has("telecom")) {
19696      JsonArray array = json.getAsJsonArray("telecom");
19697      for (int i = 0; i < array.size(); i++) {
19698        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
19699      }
19700    };
19701    if (json.has("availableTime")) {
19702      JsonArray array = json.getAsJsonArray("availableTime");
19703      for (int i = 0; i < array.size(); i++) {
19704        res.getAvailableTime().add(parsePractitionerRolePractitionerRoleAvailableTimeComponent(array.get(i).getAsJsonObject(), res));
19705      }
19706    };
19707    if (json.has("notAvailable")) {
19708      JsonArray array = json.getAsJsonArray("notAvailable");
19709      for (int i = 0; i < array.size(); i++) {
19710        res.getNotAvailable().add(parsePractitionerRolePractitionerRoleNotAvailableComponent(array.get(i).getAsJsonObject(), res));
19711      }
19712    };
19713    if (json.has("availabilityExceptions"))
19714      res.setAvailabilityExceptionsElement(parseString(json.get("availabilityExceptions").getAsString()));
19715    if (json.has("_availabilityExceptions"))
19716      parseElementProperties(json.getAsJsonObject("_availabilityExceptions"), res.getAvailabilityExceptionsElement());
19717    if (json.has("endpoint")) {
19718      JsonArray array = json.getAsJsonArray("endpoint");
19719      for (int i = 0; i < array.size(); i++) {
19720        res.getEndpoint().add(parseReference(array.get(i).getAsJsonObject()));
19721      }
19722    };
19723  }
19724
19725  protected PractitionerRole.PractitionerRoleAvailableTimeComponent parsePractitionerRolePractitionerRoleAvailableTimeComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
19726    PractitionerRole.PractitionerRoleAvailableTimeComponent res = new PractitionerRole.PractitionerRoleAvailableTimeComponent();
19727    parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(json, owner, res);
19728    return res;
19729  }
19730
19731  protected void parsePractitionerRolePractitionerRoleAvailableTimeComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleAvailableTimeComponent res) throws IOException, FHIRFormatError {
19732    parseBackboneElementProperties(json, res);
19733    if (json.has("daysOfWeek")) {
19734      JsonArray array = json.getAsJsonArray("daysOfWeek");
19735      for (int i = 0; i < array.size(); i++) {
19736        res.getDaysOfWeek().add(parseEnumeration(array.get(i).getAsString(), PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
19737      }
19738    };
19739    if (json.has("_daysOfWeek")) {
19740      JsonArray array = json.getAsJsonArray("_daysOfWeek");
19741      for (int i = 0; i < array.size(); i++) {
19742        if (i == res.getDaysOfWeek().size())
19743          res.getDaysOfWeek().add(parseEnumeration(null, PractitionerRole.DaysOfWeek.NULL, new PractitionerRole.DaysOfWeekEnumFactory()));
19744        if (array.get(i) instanceof JsonObject) 
19745          parseElementProperties(array.get(i).getAsJsonObject(), res.getDaysOfWeek().get(i));
19746      }
19747    };
19748    if (json.has("allDay"))
19749      res.setAllDayElement(parseBoolean(json.get("allDay").getAsBoolean()));
19750    if (json.has("_allDay"))
19751      parseElementProperties(json.getAsJsonObject("_allDay"), res.getAllDayElement());
19752    if (json.has("availableStartTime"))
19753      res.setAvailableStartTimeElement(parseTime(json.get("availableStartTime").getAsString()));
19754    if (json.has("_availableStartTime"))
19755      parseElementProperties(json.getAsJsonObject("_availableStartTime"), res.getAvailableStartTimeElement());
19756    if (json.has("availableEndTime"))
19757      res.setAvailableEndTimeElement(parseTime(json.get("availableEndTime").getAsString()));
19758    if (json.has("_availableEndTime"))
19759      parseElementProperties(json.getAsJsonObject("_availableEndTime"), res.getAvailableEndTimeElement());
19760  }
19761
19762  protected PractitionerRole.PractitionerRoleNotAvailableComponent parsePractitionerRolePractitionerRoleNotAvailableComponent(JsonObject json, PractitionerRole owner) throws IOException, FHIRFormatError {
19763    PractitionerRole.PractitionerRoleNotAvailableComponent res = new PractitionerRole.PractitionerRoleNotAvailableComponent();
19764    parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(json, owner, res);
19765    return res;
19766  }
19767
19768  protected void parsePractitionerRolePractitionerRoleNotAvailableComponentProperties(JsonObject json, PractitionerRole owner, PractitionerRole.PractitionerRoleNotAvailableComponent res) throws IOException, FHIRFormatError {
19769    parseBackboneElementProperties(json, res);
19770    if (json.has("description"))
19771      res.setDescriptionElement(parseString(json.get("description").getAsString()));
19772    if (json.has("_description"))
19773      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
19774    if (json.has("during"))
19775      res.setDuring(parsePeriod(json.getAsJsonObject("during")));
19776  }
19777
19778  protected Procedure parseProcedure(JsonObject json) throws IOException, FHIRFormatError {
19779    Procedure res = new Procedure();
19780    parseProcedureProperties(json, res);
19781    return res;
19782  }
19783
19784  protected void parseProcedureProperties(JsonObject json, Procedure res) throws IOException, FHIRFormatError {
19785    parseDomainResourceProperties(json, res);
19786    if (json.has("identifier")) {
19787      JsonArray array = json.getAsJsonArray("identifier");
19788      for (int i = 0; i < array.size(); i++) {
19789        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19790      }
19791    };
19792    if (json.has("instantiatesCanonical")) {
19793      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
19794      for (int i = 0; i < array.size(); i++) {
19795        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
19796      }
19797    };
19798    if (json.has("_instantiatesCanonical")) {
19799      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
19800      for (int i = 0; i < array.size(); i++) {
19801        if (i == res.getInstantiatesCanonical().size())
19802          res.getInstantiatesCanonical().add(parseCanonical(null));
19803        if (array.get(i) instanceof JsonObject) 
19804          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
19805      }
19806    };
19807    if (json.has("instantiatesUri")) {
19808      JsonArray array = json.getAsJsonArray("instantiatesUri");
19809      for (int i = 0; i < array.size(); i++) {
19810        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
19811      }
19812    };
19813    if (json.has("_instantiatesUri")) {
19814      JsonArray array = json.getAsJsonArray("_instantiatesUri");
19815      for (int i = 0; i < array.size(); i++) {
19816        if (i == res.getInstantiatesUri().size())
19817          res.getInstantiatesUri().add(parseUri(null));
19818        if (array.get(i) instanceof JsonObject) 
19819          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
19820      }
19821    };
19822    if (json.has("basedOn")) {
19823      JsonArray array = json.getAsJsonArray("basedOn");
19824      for (int i = 0; i < array.size(); i++) {
19825        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
19826      }
19827    };
19828    if (json.has("partOf")) {
19829      JsonArray array = json.getAsJsonArray("partOf");
19830      for (int i = 0; i < array.size(); i++) {
19831        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
19832      }
19833    };
19834    if (json.has("status"))
19835      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Procedure.ProcedureStatus.NULL, new Procedure.ProcedureStatusEnumFactory()));
19836    if (json.has("_status"))
19837      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19838    if (json.has("statusReason"))
19839      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
19840    if (json.has("category"))
19841      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
19842    if (json.has("code"))
19843      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
19844    if (json.has("subject"))
19845      res.setSubject(parseReference(json.getAsJsonObject("subject")));
19846    if (json.has("context"))
19847      res.setContext(parseReference(json.getAsJsonObject("context")));
19848    Type performed = parseType("performed", json);
19849    if (performed != null)
19850      res.setPerformed(performed);
19851    if (json.has("recorder"))
19852      res.setRecorder(parseReference(json.getAsJsonObject("recorder")));
19853    if (json.has("asserter"))
19854      res.setAsserter(parseReference(json.getAsJsonObject("asserter")));
19855    if (json.has("performer")) {
19856      JsonArray array = json.getAsJsonArray("performer");
19857      for (int i = 0; i < array.size(); i++) {
19858        res.getPerformer().add(parseProcedureProcedurePerformerComponent(array.get(i).getAsJsonObject(), res));
19859      }
19860    };
19861    if (json.has("location"))
19862      res.setLocation(parseReference(json.getAsJsonObject("location")));
19863    if (json.has("reasonCode")) {
19864      JsonArray array = json.getAsJsonArray("reasonCode");
19865      for (int i = 0; i < array.size(); i++) {
19866        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19867      }
19868    };
19869    if (json.has("reasonReference")) {
19870      JsonArray array = json.getAsJsonArray("reasonReference");
19871      for (int i = 0; i < array.size(); i++) {
19872        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
19873      }
19874    };
19875    if (json.has("bodySite")) {
19876      JsonArray array = json.getAsJsonArray("bodySite");
19877      for (int i = 0; i < array.size(); i++) {
19878        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19879      }
19880    };
19881    if (json.has("outcome"))
19882      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
19883    if (json.has("report")) {
19884      JsonArray array = json.getAsJsonArray("report");
19885      for (int i = 0; i < array.size(); i++) {
19886        res.getReport().add(parseReference(array.get(i).getAsJsonObject()));
19887      }
19888    };
19889    if (json.has("complication")) {
19890      JsonArray array = json.getAsJsonArray("complication");
19891      for (int i = 0; i < array.size(); i++) {
19892        res.getComplication().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19893      }
19894    };
19895    if (json.has("complicationDetail")) {
19896      JsonArray array = json.getAsJsonArray("complicationDetail");
19897      for (int i = 0; i < array.size(); i++) {
19898        res.getComplicationDetail().add(parseReference(array.get(i).getAsJsonObject()));
19899      }
19900    };
19901    if (json.has("followUp")) {
19902      JsonArray array = json.getAsJsonArray("followUp");
19903      for (int i = 0; i < array.size(); i++) {
19904        res.getFollowUp().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19905      }
19906    };
19907    if (json.has("note")) {
19908      JsonArray array = json.getAsJsonArray("note");
19909      for (int i = 0; i < array.size(); i++) {
19910        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
19911      }
19912    };
19913    if (json.has("focalDevice")) {
19914      JsonArray array = json.getAsJsonArray("focalDevice");
19915      for (int i = 0; i < array.size(); i++) {
19916        res.getFocalDevice().add(parseProcedureProcedureFocalDeviceComponent(array.get(i).getAsJsonObject(), res));
19917      }
19918    };
19919    if (json.has("usedReference")) {
19920      JsonArray array = json.getAsJsonArray("usedReference");
19921      for (int i = 0; i < array.size(); i++) {
19922        res.getUsedReference().add(parseReference(array.get(i).getAsJsonObject()));
19923      }
19924    };
19925    if (json.has("usedCode")) {
19926      JsonArray array = json.getAsJsonArray("usedCode");
19927      for (int i = 0; i < array.size(); i++) {
19928        res.getUsedCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
19929      }
19930    };
19931  }
19932
19933  protected Procedure.ProcedurePerformerComponent parseProcedureProcedurePerformerComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
19934    Procedure.ProcedurePerformerComponent res = new Procedure.ProcedurePerformerComponent();
19935    parseProcedureProcedurePerformerComponentProperties(json, owner, res);
19936    return res;
19937  }
19938
19939  protected void parseProcedureProcedurePerformerComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedurePerformerComponent res) throws IOException, FHIRFormatError {
19940    parseBackboneElementProperties(json, res);
19941    if (json.has("function"))
19942      res.setFunction(parseCodeableConcept(json.getAsJsonObject("function")));
19943    if (json.has("actor"))
19944      res.setActor(parseReference(json.getAsJsonObject("actor")));
19945    if (json.has("onBehalfOf"))
19946      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
19947  }
19948
19949  protected Procedure.ProcedureFocalDeviceComponent parseProcedureProcedureFocalDeviceComponent(JsonObject json, Procedure owner) throws IOException, FHIRFormatError {
19950    Procedure.ProcedureFocalDeviceComponent res = new Procedure.ProcedureFocalDeviceComponent();
19951    parseProcedureProcedureFocalDeviceComponentProperties(json, owner, res);
19952    return res;
19953  }
19954
19955  protected void parseProcedureProcedureFocalDeviceComponentProperties(JsonObject json, Procedure owner, Procedure.ProcedureFocalDeviceComponent res) throws IOException, FHIRFormatError {
19956    parseBackboneElementProperties(json, res);
19957    if (json.has("action"))
19958      res.setAction(parseCodeableConcept(json.getAsJsonObject("action")));
19959    if (json.has("manipulated"))
19960      res.setManipulated(parseReference(json.getAsJsonObject("manipulated")));
19961  }
19962
19963  protected ProcessRequest parseProcessRequest(JsonObject json) throws IOException, FHIRFormatError {
19964    ProcessRequest res = new ProcessRequest();
19965    parseProcessRequestProperties(json, res);
19966    return res;
19967  }
19968
19969  protected void parseProcessRequestProperties(JsonObject json, ProcessRequest res) throws IOException, FHIRFormatError {
19970    parseDomainResourceProperties(json, res);
19971    if (json.has("identifier")) {
19972      JsonArray array = json.getAsJsonArray("identifier");
19973      for (int i = 0; i < array.size(); i++) {
19974        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
19975      }
19976    };
19977    if (json.has("status"))
19978      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcessRequest.ProcessRequestStatus.NULL, new ProcessRequest.ProcessRequestStatusEnumFactory()));
19979    if (json.has("_status"))
19980      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
19981    if (json.has("action"))
19982      res.setActionElement(parseEnumeration(json.get("action").getAsString(), ProcessRequest.ActionList.NULL, new ProcessRequest.ActionListEnumFactory()));
19983    if (json.has("_action"))
19984      parseElementProperties(json.getAsJsonObject("_action"), res.getActionElement());
19985    if (json.has("target"))
19986      res.setTarget(parseReference(json.getAsJsonObject("target")));
19987    if (json.has("created"))
19988      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
19989    if (json.has("_created"))
19990      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
19991    if (json.has("provider"))
19992      res.setProvider(parseReference(json.getAsJsonObject("provider")));
19993    if (json.has("request"))
19994      res.setRequest(parseReference(json.getAsJsonObject("request")));
19995    if (json.has("response"))
19996      res.setResponse(parseReference(json.getAsJsonObject("response")));
19997    if (json.has("nullify"))
19998      res.setNullifyElement(parseBoolean(json.get("nullify").getAsBoolean()));
19999    if (json.has("_nullify"))
20000      parseElementProperties(json.getAsJsonObject("_nullify"), res.getNullifyElement());
20001    if (json.has("reference"))
20002      res.setReferenceElement(parseString(json.get("reference").getAsString()));
20003    if (json.has("_reference"))
20004      parseElementProperties(json.getAsJsonObject("_reference"), res.getReferenceElement());
20005    if (json.has("item")) {
20006      JsonArray array = json.getAsJsonArray("item");
20007      for (int i = 0; i < array.size(); i++) {
20008        res.getItem().add(parseProcessRequestItemsComponent(array.get(i).getAsJsonObject(), res));
20009      }
20010    };
20011    if (json.has("include")) {
20012      JsonArray array = json.getAsJsonArray("include");
20013      for (int i = 0; i < array.size(); i++) {
20014        res.getInclude().add(parseString(array.get(i).getAsString()));
20015      }
20016    };
20017    if (json.has("_include")) {
20018      JsonArray array = json.getAsJsonArray("_include");
20019      for (int i = 0; i < array.size(); i++) {
20020        if (i == res.getInclude().size())
20021          res.getInclude().add(parseString(null));
20022        if (array.get(i) instanceof JsonObject) 
20023          parseElementProperties(array.get(i).getAsJsonObject(), res.getInclude().get(i));
20024      }
20025    };
20026    if (json.has("exclude")) {
20027      JsonArray array = json.getAsJsonArray("exclude");
20028      for (int i = 0; i < array.size(); i++) {
20029        res.getExclude().add(parseString(array.get(i).getAsString()));
20030      }
20031    };
20032    if (json.has("_exclude")) {
20033      JsonArray array = json.getAsJsonArray("_exclude");
20034      for (int i = 0; i < array.size(); i++) {
20035        if (i == res.getExclude().size())
20036          res.getExclude().add(parseString(null));
20037        if (array.get(i) instanceof JsonObject) 
20038          parseElementProperties(array.get(i).getAsJsonObject(), res.getExclude().get(i));
20039      }
20040    };
20041    if (json.has("period"))
20042      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
20043  }
20044
20045  protected ProcessRequest.ItemsComponent parseProcessRequestItemsComponent(JsonObject json, ProcessRequest owner) throws IOException, FHIRFormatError {
20046    ProcessRequest.ItemsComponent res = new ProcessRequest.ItemsComponent();
20047    parseProcessRequestItemsComponentProperties(json, owner, res);
20048    return res;
20049  }
20050
20051  protected void parseProcessRequestItemsComponentProperties(JsonObject json, ProcessRequest owner, ProcessRequest.ItemsComponent res) throws IOException, FHIRFormatError {
20052    parseBackboneElementProperties(json, res);
20053    if (json.has("sequenceLinkId"))
20054      res.setSequenceLinkIdElement(parseInteger(json.get("sequenceLinkId").getAsLong()));
20055    if (json.has("_sequenceLinkId"))
20056      parseElementProperties(json.getAsJsonObject("_sequenceLinkId"), res.getSequenceLinkIdElement());
20057  }
20058
20059  protected ProcessResponse parseProcessResponse(JsonObject json) throws IOException, FHIRFormatError {
20060    ProcessResponse res = new ProcessResponse();
20061    parseProcessResponseProperties(json, res);
20062    return res;
20063  }
20064
20065  protected void parseProcessResponseProperties(JsonObject json, ProcessResponse res) throws IOException, FHIRFormatError {
20066    parseDomainResourceProperties(json, res);
20067    if (json.has("identifier")) {
20068      JsonArray array = json.getAsJsonArray("identifier");
20069      for (int i = 0; i < array.size(); i++) {
20070        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20071      }
20072    };
20073    if (json.has("status"))
20074      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ProcessResponse.ProcessResponseStatus.NULL, new ProcessResponse.ProcessResponseStatusEnumFactory()));
20075    if (json.has("_status"))
20076      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20077    if (json.has("created"))
20078      res.setCreatedElement(parseDateTime(json.get("created").getAsString()));
20079    if (json.has("_created"))
20080      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
20081    if (json.has("organization"))
20082      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
20083    if (json.has("request"))
20084      res.setRequest(parseReference(json.getAsJsonObject("request")));
20085    if (json.has("outcome"))
20086      res.setOutcomeElement(parseEnumeration(json.get("outcome").getAsString(), ProcessResponse.ProcessingOutcome.NULL, new ProcessResponse.ProcessingOutcomeEnumFactory()));
20087    if (json.has("_outcome"))
20088      parseElementProperties(json.getAsJsonObject("_outcome"), res.getOutcomeElement());
20089    if (json.has("disposition"))
20090      res.setDispositionElement(parseString(json.get("disposition").getAsString()));
20091    if (json.has("_disposition"))
20092      parseElementProperties(json.getAsJsonObject("_disposition"), res.getDispositionElement());
20093    if (json.has("requestProvider"))
20094      res.setRequestProvider(parseReference(json.getAsJsonObject("requestProvider")));
20095    if (json.has("form"))
20096      res.setForm(parseCodeableConcept(json.getAsJsonObject("form")));
20097    if (json.has("processNote")) {
20098      JsonArray array = json.getAsJsonArray("processNote");
20099      for (int i = 0; i < array.size(); i++) {
20100        res.getProcessNote().add(parseProcessResponseProcessResponseProcessNoteComponent(array.get(i).getAsJsonObject(), res));
20101      }
20102    };
20103    if (json.has("error")) {
20104      JsonArray array = json.getAsJsonArray("error");
20105      for (int i = 0; i < array.size(); i++) {
20106        res.getError().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20107      }
20108    };
20109    if (json.has("communicationRequest")) {
20110      JsonArray array = json.getAsJsonArray("communicationRequest");
20111      for (int i = 0; i < array.size(); i++) {
20112        res.getCommunicationRequest().add(parseReference(array.get(i).getAsJsonObject()));
20113      }
20114    };
20115  }
20116
20117  protected ProcessResponse.ProcessResponseProcessNoteComponent parseProcessResponseProcessResponseProcessNoteComponent(JsonObject json, ProcessResponse owner) throws IOException, FHIRFormatError {
20118    ProcessResponse.ProcessResponseProcessNoteComponent res = new ProcessResponse.ProcessResponseProcessNoteComponent();
20119    parseProcessResponseProcessResponseProcessNoteComponentProperties(json, owner, res);
20120    return res;
20121  }
20122
20123  protected void parseProcessResponseProcessResponseProcessNoteComponentProperties(JsonObject json, ProcessResponse owner, ProcessResponse.ProcessResponseProcessNoteComponent res) throws IOException, FHIRFormatError {
20124    parseBackboneElementProperties(json, res);
20125    if (json.has("type"))
20126      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.NoteType.NULL, new Enumerations.NoteTypeEnumFactory()));
20127    if (json.has("_type"))
20128      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20129    if (json.has("text"))
20130      res.setTextElement(parseString(json.get("text").getAsString()));
20131    if (json.has("_text"))
20132      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
20133  }
20134
20135  protected Provenance parseProvenance(JsonObject json) throws IOException, FHIRFormatError {
20136    Provenance res = new Provenance();
20137    parseProvenanceProperties(json, res);
20138    return res;
20139  }
20140
20141  protected void parseProvenanceProperties(JsonObject json, Provenance res) throws IOException, FHIRFormatError {
20142    parseDomainResourceProperties(json, res);
20143    if (json.has("target")) {
20144      JsonArray array = json.getAsJsonArray("target");
20145      for (int i = 0; i < array.size(); i++) {
20146        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
20147      }
20148    };
20149    Type occurred = parseType("occurred", json);
20150    if (occurred != null)
20151      res.setOccurred(occurred);
20152    if (json.has("recorded"))
20153      res.setRecordedElement(parseInstant(json.get("recorded").getAsString()));
20154    if (json.has("_recorded"))
20155      parseElementProperties(json.getAsJsonObject("_recorded"), res.getRecordedElement());
20156    if (json.has("policy")) {
20157      JsonArray array = json.getAsJsonArray("policy");
20158      for (int i = 0; i < array.size(); i++) {
20159        res.getPolicy().add(parseUri(array.get(i).getAsString()));
20160      }
20161    };
20162    if (json.has("_policy")) {
20163      JsonArray array = json.getAsJsonArray("_policy");
20164      for (int i = 0; i < array.size(); i++) {
20165        if (i == res.getPolicy().size())
20166          res.getPolicy().add(parseUri(null));
20167        if (array.get(i) instanceof JsonObject) 
20168          parseElementProperties(array.get(i).getAsJsonObject(), res.getPolicy().get(i));
20169      }
20170    };
20171    if (json.has("location"))
20172      res.setLocation(parseReference(json.getAsJsonObject("location")));
20173    if (json.has("reason")) {
20174      JsonArray array = json.getAsJsonArray("reason");
20175      for (int i = 0; i < array.size(); i++) {
20176        res.getReason().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20177      }
20178    };
20179    if (json.has("activity"))
20180      res.setActivity(parseCodeableConcept(json.getAsJsonObject("activity")));
20181    if (json.has("agent")) {
20182      JsonArray array = json.getAsJsonArray("agent");
20183      for (int i = 0; i < array.size(); i++) {
20184        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), res));
20185      }
20186    };
20187    if (json.has("entity")) {
20188      JsonArray array = json.getAsJsonArray("entity");
20189      for (int i = 0; i < array.size(); i++) {
20190        res.getEntity().add(parseProvenanceProvenanceEntityComponent(array.get(i).getAsJsonObject(), res));
20191      }
20192    };
20193    if (json.has("signature")) {
20194      JsonArray array = json.getAsJsonArray("signature");
20195      for (int i = 0; i < array.size(); i++) {
20196        res.getSignature().add(parseSignature(array.get(i).getAsJsonObject()));
20197      }
20198    };
20199  }
20200
20201  protected Provenance.ProvenanceAgentComponent parseProvenanceProvenanceAgentComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
20202    Provenance.ProvenanceAgentComponent res = new Provenance.ProvenanceAgentComponent();
20203    parseProvenanceProvenanceAgentComponentProperties(json, owner, res);
20204    return res;
20205  }
20206
20207  protected void parseProvenanceProvenanceAgentComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceAgentComponent res) throws IOException, FHIRFormatError {
20208    parseBackboneElementProperties(json, res);
20209    if (json.has("type"))
20210      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20211    if (json.has("role")) {
20212      JsonArray array = json.getAsJsonArray("role");
20213      for (int i = 0; i < array.size(); i++) {
20214        res.getRole().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20215      }
20216    };
20217    if (json.has("who"))
20218      res.setWho(parseReference(json.getAsJsonObject("who")));
20219    if (json.has("onBehalfOf"))
20220      res.setOnBehalfOf(parseReference(json.getAsJsonObject("onBehalfOf")));
20221  }
20222
20223  protected Provenance.ProvenanceEntityComponent parseProvenanceProvenanceEntityComponent(JsonObject json, Provenance owner) throws IOException, FHIRFormatError {
20224    Provenance.ProvenanceEntityComponent res = new Provenance.ProvenanceEntityComponent();
20225    parseProvenanceProvenanceEntityComponentProperties(json, owner, res);
20226    return res;
20227  }
20228
20229  protected void parseProvenanceProvenanceEntityComponentProperties(JsonObject json, Provenance owner, Provenance.ProvenanceEntityComponent res) throws IOException, FHIRFormatError {
20230    parseBackboneElementProperties(json, res);
20231    if (json.has("role"))
20232      res.setRoleElement(parseEnumeration(json.get("role").getAsString(), Provenance.ProvenanceEntityRole.NULL, new Provenance.ProvenanceEntityRoleEnumFactory()));
20233    if (json.has("_role"))
20234      parseElementProperties(json.getAsJsonObject("_role"), res.getRoleElement());
20235    if (json.has("what"))
20236      res.setWhat(parseReference(json.getAsJsonObject("what")));
20237    if (json.has("agent")) {
20238      JsonArray array = json.getAsJsonArray("agent");
20239      for (int i = 0; i < array.size(); i++) {
20240        res.getAgent().add(parseProvenanceProvenanceAgentComponent(array.get(i).getAsJsonObject(), owner));
20241      }
20242    };
20243  }
20244
20245  protected Questionnaire parseQuestionnaire(JsonObject json) throws IOException, FHIRFormatError {
20246    Questionnaire res = new Questionnaire();
20247    parseQuestionnaireProperties(json, res);
20248    return res;
20249  }
20250
20251  protected void parseQuestionnaireProperties(JsonObject json, Questionnaire res) throws IOException, FHIRFormatError {
20252    parseDomainResourceProperties(json, res);
20253    if (json.has("url"))
20254      res.setUrlElement(parseUri(json.get("url").getAsString()));
20255    if (json.has("_url"))
20256      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
20257    if (json.has("identifier")) {
20258      JsonArray array = json.getAsJsonArray("identifier");
20259      for (int i = 0; i < array.size(); i++) {
20260        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20261      }
20262    };
20263    if (json.has("version"))
20264      res.setVersionElement(parseString(json.get("version").getAsString()));
20265    if (json.has("_version"))
20266      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
20267    if (json.has("name"))
20268      res.setNameElement(parseString(json.get("name").getAsString()));
20269    if (json.has("_name"))
20270      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
20271    if (json.has("title"))
20272      res.setTitleElement(parseString(json.get("title").getAsString()));
20273    if (json.has("_title"))
20274      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20275    if (json.has("derivedFrom")) {
20276      JsonArray array = json.getAsJsonArray("derivedFrom");
20277      for (int i = 0; i < array.size(); i++) {
20278        res.getDerivedFrom().add(parseCanonical(array.get(i).getAsString()));
20279      }
20280    };
20281    if (json.has("_derivedFrom")) {
20282      JsonArray array = json.getAsJsonArray("_derivedFrom");
20283      for (int i = 0; i < array.size(); i++) {
20284        if (i == res.getDerivedFrom().size())
20285          res.getDerivedFrom().add(parseCanonical(null));
20286        if (array.get(i) instanceof JsonObject) 
20287          parseElementProperties(array.get(i).getAsJsonObject(), res.getDerivedFrom().get(i));
20288      }
20289    };
20290    if (json.has("status"))
20291      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
20292    if (json.has("_status"))
20293      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20294    if (json.has("experimental"))
20295      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
20296    if (json.has("_experimental"))
20297      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
20298    if (json.has("subjectType")) {
20299      JsonArray array = json.getAsJsonArray("subjectType");
20300      for (int i = 0; i < array.size(); i++) {
20301        res.getSubjectType().add(parseCode(array.get(i).getAsString()));
20302      }
20303    };
20304    if (json.has("_subjectType")) {
20305      JsonArray array = json.getAsJsonArray("_subjectType");
20306      for (int i = 0; i < array.size(); i++) {
20307        if (i == res.getSubjectType().size())
20308          res.getSubjectType().add(parseCode(null));
20309        if (array.get(i) instanceof JsonObject) 
20310          parseElementProperties(array.get(i).getAsJsonObject(), res.getSubjectType().get(i));
20311      }
20312    };
20313    if (json.has("date"))
20314      res.setDateElement(parseDateTime(json.get("date").getAsString()));
20315    if (json.has("_date"))
20316      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
20317    if (json.has("publisher"))
20318      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
20319    if (json.has("_publisher"))
20320      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
20321    if (json.has("contact")) {
20322      JsonArray array = json.getAsJsonArray("contact");
20323      for (int i = 0; i < array.size(); i++) {
20324        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20325      }
20326    };
20327    if (json.has("description"))
20328      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
20329    if (json.has("_description"))
20330      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20331    if (json.has("useContext")) {
20332      JsonArray array = json.getAsJsonArray("useContext");
20333      for (int i = 0; i < array.size(); i++) {
20334        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
20335      }
20336    };
20337    if (json.has("jurisdiction")) {
20338      JsonArray array = json.getAsJsonArray("jurisdiction");
20339      for (int i = 0; i < array.size(); i++) {
20340        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20341      }
20342    };
20343    if (json.has("purpose"))
20344      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
20345    if (json.has("_purpose"))
20346      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
20347    if (json.has("copyright"))
20348      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
20349    if (json.has("_copyright"))
20350      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
20351    if (json.has("approvalDate"))
20352      res.setApprovalDateElement(parseDate(json.get("approvalDate").getAsString()));
20353    if (json.has("_approvalDate"))
20354      parseElementProperties(json.getAsJsonObject("_approvalDate"), res.getApprovalDateElement());
20355    if (json.has("lastReviewDate"))
20356      res.setLastReviewDateElement(parseDate(json.get("lastReviewDate").getAsString()));
20357    if (json.has("_lastReviewDate"))
20358      parseElementProperties(json.getAsJsonObject("_lastReviewDate"), res.getLastReviewDateElement());
20359    if (json.has("effectivePeriod"))
20360      res.setEffectivePeriod(parsePeriod(json.getAsJsonObject("effectivePeriod")));
20361    if (json.has("code")) {
20362      JsonArray array = json.getAsJsonArray("code");
20363      for (int i = 0; i < array.size(); i++) {
20364        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
20365      }
20366    };
20367    if (json.has("item")) {
20368      JsonArray array = json.getAsJsonArray("item");
20369      for (int i = 0; i < array.size(); i++) {
20370        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), res));
20371      }
20372    };
20373  }
20374
20375  protected Questionnaire.QuestionnaireItemComponent parseQuestionnaireQuestionnaireItemComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
20376    Questionnaire.QuestionnaireItemComponent res = new Questionnaire.QuestionnaireItemComponent();
20377    parseQuestionnaireQuestionnaireItemComponentProperties(json, owner, res);
20378    return res;
20379  }
20380
20381  protected void parseQuestionnaireQuestionnaireItemComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemComponent res) throws IOException, FHIRFormatError {
20382    parseBackboneElementProperties(json, res);
20383    if (json.has("linkId"))
20384      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
20385    if (json.has("_linkId"))
20386      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
20387    if (json.has("definition"))
20388      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
20389    if (json.has("_definition"))
20390      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
20391    if (json.has("code")) {
20392      JsonArray array = json.getAsJsonArray("code");
20393      for (int i = 0; i < array.size(); i++) {
20394        res.getCode().add(parseCoding(array.get(i).getAsJsonObject()));
20395      }
20396    };
20397    if (json.has("prefix"))
20398      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
20399    if (json.has("_prefix"))
20400      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
20401    if (json.has("text"))
20402      res.setTextElement(parseString(json.get("text").getAsString()));
20403    if (json.has("_text"))
20404      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
20405    if (json.has("type"))
20406      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Questionnaire.QuestionnaireItemType.NULL, new Questionnaire.QuestionnaireItemTypeEnumFactory()));
20407    if (json.has("_type"))
20408      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
20409    if (json.has("enableWhen")) {
20410      JsonArray array = json.getAsJsonArray("enableWhen");
20411      for (int i = 0; i < array.size(); i++) {
20412        res.getEnableWhen().add(parseQuestionnaireQuestionnaireItemEnableWhenComponent(array.get(i).getAsJsonObject(), owner));
20413      }
20414    };
20415    if (json.has("enableBehavior"))
20416      res.setEnableBehaviorElement(parseEnumeration(json.get("enableBehavior").getAsString(), Questionnaire.EnableWhenBehavior.NULL, new Questionnaire.EnableWhenBehaviorEnumFactory()));
20417    if (json.has("_enableBehavior"))
20418      parseElementProperties(json.getAsJsonObject("_enableBehavior"), res.getEnableBehaviorElement());
20419    if (json.has("required"))
20420      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
20421    if (json.has("_required"))
20422      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
20423    if (json.has("repeats"))
20424      res.setRepeatsElement(parseBoolean(json.get("repeats").getAsBoolean()));
20425    if (json.has("_repeats"))
20426      parseElementProperties(json.getAsJsonObject("_repeats"), res.getRepeatsElement());
20427    if (json.has("readOnly"))
20428      res.setReadOnlyElement(parseBoolean(json.get("readOnly").getAsBoolean()));
20429    if (json.has("_readOnly"))
20430      parseElementProperties(json.getAsJsonObject("_readOnly"), res.getReadOnlyElement());
20431    if (json.has("maxLength"))
20432      res.setMaxLengthElement(parseInteger(json.get("maxLength").getAsLong()));
20433    if (json.has("_maxLength"))
20434      parseElementProperties(json.getAsJsonObject("_maxLength"), res.getMaxLengthElement());
20435    if (json.has("answerValueSet"))
20436      res.setAnswerValueSetElement(parseCanonical(json.get("answerValueSet").getAsString()));
20437    if (json.has("_answerValueSet"))
20438      parseElementProperties(json.getAsJsonObject("_answerValueSet"), res.getAnswerValueSetElement());
20439    if (json.has("answerOption")) {
20440      JsonArray array = json.getAsJsonArray("answerOption");
20441      for (int i = 0; i < array.size(); i++) {
20442        res.getAnswerOption().add(parseQuestionnaireQuestionnaireItemAnswerOptionComponent(array.get(i).getAsJsonObject(), owner));
20443      }
20444    };
20445    if (json.has("initial")) {
20446      JsonArray array = json.getAsJsonArray("initial");
20447      for (int i = 0; i < array.size(); i++) {
20448        res.getInitial().add(parseQuestionnaireQuestionnaireItemInitialComponent(array.get(i).getAsJsonObject(), owner));
20449      }
20450    };
20451    if (json.has("item")) {
20452      JsonArray array = json.getAsJsonArray("item");
20453      for (int i = 0; i < array.size(); i++) {
20454        res.getItem().add(parseQuestionnaireQuestionnaireItemComponent(array.get(i).getAsJsonObject(), owner));
20455      }
20456    };
20457  }
20458
20459  protected Questionnaire.QuestionnaireItemEnableWhenComponent parseQuestionnaireQuestionnaireItemEnableWhenComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
20460    Questionnaire.QuestionnaireItemEnableWhenComponent res = new Questionnaire.QuestionnaireItemEnableWhenComponent();
20461    parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(json, owner, res);
20462    return res;
20463  }
20464
20465  protected void parseQuestionnaireQuestionnaireItemEnableWhenComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemEnableWhenComponent res) throws IOException, FHIRFormatError {
20466    parseBackboneElementProperties(json, res);
20467    if (json.has("question"))
20468      res.setQuestionElement(parseString(json.get("question").getAsString()));
20469    if (json.has("_question"))
20470      parseElementProperties(json.getAsJsonObject("_question"), res.getQuestionElement());
20471    if (json.has("operator"))
20472      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), Questionnaire.QuestionnaireItemOperator.NULL, new Questionnaire.QuestionnaireItemOperatorEnumFactory()));
20473    if (json.has("_operator"))
20474      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
20475    Type answer = parseType("answer", json);
20476    if (answer != null)
20477      res.setAnswer(answer);
20478  }
20479
20480  protected Questionnaire.QuestionnaireItemAnswerOptionComponent parseQuestionnaireQuestionnaireItemAnswerOptionComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
20481    Questionnaire.QuestionnaireItemAnswerOptionComponent res = new Questionnaire.QuestionnaireItemAnswerOptionComponent();
20482    parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(json, owner, res);
20483    return res;
20484  }
20485
20486  protected void parseQuestionnaireQuestionnaireItemAnswerOptionComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemAnswerOptionComponent res) throws IOException, FHIRFormatError {
20487    parseBackboneElementProperties(json, res);
20488    Type value = parseType("value", json);
20489    if (value != null)
20490      res.setValue(value);
20491    if (json.has("initialSelected"))
20492      res.setInitialSelectedElement(parseBoolean(json.get("initialSelected").getAsBoolean()));
20493    if (json.has("_initialSelected"))
20494      parseElementProperties(json.getAsJsonObject("_initialSelected"), res.getInitialSelectedElement());
20495  }
20496
20497  protected Questionnaire.QuestionnaireItemInitialComponent parseQuestionnaireQuestionnaireItemInitialComponent(JsonObject json, Questionnaire owner) throws IOException, FHIRFormatError {
20498    Questionnaire.QuestionnaireItemInitialComponent res = new Questionnaire.QuestionnaireItemInitialComponent();
20499    parseQuestionnaireQuestionnaireItemInitialComponentProperties(json, owner, res);
20500    return res;
20501  }
20502
20503  protected void parseQuestionnaireQuestionnaireItemInitialComponentProperties(JsonObject json, Questionnaire owner, Questionnaire.QuestionnaireItemInitialComponent res) throws IOException, FHIRFormatError {
20504    parseBackboneElementProperties(json, res);
20505    Type value = parseType("value", json);
20506    if (value != null)
20507      res.setValue(value);
20508  }
20509
20510  protected QuestionnaireResponse parseQuestionnaireResponse(JsonObject json) throws IOException, FHIRFormatError {
20511    QuestionnaireResponse res = new QuestionnaireResponse();
20512    parseQuestionnaireResponseProperties(json, res);
20513    return res;
20514  }
20515
20516  protected void parseQuestionnaireResponseProperties(JsonObject json, QuestionnaireResponse res) throws IOException, FHIRFormatError {
20517    parseDomainResourceProperties(json, res);
20518    if (json.has("identifier"))
20519      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
20520    if (json.has("basedOn")) {
20521      JsonArray array = json.getAsJsonArray("basedOn");
20522      for (int i = 0; i < array.size(); i++) {
20523        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
20524      }
20525    };
20526    if (json.has("partOf")) {
20527      JsonArray array = json.getAsJsonArray("partOf");
20528      for (int i = 0; i < array.size(); i++) {
20529        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
20530      }
20531    };
20532    if (json.has("questionnaire"))
20533      res.setQuestionnaireElement(parseCanonical(json.get("questionnaire").getAsString()));
20534    if (json.has("_questionnaire"))
20535      parseElementProperties(json.getAsJsonObject("_questionnaire"), res.getQuestionnaireElement());
20536    if (json.has("status"))
20537      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), QuestionnaireResponse.QuestionnaireResponseStatus.NULL, new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory()));
20538    if (json.has("_status"))
20539      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20540    if (json.has("subject"))
20541      res.setSubject(parseReference(json.getAsJsonObject("subject")));
20542    if (json.has("context"))
20543      res.setContext(parseReference(json.getAsJsonObject("context")));
20544    if (json.has("authored"))
20545      res.setAuthoredElement(parseDateTime(json.get("authored").getAsString()));
20546    if (json.has("_authored"))
20547      parseElementProperties(json.getAsJsonObject("_authored"), res.getAuthoredElement());
20548    if (json.has("author"))
20549      res.setAuthor(parseReference(json.getAsJsonObject("author")));
20550    if (json.has("source"))
20551      res.setSource(parseReference(json.getAsJsonObject("source")));
20552    if (json.has("item")) {
20553      JsonArray array = json.getAsJsonArray("item");
20554      for (int i = 0; i < array.size(); i++) {
20555        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), res));
20556      }
20557    };
20558  }
20559
20560  protected QuestionnaireResponse.QuestionnaireResponseItemComponent parseQuestionnaireResponseQuestionnaireResponseItemComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
20561    QuestionnaireResponse.QuestionnaireResponseItemComponent res = new QuestionnaireResponse.QuestionnaireResponseItemComponent();
20562    parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(json, owner, res);
20563    return res;
20564  }
20565
20566  protected void parseQuestionnaireResponseQuestionnaireResponseItemComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemComponent res) throws IOException, FHIRFormatError {
20567    parseBackboneElementProperties(json, res);
20568    if (json.has("linkId"))
20569      res.setLinkIdElement(parseString(json.get("linkId").getAsString()));
20570    if (json.has("_linkId"))
20571      parseElementProperties(json.getAsJsonObject("_linkId"), res.getLinkIdElement());
20572    if (json.has("definition"))
20573      res.setDefinitionElement(parseUri(json.get("definition").getAsString()));
20574    if (json.has("_definition"))
20575      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
20576    if (json.has("text"))
20577      res.setTextElement(parseString(json.get("text").getAsString()));
20578    if (json.has("_text"))
20579      parseElementProperties(json.getAsJsonObject("_text"), res.getTextElement());
20580    if (json.has("answer")) {
20581      JsonArray array = json.getAsJsonArray("answer");
20582      for (int i = 0; i < array.size(); i++) {
20583        res.getAnswer().add(parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(array.get(i).getAsJsonObject(), owner));
20584      }
20585    };
20586    if (json.has("item")) {
20587      JsonArray array = json.getAsJsonArray("item");
20588      for (int i = 0; i < array.size(); i++) {
20589        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
20590      }
20591    };
20592  }
20593
20594  protected QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(JsonObject json, QuestionnaireResponse owner) throws IOException, FHIRFormatError {
20595    QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res = new QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent();
20596    parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(json, owner, res);
20597    return res;
20598  }
20599
20600  protected void parseQuestionnaireResponseQuestionnaireResponseItemAnswerComponentProperties(JsonObject json, QuestionnaireResponse owner, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent res) throws IOException, FHIRFormatError {
20601    parseBackboneElementProperties(json, res);
20602    Type value = parseType("value", json);
20603    if (value != null)
20604      res.setValue(value);
20605    if (json.has("item")) {
20606      JsonArray array = json.getAsJsonArray("item");
20607      for (int i = 0; i < array.size(); i++) {
20608        res.getItem().add(parseQuestionnaireResponseQuestionnaireResponseItemComponent(array.get(i).getAsJsonObject(), owner));
20609      }
20610    };
20611  }
20612
20613  protected RelatedPerson parseRelatedPerson(JsonObject json) throws IOException, FHIRFormatError {
20614    RelatedPerson res = new RelatedPerson();
20615    parseRelatedPersonProperties(json, res);
20616    return res;
20617  }
20618
20619  protected void parseRelatedPersonProperties(JsonObject json, RelatedPerson res) throws IOException, FHIRFormatError {
20620    parseDomainResourceProperties(json, res);
20621    if (json.has("identifier")) {
20622      JsonArray array = json.getAsJsonArray("identifier");
20623      for (int i = 0; i < array.size(); i++) {
20624        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20625      }
20626    };
20627    if (json.has("active"))
20628      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
20629    if (json.has("_active"))
20630      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
20631    if (json.has("patient"))
20632      res.setPatient(parseReference(json.getAsJsonObject("patient")));
20633    if (json.has("relationship")) {
20634      JsonArray array = json.getAsJsonArray("relationship");
20635      for (int i = 0; i < array.size(); i++) {
20636        res.getRelationship().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20637      }
20638    };
20639    if (json.has("name")) {
20640      JsonArray array = json.getAsJsonArray("name");
20641      for (int i = 0; i < array.size(); i++) {
20642        res.getName().add(parseHumanName(array.get(i).getAsJsonObject()));
20643      }
20644    };
20645    if (json.has("telecom")) {
20646      JsonArray array = json.getAsJsonArray("telecom");
20647      for (int i = 0; i < array.size(); i++) {
20648        res.getTelecom().add(parseContactPoint(array.get(i).getAsJsonObject()));
20649      }
20650    };
20651    if (json.has("gender"))
20652      res.setGenderElement(parseEnumeration(json.get("gender").getAsString(), Enumerations.AdministrativeGender.NULL, new Enumerations.AdministrativeGenderEnumFactory()));
20653    if (json.has("_gender"))
20654      parseElementProperties(json.getAsJsonObject("_gender"), res.getGenderElement());
20655    if (json.has("birthDate"))
20656      res.setBirthDateElement(parseDate(json.get("birthDate").getAsString()));
20657    if (json.has("_birthDate"))
20658      parseElementProperties(json.getAsJsonObject("_birthDate"), res.getBirthDateElement());
20659    if (json.has("address")) {
20660      JsonArray array = json.getAsJsonArray("address");
20661      for (int i = 0; i < array.size(); i++) {
20662        res.getAddress().add(parseAddress(array.get(i).getAsJsonObject()));
20663      }
20664    };
20665    if (json.has("photo")) {
20666      JsonArray array = json.getAsJsonArray("photo");
20667      for (int i = 0; i < array.size(); i++) {
20668        res.getPhoto().add(parseAttachment(array.get(i).getAsJsonObject()));
20669      }
20670    };
20671    if (json.has("period"))
20672      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
20673  }
20674
20675  protected RequestGroup parseRequestGroup(JsonObject json) throws IOException, FHIRFormatError {
20676    RequestGroup res = new RequestGroup();
20677    parseRequestGroupProperties(json, res);
20678    return res;
20679  }
20680
20681  protected void parseRequestGroupProperties(JsonObject json, RequestGroup res) throws IOException, FHIRFormatError {
20682    parseDomainResourceProperties(json, res);
20683    if (json.has("identifier")) {
20684      JsonArray array = json.getAsJsonArray("identifier");
20685      for (int i = 0; i < array.size(); i++) {
20686        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20687      }
20688    };
20689    if (json.has("instantiatesCanonical")) {
20690      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
20691      for (int i = 0; i < array.size(); i++) {
20692        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
20693      }
20694    };
20695    if (json.has("_instantiatesCanonical")) {
20696      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
20697      for (int i = 0; i < array.size(); i++) {
20698        if (i == res.getInstantiatesCanonical().size())
20699          res.getInstantiatesCanonical().add(parseCanonical(null));
20700        if (array.get(i) instanceof JsonObject) 
20701          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
20702      }
20703    };
20704    if (json.has("instantiatesUri")) {
20705      JsonArray array = json.getAsJsonArray("instantiatesUri");
20706      for (int i = 0; i < array.size(); i++) {
20707        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
20708      }
20709    };
20710    if (json.has("_instantiatesUri")) {
20711      JsonArray array = json.getAsJsonArray("_instantiatesUri");
20712      for (int i = 0; i < array.size(); i++) {
20713        if (i == res.getInstantiatesUri().size())
20714          res.getInstantiatesUri().add(parseUri(null));
20715        if (array.get(i) instanceof JsonObject) 
20716          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
20717      }
20718    };
20719    if (json.has("basedOn")) {
20720      JsonArray array = json.getAsJsonArray("basedOn");
20721      for (int i = 0; i < array.size(); i++) {
20722        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
20723      }
20724    };
20725    if (json.has("replaces")) {
20726      JsonArray array = json.getAsJsonArray("replaces");
20727      for (int i = 0; i < array.size(); i++) {
20728        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
20729      }
20730    };
20731    if (json.has("groupIdentifier"))
20732      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
20733    if (json.has("status"))
20734      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RequestGroup.RequestStatus.NULL, new RequestGroup.RequestStatusEnumFactory()));
20735    if (json.has("_status"))
20736      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20737    if (json.has("intent"))
20738      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), RequestGroup.RequestIntent.NULL, new RequestGroup.RequestIntentEnumFactory()));
20739    if (json.has("_intent"))
20740      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
20741    if (json.has("priority"))
20742      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
20743    if (json.has("_priority"))
20744      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
20745    if (json.has("code"))
20746      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
20747    if (json.has("subject"))
20748      res.setSubject(parseReference(json.getAsJsonObject("subject")));
20749    if (json.has("context"))
20750      res.setContext(parseReference(json.getAsJsonObject("context")));
20751    if (json.has("authoredOn"))
20752      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
20753    if (json.has("_authoredOn"))
20754      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
20755    if (json.has("author"))
20756      res.setAuthor(parseReference(json.getAsJsonObject("author")));
20757    if (json.has("reasonCode")) {
20758      JsonArray array = json.getAsJsonArray("reasonCode");
20759      for (int i = 0; i < array.size(); i++) {
20760        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20761      }
20762    };
20763    if (json.has("reasonReference")) {
20764      JsonArray array = json.getAsJsonArray("reasonReference");
20765      for (int i = 0; i < array.size(); i++) {
20766        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
20767      }
20768    };
20769    if (json.has("note")) {
20770      JsonArray array = json.getAsJsonArray("note");
20771      for (int i = 0; i < array.size(); i++) {
20772        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
20773      }
20774    };
20775    if (json.has("action")) {
20776      JsonArray array = json.getAsJsonArray("action");
20777      for (int i = 0; i < array.size(); i++) {
20778        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), res));
20779      }
20780    };
20781  }
20782
20783  protected RequestGroup.RequestGroupActionComponent parseRequestGroupRequestGroupActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
20784    RequestGroup.RequestGroupActionComponent res = new RequestGroup.RequestGroupActionComponent();
20785    parseRequestGroupRequestGroupActionComponentProperties(json, owner, res);
20786    return res;
20787  }
20788
20789  protected void parseRequestGroupRequestGroupActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionComponent res) throws IOException, FHIRFormatError {
20790    parseBackboneElementProperties(json, res);
20791    if (json.has("prefix"))
20792      res.setPrefixElement(parseString(json.get("prefix").getAsString()));
20793    if (json.has("_prefix"))
20794      parseElementProperties(json.getAsJsonObject("_prefix"), res.getPrefixElement());
20795    if (json.has("title"))
20796      res.setTitleElement(parseString(json.get("title").getAsString()));
20797    if (json.has("_title"))
20798      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20799    if (json.has("description"))
20800      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20801    if (json.has("_description"))
20802      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20803    if (json.has("textEquivalent"))
20804      res.setTextEquivalentElement(parseString(json.get("textEquivalent").getAsString()));
20805    if (json.has("_textEquivalent"))
20806      parseElementProperties(json.getAsJsonObject("_textEquivalent"), res.getTextEquivalentElement());
20807    if (json.has("priority"))
20808      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), RequestGroup.RequestPriority.NULL, new RequestGroup.RequestPriorityEnumFactory()));
20809    if (json.has("_priority"))
20810      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
20811    if (json.has("code")) {
20812      JsonArray array = json.getAsJsonArray("code");
20813      for (int i = 0; i < array.size(); i++) {
20814        res.getCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20815      }
20816    };
20817    if (json.has("documentation")) {
20818      JsonArray array = json.getAsJsonArray("documentation");
20819      for (int i = 0; i < array.size(); i++) {
20820        res.getDocumentation().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20821      }
20822    };
20823    if (json.has("condition")) {
20824      JsonArray array = json.getAsJsonArray("condition");
20825      for (int i = 0; i < array.size(); i++) {
20826        res.getCondition().add(parseRequestGroupRequestGroupActionConditionComponent(array.get(i).getAsJsonObject(), owner));
20827      }
20828    };
20829    if (json.has("relatedAction")) {
20830      JsonArray array = json.getAsJsonArray("relatedAction");
20831      for (int i = 0; i < array.size(); i++) {
20832        res.getRelatedAction().add(parseRequestGroupRequestGroupActionRelatedActionComponent(array.get(i).getAsJsonObject(), owner));
20833      }
20834    };
20835    Type timing = parseType("timing", json);
20836    if (timing != null)
20837      res.setTiming(timing);
20838    if (json.has("participant")) {
20839      JsonArray array = json.getAsJsonArray("participant");
20840      for (int i = 0; i < array.size(); i++) {
20841        res.getParticipant().add(parseReference(array.get(i).getAsJsonObject()));
20842      }
20843    };
20844    if (json.has("type"))
20845      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
20846    if (json.has("groupingBehavior"))
20847      res.setGroupingBehaviorElement(parseEnumeration(json.get("groupingBehavior").getAsString(), RequestGroup.ActionGroupingBehavior.NULL, new RequestGroup.ActionGroupingBehaviorEnumFactory()));
20848    if (json.has("_groupingBehavior"))
20849      parseElementProperties(json.getAsJsonObject("_groupingBehavior"), res.getGroupingBehaviorElement());
20850    if (json.has("selectionBehavior"))
20851      res.setSelectionBehaviorElement(parseEnumeration(json.get("selectionBehavior").getAsString(), RequestGroup.ActionSelectionBehavior.NULL, new RequestGroup.ActionSelectionBehaviorEnumFactory()));
20852    if (json.has("_selectionBehavior"))
20853      parseElementProperties(json.getAsJsonObject("_selectionBehavior"), res.getSelectionBehaviorElement());
20854    if (json.has("requiredBehavior"))
20855      res.setRequiredBehaviorElement(parseEnumeration(json.get("requiredBehavior").getAsString(), RequestGroup.ActionRequiredBehavior.NULL, new RequestGroup.ActionRequiredBehaviorEnumFactory()));
20856    if (json.has("_requiredBehavior"))
20857      parseElementProperties(json.getAsJsonObject("_requiredBehavior"), res.getRequiredBehaviorElement());
20858    if (json.has("precheckBehavior"))
20859      res.setPrecheckBehaviorElement(parseEnumeration(json.get("precheckBehavior").getAsString(), RequestGroup.ActionPrecheckBehavior.NULL, new RequestGroup.ActionPrecheckBehaviorEnumFactory()));
20860    if (json.has("_precheckBehavior"))
20861      parseElementProperties(json.getAsJsonObject("_precheckBehavior"), res.getPrecheckBehaviorElement());
20862    if (json.has("cardinalityBehavior"))
20863      res.setCardinalityBehaviorElement(parseEnumeration(json.get("cardinalityBehavior").getAsString(), RequestGroup.ActionCardinalityBehavior.NULL, new RequestGroup.ActionCardinalityBehaviorEnumFactory()));
20864    if (json.has("_cardinalityBehavior"))
20865      parseElementProperties(json.getAsJsonObject("_cardinalityBehavior"), res.getCardinalityBehaviorElement());
20866    if (json.has("resource"))
20867      res.setResource(parseReference(json.getAsJsonObject("resource")));
20868    if (json.has("action")) {
20869      JsonArray array = json.getAsJsonArray("action");
20870      for (int i = 0; i < array.size(); i++) {
20871        res.getAction().add(parseRequestGroupRequestGroupActionComponent(array.get(i).getAsJsonObject(), owner));
20872      }
20873    };
20874  }
20875
20876  protected RequestGroup.RequestGroupActionConditionComponent parseRequestGroupRequestGroupActionConditionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
20877    RequestGroup.RequestGroupActionConditionComponent res = new RequestGroup.RequestGroupActionConditionComponent();
20878    parseRequestGroupRequestGroupActionConditionComponentProperties(json, owner, res);
20879    return res;
20880  }
20881
20882  protected void parseRequestGroupRequestGroupActionConditionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionConditionComponent res) throws IOException, FHIRFormatError {
20883    parseBackboneElementProperties(json, res);
20884    if (json.has("kind"))
20885      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), RequestGroup.ActionConditionKind.NULL, new RequestGroup.ActionConditionKindEnumFactory()));
20886    if (json.has("_kind"))
20887      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
20888    if (json.has("description"))
20889      res.setDescriptionElement(parseString(json.get("description").getAsString()));
20890    if (json.has("_description"))
20891      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
20892    if (json.has("language"))
20893      res.setLanguageElement(parseString(json.get("language").getAsString()));
20894    if (json.has("_language"))
20895      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
20896    if (json.has("expression"))
20897      res.setExpressionElement(parseString(json.get("expression").getAsString()));
20898    if (json.has("_expression"))
20899      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
20900  }
20901
20902  protected RequestGroup.RequestGroupActionRelatedActionComponent parseRequestGroupRequestGroupActionRelatedActionComponent(JsonObject json, RequestGroup owner) throws IOException, FHIRFormatError {
20903    RequestGroup.RequestGroupActionRelatedActionComponent res = new RequestGroup.RequestGroupActionRelatedActionComponent();
20904    parseRequestGroupRequestGroupActionRelatedActionComponentProperties(json, owner, res);
20905    return res;
20906  }
20907
20908  protected void parseRequestGroupRequestGroupActionRelatedActionComponentProperties(JsonObject json, RequestGroup owner, RequestGroup.RequestGroupActionRelatedActionComponent res) throws IOException, FHIRFormatError {
20909    parseBackboneElementProperties(json, res);
20910    if (json.has("actionId"))
20911      res.setActionIdElement(parseId(json.get("actionId").getAsString()));
20912    if (json.has("_actionId"))
20913      parseElementProperties(json.getAsJsonObject("_actionId"), res.getActionIdElement());
20914    if (json.has("relationship"))
20915      res.setRelationshipElement(parseEnumeration(json.get("relationship").getAsString(), RequestGroup.ActionRelationshipType.NULL, new RequestGroup.ActionRelationshipTypeEnumFactory()));
20916    if (json.has("_relationship"))
20917      parseElementProperties(json.getAsJsonObject("_relationship"), res.getRelationshipElement());
20918    Type offset = parseType("offset", json);
20919    if (offset != null)
20920      res.setOffset(offset);
20921  }
20922
20923  protected ResearchStudy parseResearchStudy(JsonObject json) throws IOException, FHIRFormatError {
20924    ResearchStudy res = new ResearchStudy();
20925    parseResearchStudyProperties(json, res);
20926    return res;
20927  }
20928
20929  protected void parseResearchStudyProperties(JsonObject json, ResearchStudy res) throws IOException, FHIRFormatError {
20930    parseDomainResourceProperties(json, res);
20931    if (json.has("identifier")) {
20932      JsonArray array = json.getAsJsonArray("identifier");
20933      for (int i = 0; i < array.size(); i++) {
20934        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
20935      }
20936    };
20937    if (json.has("title"))
20938      res.setTitleElement(parseString(json.get("title").getAsString()));
20939    if (json.has("_title"))
20940      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
20941    if (json.has("protocol")) {
20942      JsonArray array = json.getAsJsonArray("protocol");
20943      for (int i = 0; i < array.size(); i++) {
20944        res.getProtocol().add(parseReference(array.get(i).getAsJsonObject()));
20945      }
20946    };
20947    if (json.has("partOf")) {
20948      JsonArray array = json.getAsJsonArray("partOf");
20949      for (int i = 0; i < array.size(); i++) {
20950        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
20951      }
20952    };
20953    if (json.has("status"))
20954      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchStudy.ResearchStudyStatus.NULL, new ResearchStudy.ResearchStudyStatusEnumFactory()));
20955    if (json.has("_status"))
20956      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
20957    if (json.has("primaryPurposeType"))
20958      res.setPrimaryPurposeType(parseCodeableConcept(json.getAsJsonObject("primaryPurposeType")));
20959    if (json.has("phase"))
20960      res.setPhase(parseCodeableConcept(json.getAsJsonObject("phase")));
20961    if (json.has("category")) {
20962      JsonArray array = json.getAsJsonArray("category");
20963      for (int i = 0; i < array.size(); i++) {
20964        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20965      }
20966    };
20967    if (json.has("focus")) {
20968      JsonArray array = json.getAsJsonArray("focus");
20969      for (int i = 0; i < array.size(); i++) {
20970        res.getFocus().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20971      }
20972    };
20973    if (json.has("condition")) {
20974      JsonArray array = json.getAsJsonArray("condition");
20975      for (int i = 0; i < array.size(); i++) {
20976        res.getCondition().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20977      }
20978    };
20979    if (json.has("contact")) {
20980      JsonArray array = json.getAsJsonArray("contact");
20981      for (int i = 0; i < array.size(); i++) {
20982        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
20983      }
20984    };
20985    if (json.has("relatedArtifact")) {
20986      JsonArray array = json.getAsJsonArray("relatedArtifact");
20987      for (int i = 0; i < array.size(); i++) {
20988        res.getRelatedArtifact().add(parseRelatedArtifact(array.get(i).getAsJsonObject()));
20989      }
20990    };
20991    if (json.has("keyword")) {
20992      JsonArray array = json.getAsJsonArray("keyword");
20993      for (int i = 0; i < array.size(); i++) {
20994        res.getKeyword().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
20995      }
20996    };
20997    if (json.has("location")) {
20998      JsonArray array = json.getAsJsonArray("location");
20999      for (int i = 0; i < array.size(); i++) {
21000        res.getLocation().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21001      }
21002    };
21003    if (json.has("description"))
21004      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21005    if (json.has("_description"))
21006      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21007    if (json.has("enrollment")) {
21008      JsonArray array = json.getAsJsonArray("enrollment");
21009      for (int i = 0; i < array.size(); i++) {
21010        res.getEnrollment().add(parseReference(array.get(i).getAsJsonObject()));
21011      }
21012    };
21013    if (json.has("period"))
21014      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
21015    if (json.has("sponsor"))
21016      res.setSponsor(parseReference(json.getAsJsonObject("sponsor")));
21017    if (json.has("principalInvestigator"))
21018      res.setPrincipalInvestigator(parseReference(json.getAsJsonObject("principalInvestigator")));
21019    if (json.has("site")) {
21020      JsonArray array = json.getAsJsonArray("site");
21021      for (int i = 0; i < array.size(); i++) {
21022        res.getSite().add(parseReference(array.get(i).getAsJsonObject()));
21023      }
21024    };
21025    if (json.has("reasonStopped"))
21026      res.setReasonStopped(parseCodeableConcept(json.getAsJsonObject("reasonStopped")));
21027    if (json.has("note")) {
21028      JsonArray array = json.getAsJsonArray("note");
21029      for (int i = 0; i < array.size(); i++) {
21030        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21031      }
21032    };
21033    if (json.has("arm")) {
21034      JsonArray array = json.getAsJsonArray("arm");
21035      for (int i = 0; i < array.size(); i++) {
21036        res.getArm().add(parseResearchStudyResearchStudyArmComponent(array.get(i).getAsJsonObject(), res));
21037      }
21038    };
21039    if (json.has("objective")) {
21040      JsonArray array = json.getAsJsonArray("objective");
21041      for (int i = 0; i < array.size(); i++) {
21042        res.getObjective().add(parseResearchStudyResearchStudyObjectiveComponent(array.get(i).getAsJsonObject(), res));
21043      }
21044    };
21045  }
21046
21047  protected ResearchStudy.ResearchStudyArmComponent parseResearchStudyResearchStudyArmComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
21048    ResearchStudy.ResearchStudyArmComponent res = new ResearchStudy.ResearchStudyArmComponent();
21049    parseResearchStudyResearchStudyArmComponentProperties(json, owner, res);
21050    return res;
21051  }
21052
21053  protected void parseResearchStudyResearchStudyArmComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyArmComponent res) throws IOException, FHIRFormatError {
21054    parseBackboneElementProperties(json, res);
21055    if (json.has("name"))
21056      res.setNameElement(parseString(json.get("name").getAsString()));
21057    if (json.has("_name"))
21058      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21059    if (json.has("type"))
21060      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21061    if (json.has("description"))
21062      res.setDescriptionElement(parseString(json.get("description").getAsString()));
21063    if (json.has("_description"))
21064      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21065  }
21066
21067  protected ResearchStudy.ResearchStudyObjectiveComponent parseResearchStudyResearchStudyObjectiveComponent(JsonObject json, ResearchStudy owner) throws IOException, FHIRFormatError {
21068    ResearchStudy.ResearchStudyObjectiveComponent res = new ResearchStudy.ResearchStudyObjectiveComponent();
21069    parseResearchStudyResearchStudyObjectiveComponentProperties(json, owner, res);
21070    return res;
21071  }
21072
21073  protected void parseResearchStudyResearchStudyObjectiveComponentProperties(JsonObject json, ResearchStudy owner, ResearchStudy.ResearchStudyObjectiveComponent res) throws IOException, FHIRFormatError {
21074    parseBackboneElementProperties(json, res);
21075    if (json.has("name"))
21076      res.setNameElement(parseString(json.get("name").getAsString()));
21077    if (json.has("_name"))
21078      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21079    if (json.has("type"))
21080      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
21081  }
21082
21083  protected ResearchSubject parseResearchSubject(JsonObject json) throws IOException, FHIRFormatError {
21084    ResearchSubject res = new ResearchSubject();
21085    parseResearchSubjectProperties(json, res);
21086    return res;
21087  }
21088
21089  protected void parseResearchSubjectProperties(JsonObject json, ResearchSubject res) throws IOException, FHIRFormatError {
21090    parseDomainResourceProperties(json, res);
21091    if (json.has("identifier")) {
21092      JsonArray array = json.getAsJsonArray("identifier");
21093      for (int i = 0; i < array.size(); i++) {
21094        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21095      }
21096    };
21097    if (json.has("status"))
21098      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ResearchSubject.ResearchSubjectStatus.NULL, new ResearchSubject.ResearchSubjectStatusEnumFactory()));
21099    if (json.has("_status"))
21100      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21101    if (json.has("period"))
21102      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
21103    if (json.has("study"))
21104      res.setStudy(parseReference(json.getAsJsonObject("study")));
21105    if (json.has("individual"))
21106      res.setIndividual(parseReference(json.getAsJsonObject("individual")));
21107    if (json.has("assignedArm"))
21108      res.setAssignedArmElement(parseString(json.get("assignedArm").getAsString()));
21109    if (json.has("_assignedArm"))
21110      parseElementProperties(json.getAsJsonObject("_assignedArm"), res.getAssignedArmElement());
21111    if (json.has("actualArm"))
21112      res.setActualArmElement(parseString(json.get("actualArm").getAsString()));
21113    if (json.has("_actualArm"))
21114      parseElementProperties(json.getAsJsonObject("_actualArm"), res.getActualArmElement());
21115    if (json.has("consent"))
21116      res.setConsent(parseReference(json.getAsJsonObject("consent")));
21117  }
21118
21119  protected RiskAssessment parseRiskAssessment(JsonObject json) throws IOException, FHIRFormatError {
21120    RiskAssessment res = new RiskAssessment();
21121    parseRiskAssessmentProperties(json, res);
21122    return res;
21123  }
21124
21125  protected void parseRiskAssessmentProperties(JsonObject json, RiskAssessment res) throws IOException, FHIRFormatError {
21126    parseDomainResourceProperties(json, res);
21127    if (json.has("identifier")) {
21128      JsonArray array = json.getAsJsonArray("identifier");
21129      for (int i = 0; i < array.size(); i++) {
21130        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21131      }
21132    };
21133    if (json.has("basedOn"))
21134      res.setBasedOn(parseReference(json.getAsJsonObject("basedOn")));
21135    if (json.has("parent"))
21136      res.setParent(parseReference(json.getAsJsonObject("parent")));
21137    if (json.has("status"))
21138      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), RiskAssessment.RiskAssessmentStatus.NULL, new RiskAssessment.RiskAssessmentStatusEnumFactory()));
21139    if (json.has("_status"))
21140      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21141    if (json.has("method"))
21142      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
21143    if (json.has("code"))
21144      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
21145    if (json.has("subject"))
21146      res.setSubject(parseReference(json.getAsJsonObject("subject")));
21147    if (json.has("context"))
21148      res.setContext(parseReference(json.getAsJsonObject("context")));
21149    Type occurrence = parseType("occurrence", json);
21150    if (occurrence != null)
21151      res.setOccurrence(occurrence);
21152    if (json.has("condition"))
21153      res.setCondition(parseReference(json.getAsJsonObject("condition")));
21154    if (json.has("performer"))
21155      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
21156    if (json.has("reasonCode")) {
21157      JsonArray array = json.getAsJsonArray("reasonCode");
21158      for (int i = 0; i < array.size(); i++) {
21159        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21160      }
21161    };
21162    if (json.has("reasonReference")) {
21163      JsonArray array = json.getAsJsonArray("reasonReference");
21164      for (int i = 0; i < array.size(); i++) {
21165        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
21166      }
21167    };
21168    if (json.has("basis")) {
21169      JsonArray array = json.getAsJsonArray("basis");
21170      for (int i = 0; i < array.size(); i++) {
21171        res.getBasis().add(parseReference(array.get(i).getAsJsonObject()));
21172      }
21173    };
21174    if (json.has("prediction")) {
21175      JsonArray array = json.getAsJsonArray("prediction");
21176      for (int i = 0; i < array.size(); i++) {
21177        res.getPrediction().add(parseRiskAssessmentRiskAssessmentPredictionComponent(array.get(i).getAsJsonObject(), res));
21178      }
21179    };
21180    if (json.has("mitigation"))
21181      res.setMitigationElement(parseString(json.get("mitigation").getAsString()));
21182    if (json.has("_mitigation"))
21183      parseElementProperties(json.getAsJsonObject("_mitigation"), res.getMitigationElement());
21184    if (json.has("note")) {
21185      JsonArray array = json.getAsJsonArray("note");
21186      for (int i = 0; i < array.size(); i++) {
21187        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
21188      }
21189    };
21190  }
21191
21192  protected RiskAssessment.RiskAssessmentPredictionComponent parseRiskAssessmentRiskAssessmentPredictionComponent(JsonObject json, RiskAssessment owner) throws IOException, FHIRFormatError {
21193    RiskAssessment.RiskAssessmentPredictionComponent res = new RiskAssessment.RiskAssessmentPredictionComponent();
21194    parseRiskAssessmentRiskAssessmentPredictionComponentProperties(json, owner, res);
21195    return res;
21196  }
21197
21198  protected void parseRiskAssessmentRiskAssessmentPredictionComponentProperties(JsonObject json, RiskAssessment owner, RiskAssessment.RiskAssessmentPredictionComponent res) throws IOException, FHIRFormatError {
21199    parseBackboneElementProperties(json, res);
21200    if (json.has("outcome"))
21201      res.setOutcome(parseCodeableConcept(json.getAsJsonObject("outcome")));
21202    Type probability = parseType("probability", json);
21203    if (probability != null)
21204      res.setProbability(probability);
21205    if (json.has("qualitativeRisk"))
21206      res.setQualitativeRisk(parseCodeableConcept(json.getAsJsonObject("qualitativeRisk")));
21207    if (json.has("relativeRisk"))
21208      res.setRelativeRiskElement(parseDecimal(json.get("relativeRisk").getAsBigDecimal()));
21209    if (json.has("_relativeRisk"))
21210      parseElementProperties(json.getAsJsonObject("_relativeRisk"), res.getRelativeRiskElement());
21211    Type when = parseType("when", json);
21212    if (when != null)
21213      res.setWhen(when);
21214    if (json.has("rationale"))
21215      res.setRationaleElement(parseString(json.get("rationale").getAsString()));
21216    if (json.has("_rationale"))
21217      parseElementProperties(json.getAsJsonObject("_rationale"), res.getRationaleElement());
21218  }
21219
21220  protected Schedule parseSchedule(JsonObject json) throws IOException, FHIRFormatError {
21221    Schedule res = new Schedule();
21222    parseScheduleProperties(json, res);
21223    return res;
21224  }
21225
21226  protected void parseScheduleProperties(JsonObject json, Schedule res) throws IOException, FHIRFormatError {
21227    parseDomainResourceProperties(json, res);
21228    if (json.has("identifier")) {
21229      JsonArray array = json.getAsJsonArray("identifier");
21230      for (int i = 0; i < array.size(); i++) {
21231        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21232      }
21233    };
21234    if (json.has("active"))
21235      res.setActiveElement(parseBoolean(json.get("active").getAsBoolean()));
21236    if (json.has("_active"))
21237      parseElementProperties(json.getAsJsonObject("_active"), res.getActiveElement());
21238    if (json.has("serviceCategory")) {
21239      JsonArray array = json.getAsJsonArray("serviceCategory");
21240      for (int i = 0; i < array.size(); i++) {
21241        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21242      }
21243    };
21244    if (json.has("serviceType")) {
21245      JsonArray array = json.getAsJsonArray("serviceType");
21246      for (int i = 0; i < array.size(); i++) {
21247        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21248      }
21249    };
21250    if (json.has("specialty")) {
21251      JsonArray array = json.getAsJsonArray("specialty");
21252      for (int i = 0; i < array.size(); i++) {
21253        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21254      }
21255    };
21256    if (json.has("actor")) {
21257      JsonArray array = json.getAsJsonArray("actor");
21258      for (int i = 0; i < array.size(); i++) {
21259        res.getActor().add(parseReference(array.get(i).getAsJsonObject()));
21260      }
21261    };
21262    if (json.has("planningHorizon"))
21263      res.setPlanningHorizon(parsePeriod(json.getAsJsonObject("planningHorizon")));
21264    if (json.has("comment"))
21265      res.setCommentElement(parseString(json.get("comment").getAsString()));
21266    if (json.has("_comment"))
21267      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
21268  }
21269
21270  protected SearchParameter parseSearchParameter(JsonObject json) throws IOException, FHIRFormatError {
21271    SearchParameter res = new SearchParameter();
21272    parseSearchParameterProperties(json, res);
21273    return res;
21274  }
21275
21276  protected void parseSearchParameterProperties(JsonObject json, SearchParameter res) throws IOException, FHIRFormatError {
21277    parseDomainResourceProperties(json, res);
21278    if (json.has("url"))
21279      res.setUrlElement(parseUri(json.get("url").getAsString()));
21280    if (json.has("_url"))
21281      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
21282    if (json.has("version"))
21283      res.setVersionElement(parseString(json.get("version").getAsString()));
21284    if (json.has("_version"))
21285      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
21286    if (json.has("name"))
21287      res.setNameElement(parseString(json.get("name").getAsString()));
21288    if (json.has("_name"))
21289      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21290    if (json.has("derivedFrom"))
21291      res.setDerivedFromElement(parseCanonical(json.get("derivedFrom").getAsString()));
21292    if (json.has("_derivedFrom"))
21293      parseElementProperties(json.getAsJsonObject("_derivedFrom"), res.getDerivedFromElement());
21294    if (json.has("status"))
21295      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
21296    if (json.has("_status"))
21297      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21298    if (json.has("experimental"))
21299      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
21300    if (json.has("_experimental"))
21301      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
21302    if (json.has("date"))
21303      res.setDateElement(parseDateTime(json.get("date").getAsString()));
21304    if (json.has("_date"))
21305      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
21306    if (json.has("publisher"))
21307      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
21308    if (json.has("_publisher"))
21309      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
21310    if (json.has("contact")) {
21311      JsonArray array = json.getAsJsonArray("contact");
21312      for (int i = 0; i < array.size(); i++) {
21313        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
21314      }
21315    };
21316    if (json.has("description"))
21317      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
21318    if (json.has("_description"))
21319      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
21320    if (json.has("useContext")) {
21321      JsonArray array = json.getAsJsonArray("useContext");
21322      for (int i = 0; i < array.size(); i++) {
21323        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
21324      }
21325    };
21326    if (json.has("jurisdiction")) {
21327      JsonArray array = json.getAsJsonArray("jurisdiction");
21328      for (int i = 0; i < array.size(); i++) {
21329        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21330      }
21331    };
21332    if (json.has("purpose"))
21333      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
21334    if (json.has("_purpose"))
21335      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
21336    if (json.has("code"))
21337      res.setCodeElement(parseCode(json.get("code").getAsString()));
21338    if (json.has("_code"))
21339      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
21340    if (json.has("base")) {
21341      JsonArray array = json.getAsJsonArray("base");
21342      for (int i = 0; i < array.size(); i++) {
21343        res.getBase().add(parseCode(array.get(i).getAsString()));
21344      }
21345    };
21346    if (json.has("_base")) {
21347      JsonArray array = json.getAsJsonArray("_base");
21348      for (int i = 0; i < array.size(); i++) {
21349        if (i == res.getBase().size())
21350          res.getBase().add(parseCode(null));
21351        if (array.get(i) instanceof JsonObject) 
21352          parseElementProperties(array.get(i).getAsJsonObject(), res.getBase().get(i));
21353      }
21354    };
21355    if (json.has("type"))
21356      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Enumerations.SearchParamType.NULL, new Enumerations.SearchParamTypeEnumFactory()));
21357    if (json.has("_type"))
21358      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21359    if (json.has("expression"))
21360      res.setExpressionElement(parseString(json.get("expression").getAsString()));
21361    if (json.has("_expression"))
21362      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
21363    if (json.has("xpath"))
21364      res.setXpathElement(parseString(json.get("xpath").getAsString()));
21365    if (json.has("_xpath"))
21366      parseElementProperties(json.getAsJsonObject("_xpath"), res.getXpathElement());
21367    if (json.has("xpathUsage"))
21368      res.setXpathUsageElement(parseEnumeration(json.get("xpathUsage").getAsString(), SearchParameter.XPathUsageType.NULL, new SearchParameter.XPathUsageTypeEnumFactory()));
21369    if (json.has("_xpathUsage"))
21370      parseElementProperties(json.getAsJsonObject("_xpathUsage"), res.getXpathUsageElement());
21371    if (json.has("target")) {
21372      JsonArray array = json.getAsJsonArray("target");
21373      for (int i = 0; i < array.size(); i++) {
21374        res.getTarget().add(parseCode(array.get(i).getAsString()));
21375      }
21376    };
21377    if (json.has("_target")) {
21378      JsonArray array = json.getAsJsonArray("_target");
21379      for (int i = 0; i < array.size(); i++) {
21380        if (i == res.getTarget().size())
21381          res.getTarget().add(parseCode(null));
21382        if (array.get(i) instanceof JsonObject) 
21383          parseElementProperties(array.get(i).getAsJsonObject(), res.getTarget().get(i));
21384      }
21385    };
21386    if (json.has("multipleOr"))
21387      res.setMultipleOrElement(parseBoolean(json.get("multipleOr").getAsBoolean()));
21388    if (json.has("_multipleOr"))
21389      parseElementProperties(json.getAsJsonObject("_multipleOr"), res.getMultipleOrElement());
21390    if (json.has("multipleAnd"))
21391      res.setMultipleAndElement(parseBoolean(json.get("multipleAnd").getAsBoolean()));
21392    if (json.has("_multipleAnd"))
21393      parseElementProperties(json.getAsJsonObject("_multipleAnd"), res.getMultipleAndElement());
21394    if (json.has("comparator")) {
21395      JsonArray array = json.getAsJsonArray("comparator");
21396      for (int i = 0; i < array.size(); i++) {
21397        res.getComparator().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
21398      }
21399    };
21400    if (json.has("_comparator")) {
21401      JsonArray array = json.getAsJsonArray("_comparator");
21402      for (int i = 0; i < array.size(); i++) {
21403        if (i == res.getComparator().size())
21404          res.getComparator().add(parseEnumeration(null, SearchParameter.SearchComparator.NULL, new SearchParameter.SearchComparatorEnumFactory()));
21405        if (array.get(i) instanceof JsonObject) 
21406          parseElementProperties(array.get(i).getAsJsonObject(), res.getComparator().get(i));
21407      }
21408    };
21409    if (json.has("modifier")) {
21410      JsonArray array = json.getAsJsonArray("modifier");
21411      for (int i = 0; i < array.size(); i++) {
21412        res.getModifier().add(parseEnumeration(array.get(i).getAsString(), SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
21413      }
21414    };
21415    if (json.has("_modifier")) {
21416      JsonArray array = json.getAsJsonArray("_modifier");
21417      for (int i = 0; i < array.size(); i++) {
21418        if (i == res.getModifier().size())
21419          res.getModifier().add(parseEnumeration(null, SearchParameter.SearchModifierCode.NULL, new SearchParameter.SearchModifierCodeEnumFactory()));
21420        if (array.get(i) instanceof JsonObject) 
21421          parseElementProperties(array.get(i).getAsJsonObject(), res.getModifier().get(i));
21422      }
21423    };
21424    if (json.has("chain")) {
21425      JsonArray array = json.getAsJsonArray("chain");
21426      for (int i = 0; i < array.size(); i++) {
21427        res.getChain().add(parseString(array.get(i).getAsString()));
21428      }
21429    };
21430    if (json.has("_chain")) {
21431      JsonArray array = json.getAsJsonArray("_chain");
21432      for (int i = 0; i < array.size(); i++) {
21433        if (i == res.getChain().size())
21434          res.getChain().add(parseString(null));
21435        if (array.get(i) instanceof JsonObject) 
21436          parseElementProperties(array.get(i).getAsJsonObject(), res.getChain().get(i));
21437      }
21438    };
21439    if (json.has("component")) {
21440      JsonArray array = json.getAsJsonArray("component");
21441      for (int i = 0; i < array.size(); i++) {
21442        res.getComponent().add(parseSearchParameterSearchParameterComponentComponent(array.get(i).getAsJsonObject(), res));
21443      }
21444    };
21445  }
21446
21447  protected SearchParameter.SearchParameterComponentComponent parseSearchParameterSearchParameterComponentComponent(JsonObject json, SearchParameter owner) throws IOException, FHIRFormatError {
21448    SearchParameter.SearchParameterComponentComponent res = new SearchParameter.SearchParameterComponentComponent();
21449    parseSearchParameterSearchParameterComponentComponentProperties(json, owner, res);
21450    return res;
21451  }
21452
21453  protected void parseSearchParameterSearchParameterComponentComponentProperties(JsonObject json, SearchParameter owner, SearchParameter.SearchParameterComponentComponent res) throws IOException, FHIRFormatError {
21454    parseBackboneElementProperties(json, res);
21455    if (json.has("definition"))
21456      res.setDefinitionElement(parseCanonical(json.get("definition").getAsString()));
21457    if (json.has("_definition"))
21458      parseElementProperties(json.getAsJsonObject("_definition"), res.getDefinitionElement());
21459    if (json.has("expression"))
21460      res.setExpressionElement(parseString(json.get("expression").getAsString()));
21461    if (json.has("_expression"))
21462      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
21463  }
21464
21465  protected Sequence parseSequence(JsonObject json) throws IOException, FHIRFormatError {
21466    Sequence res = new Sequence();
21467    parseSequenceProperties(json, res);
21468    return res;
21469  }
21470
21471  protected void parseSequenceProperties(JsonObject json, Sequence res) throws IOException, FHIRFormatError {
21472    parseDomainResourceProperties(json, res);
21473    if (json.has("identifier")) {
21474      JsonArray array = json.getAsJsonArray("identifier");
21475      for (int i = 0; i < array.size(); i++) {
21476        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21477      }
21478    };
21479    if (json.has("type"))
21480      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.SequenceType.NULL, new Sequence.SequenceTypeEnumFactory()));
21481    if (json.has("_type"))
21482      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21483    if (json.has("coordinateSystem"))
21484      res.setCoordinateSystemElement(parseInteger(json.get("coordinateSystem").getAsLong()));
21485    if (json.has("_coordinateSystem"))
21486      parseElementProperties(json.getAsJsonObject("_coordinateSystem"), res.getCoordinateSystemElement());
21487    if (json.has("patient"))
21488      res.setPatient(parseReference(json.getAsJsonObject("patient")));
21489    if (json.has("specimen"))
21490      res.setSpecimen(parseReference(json.getAsJsonObject("specimen")));
21491    if (json.has("device"))
21492      res.setDevice(parseReference(json.getAsJsonObject("device")));
21493    if (json.has("performer"))
21494      res.setPerformer(parseReference(json.getAsJsonObject("performer")));
21495    if (json.has("quantity"))
21496      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
21497    if (json.has("referenceSeq"))
21498      res.setReferenceSeq(parseSequenceSequenceReferenceSeqComponent(json.getAsJsonObject("referenceSeq"), res));
21499    if (json.has("variant")) {
21500      JsonArray array = json.getAsJsonArray("variant");
21501      for (int i = 0; i < array.size(); i++) {
21502        res.getVariant().add(parseSequenceSequenceVariantComponent(array.get(i).getAsJsonObject(), res));
21503      }
21504    };
21505    if (json.has("observedSeq"))
21506      res.setObservedSeqElement(parseString(json.get("observedSeq").getAsString()));
21507    if (json.has("_observedSeq"))
21508      parseElementProperties(json.getAsJsonObject("_observedSeq"), res.getObservedSeqElement());
21509    if (json.has("quality")) {
21510      JsonArray array = json.getAsJsonArray("quality");
21511      for (int i = 0; i < array.size(); i++) {
21512        res.getQuality().add(parseSequenceSequenceQualityComponent(array.get(i).getAsJsonObject(), res));
21513      }
21514    };
21515    if (json.has("readCoverage"))
21516      res.setReadCoverageElement(parseInteger(json.get("readCoverage").getAsLong()));
21517    if (json.has("_readCoverage"))
21518      parseElementProperties(json.getAsJsonObject("_readCoverage"), res.getReadCoverageElement());
21519    if (json.has("repository")) {
21520      JsonArray array = json.getAsJsonArray("repository");
21521      for (int i = 0; i < array.size(); i++) {
21522        res.getRepository().add(parseSequenceSequenceRepositoryComponent(array.get(i).getAsJsonObject(), res));
21523      }
21524    };
21525    if (json.has("pointer")) {
21526      JsonArray array = json.getAsJsonArray("pointer");
21527      for (int i = 0; i < array.size(); i++) {
21528        res.getPointer().add(parseReference(array.get(i).getAsJsonObject()));
21529      }
21530    };
21531    if (json.has("structureVariant")) {
21532      JsonArray array = json.getAsJsonArray("structureVariant");
21533      for (int i = 0; i < array.size(); i++) {
21534        res.getStructureVariant().add(parseSequenceSequenceStructureVariantComponent(array.get(i).getAsJsonObject(), res));
21535      }
21536    };
21537  }
21538
21539  protected Sequence.SequenceReferenceSeqComponent parseSequenceSequenceReferenceSeqComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
21540    Sequence.SequenceReferenceSeqComponent res = new Sequence.SequenceReferenceSeqComponent();
21541    parseSequenceSequenceReferenceSeqComponentProperties(json, owner, res);
21542    return res;
21543  }
21544
21545  protected void parseSequenceSequenceReferenceSeqComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceReferenceSeqComponent res) throws IOException, FHIRFormatError {
21546    parseBackboneElementProperties(json, res);
21547    if (json.has("chromosome"))
21548      res.setChromosome(parseCodeableConcept(json.getAsJsonObject("chromosome")));
21549    if (json.has("genomeBuild"))
21550      res.setGenomeBuildElement(parseString(json.get("genomeBuild").getAsString()));
21551    if (json.has("_genomeBuild"))
21552      parseElementProperties(json.getAsJsonObject("_genomeBuild"), res.getGenomeBuildElement());
21553    if (json.has("orientation"))
21554      res.setOrientationElement(parseEnumeration(json.get("orientation").getAsString(), Sequence.OrientationType.NULL, new Sequence.OrientationTypeEnumFactory()));
21555    if (json.has("_orientation"))
21556      parseElementProperties(json.getAsJsonObject("_orientation"), res.getOrientationElement());
21557    if (json.has("referenceSeqId"))
21558      res.setReferenceSeqId(parseCodeableConcept(json.getAsJsonObject("referenceSeqId")));
21559    if (json.has("referenceSeqPointer"))
21560      res.setReferenceSeqPointer(parseReference(json.getAsJsonObject("referenceSeqPointer")));
21561    if (json.has("referenceSeqString"))
21562      res.setReferenceSeqStringElement(parseString(json.get("referenceSeqString").getAsString()));
21563    if (json.has("_referenceSeqString"))
21564      parseElementProperties(json.getAsJsonObject("_referenceSeqString"), res.getReferenceSeqStringElement());
21565    if (json.has("strand"))
21566      res.setStrandElement(parseEnumeration(json.get("strand").getAsString(), Sequence.StrandType.NULL, new Sequence.StrandTypeEnumFactory()));
21567    if (json.has("_strand"))
21568      parseElementProperties(json.getAsJsonObject("_strand"), res.getStrandElement());
21569    if (json.has("windowStart"))
21570      res.setWindowStartElement(parseInteger(json.get("windowStart").getAsLong()));
21571    if (json.has("_windowStart"))
21572      parseElementProperties(json.getAsJsonObject("_windowStart"), res.getWindowStartElement());
21573    if (json.has("windowEnd"))
21574      res.setWindowEndElement(parseInteger(json.get("windowEnd").getAsLong()));
21575    if (json.has("_windowEnd"))
21576      parseElementProperties(json.getAsJsonObject("_windowEnd"), res.getWindowEndElement());
21577  }
21578
21579  protected Sequence.SequenceVariantComponent parseSequenceSequenceVariantComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
21580    Sequence.SequenceVariantComponent res = new Sequence.SequenceVariantComponent();
21581    parseSequenceSequenceVariantComponentProperties(json, owner, res);
21582    return res;
21583  }
21584
21585  protected void parseSequenceSequenceVariantComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceVariantComponent res) throws IOException, FHIRFormatError {
21586    parseBackboneElementProperties(json, res);
21587    if (json.has("start"))
21588      res.setStartElement(parseInteger(json.get("start").getAsLong()));
21589    if (json.has("_start"))
21590      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
21591    if (json.has("end"))
21592      res.setEndElement(parseInteger(json.get("end").getAsLong()));
21593    if (json.has("_end"))
21594      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
21595    if (json.has("observedAllele"))
21596      res.setObservedAlleleElement(parseString(json.get("observedAllele").getAsString()));
21597    if (json.has("_observedAllele"))
21598      parseElementProperties(json.getAsJsonObject("_observedAllele"), res.getObservedAlleleElement());
21599    if (json.has("referenceAllele"))
21600      res.setReferenceAlleleElement(parseString(json.get("referenceAllele").getAsString()));
21601    if (json.has("_referenceAllele"))
21602      parseElementProperties(json.getAsJsonObject("_referenceAllele"), res.getReferenceAlleleElement());
21603    if (json.has("cigar"))
21604      res.setCigarElement(parseString(json.get("cigar").getAsString()));
21605    if (json.has("_cigar"))
21606      parseElementProperties(json.getAsJsonObject("_cigar"), res.getCigarElement());
21607    if (json.has("variantPointer"))
21608      res.setVariantPointer(parseReference(json.getAsJsonObject("variantPointer")));
21609  }
21610
21611  protected Sequence.SequenceQualityComponent parseSequenceSequenceQualityComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
21612    Sequence.SequenceQualityComponent res = new Sequence.SequenceQualityComponent();
21613    parseSequenceSequenceQualityComponentProperties(json, owner, res);
21614    return res;
21615  }
21616
21617  protected void parseSequenceSequenceQualityComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceQualityComponent res) throws IOException, FHIRFormatError {
21618    parseBackboneElementProperties(json, res);
21619    if (json.has("type"))
21620      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.QualityType.NULL, new Sequence.QualityTypeEnumFactory()));
21621    if (json.has("_type"))
21622      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21623    if (json.has("standardSequence"))
21624      res.setStandardSequence(parseCodeableConcept(json.getAsJsonObject("standardSequence")));
21625    if (json.has("start"))
21626      res.setStartElement(parseInteger(json.get("start").getAsLong()));
21627    if (json.has("_start"))
21628      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
21629    if (json.has("end"))
21630      res.setEndElement(parseInteger(json.get("end").getAsLong()));
21631    if (json.has("_end"))
21632      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
21633    if (json.has("score"))
21634      res.setScore(parseQuantity(json.getAsJsonObject("score")));
21635    if (json.has("method"))
21636      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
21637    if (json.has("truthTP"))
21638      res.setTruthTPElement(parseDecimal(json.get("truthTP").getAsBigDecimal()));
21639    if (json.has("_truthTP"))
21640      parseElementProperties(json.getAsJsonObject("_truthTP"), res.getTruthTPElement());
21641    if (json.has("queryTP"))
21642      res.setQueryTPElement(parseDecimal(json.get("queryTP").getAsBigDecimal()));
21643    if (json.has("_queryTP"))
21644      parseElementProperties(json.getAsJsonObject("_queryTP"), res.getQueryTPElement());
21645    if (json.has("truthFN"))
21646      res.setTruthFNElement(parseDecimal(json.get("truthFN").getAsBigDecimal()));
21647    if (json.has("_truthFN"))
21648      parseElementProperties(json.getAsJsonObject("_truthFN"), res.getTruthFNElement());
21649    if (json.has("queryFP"))
21650      res.setQueryFPElement(parseDecimal(json.get("queryFP").getAsBigDecimal()));
21651    if (json.has("_queryFP"))
21652      parseElementProperties(json.getAsJsonObject("_queryFP"), res.getQueryFPElement());
21653    if (json.has("gtFP"))
21654      res.setGtFPElement(parseDecimal(json.get("gtFP").getAsBigDecimal()));
21655    if (json.has("_gtFP"))
21656      parseElementProperties(json.getAsJsonObject("_gtFP"), res.getGtFPElement());
21657    if (json.has("precision"))
21658      res.setPrecisionElement(parseDecimal(json.get("precision").getAsBigDecimal()));
21659    if (json.has("_precision"))
21660      parseElementProperties(json.getAsJsonObject("_precision"), res.getPrecisionElement());
21661    if (json.has("recall"))
21662      res.setRecallElement(parseDecimal(json.get("recall").getAsBigDecimal()));
21663    if (json.has("_recall"))
21664      parseElementProperties(json.getAsJsonObject("_recall"), res.getRecallElement());
21665    if (json.has("fScore"))
21666      res.setFScoreElement(parseDecimal(json.get("fScore").getAsBigDecimal()));
21667    if (json.has("_fScore"))
21668      parseElementProperties(json.getAsJsonObject("_fScore"), res.getFScoreElement());
21669    if (json.has("roc"))
21670      res.setRoc(parseSequenceSequenceQualityRocComponent(json.getAsJsonObject("roc"), owner));
21671  }
21672
21673  protected Sequence.SequenceQualityRocComponent parseSequenceSequenceQualityRocComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
21674    Sequence.SequenceQualityRocComponent res = new Sequence.SequenceQualityRocComponent();
21675    parseSequenceSequenceQualityRocComponentProperties(json, owner, res);
21676    return res;
21677  }
21678
21679  protected void parseSequenceSequenceQualityRocComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceQualityRocComponent res) throws IOException, FHIRFormatError {
21680    parseBackboneElementProperties(json, res);
21681    if (json.has("score")) {
21682      JsonArray array = json.getAsJsonArray("score");
21683      for (int i = 0; i < array.size(); i++) {
21684        res.getScore().add(parseInteger(array.get(i).getAsLong()));
21685      }
21686    };
21687    if (json.has("_score")) {
21688      JsonArray array = json.getAsJsonArray("_score");
21689      for (int i = 0; i < array.size(); i++) {
21690        if (i == res.getScore().size())
21691          res.getScore().add(parseInteger(null));
21692        if (array.get(i) instanceof JsonObject) 
21693          parseElementProperties(array.get(i).getAsJsonObject(), res.getScore().get(i));
21694      }
21695    };
21696    if (json.has("numTP")) {
21697      JsonArray array = json.getAsJsonArray("numTP");
21698      for (int i = 0; i < array.size(); i++) {
21699        res.getNumTP().add(parseInteger(array.get(i).getAsLong()));
21700      }
21701    };
21702    if (json.has("_numTP")) {
21703      JsonArray array = json.getAsJsonArray("_numTP");
21704      for (int i = 0; i < array.size(); i++) {
21705        if (i == res.getNumTP().size())
21706          res.getNumTP().add(parseInteger(null));
21707        if (array.get(i) instanceof JsonObject) 
21708          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumTP().get(i));
21709      }
21710    };
21711    if (json.has("numFP")) {
21712      JsonArray array = json.getAsJsonArray("numFP");
21713      for (int i = 0; i < array.size(); i++) {
21714        res.getNumFP().add(parseInteger(array.get(i).getAsLong()));
21715      }
21716    };
21717    if (json.has("_numFP")) {
21718      JsonArray array = json.getAsJsonArray("_numFP");
21719      for (int i = 0; i < array.size(); i++) {
21720        if (i == res.getNumFP().size())
21721          res.getNumFP().add(parseInteger(null));
21722        if (array.get(i) instanceof JsonObject) 
21723          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFP().get(i));
21724      }
21725    };
21726    if (json.has("numFN")) {
21727      JsonArray array = json.getAsJsonArray("numFN");
21728      for (int i = 0; i < array.size(); i++) {
21729        res.getNumFN().add(parseInteger(array.get(i).getAsLong()));
21730      }
21731    };
21732    if (json.has("_numFN")) {
21733      JsonArray array = json.getAsJsonArray("_numFN");
21734      for (int i = 0; i < array.size(); i++) {
21735        if (i == res.getNumFN().size())
21736          res.getNumFN().add(parseInteger(null));
21737        if (array.get(i) instanceof JsonObject) 
21738          parseElementProperties(array.get(i).getAsJsonObject(), res.getNumFN().get(i));
21739      }
21740    };
21741    if (json.has("precision")) {
21742      JsonArray array = json.getAsJsonArray("precision");
21743      for (int i = 0; i < array.size(); i++) {
21744        res.getPrecision().add(parseDecimal(array.get(i).getAsBigDecimal()));
21745      }
21746    };
21747    if (json.has("_precision")) {
21748      JsonArray array = json.getAsJsonArray("_precision");
21749      for (int i = 0; i < array.size(); i++) {
21750        if (i == res.getPrecision().size())
21751          res.getPrecision().add(parseDecimal(null));
21752        if (array.get(i) instanceof JsonObject) 
21753          parseElementProperties(array.get(i).getAsJsonObject(), res.getPrecision().get(i));
21754      }
21755    };
21756    if (json.has("sensitivity")) {
21757      JsonArray array = json.getAsJsonArray("sensitivity");
21758      for (int i = 0; i < array.size(); i++) {
21759        res.getSensitivity().add(parseDecimal(array.get(i).getAsBigDecimal()));
21760      }
21761    };
21762    if (json.has("_sensitivity")) {
21763      JsonArray array = json.getAsJsonArray("_sensitivity");
21764      for (int i = 0; i < array.size(); i++) {
21765        if (i == res.getSensitivity().size())
21766          res.getSensitivity().add(parseDecimal(null));
21767        if (array.get(i) instanceof JsonObject) 
21768          parseElementProperties(array.get(i).getAsJsonObject(), res.getSensitivity().get(i));
21769      }
21770    };
21771    if (json.has("fMeasure")) {
21772      JsonArray array = json.getAsJsonArray("fMeasure");
21773      for (int i = 0; i < array.size(); i++) {
21774        res.getFMeasure().add(parseDecimal(array.get(i).getAsBigDecimal()));
21775      }
21776    };
21777    if (json.has("_fMeasure")) {
21778      JsonArray array = json.getAsJsonArray("_fMeasure");
21779      for (int i = 0; i < array.size(); i++) {
21780        if (i == res.getFMeasure().size())
21781          res.getFMeasure().add(parseDecimal(null));
21782        if (array.get(i) instanceof JsonObject) 
21783          parseElementProperties(array.get(i).getAsJsonObject(), res.getFMeasure().get(i));
21784      }
21785    };
21786  }
21787
21788  protected Sequence.SequenceRepositoryComponent parseSequenceSequenceRepositoryComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
21789    Sequence.SequenceRepositoryComponent res = new Sequence.SequenceRepositoryComponent();
21790    parseSequenceSequenceRepositoryComponentProperties(json, owner, res);
21791    return res;
21792  }
21793
21794  protected void parseSequenceSequenceRepositoryComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceRepositoryComponent res) throws IOException, FHIRFormatError {
21795    parseBackboneElementProperties(json, res);
21796    if (json.has("type"))
21797      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Sequence.RepositoryType.NULL, new Sequence.RepositoryTypeEnumFactory()));
21798    if (json.has("_type"))
21799      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
21800    if (json.has("url"))
21801      res.setUrlElement(parseUri(json.get("url").getAsString()));
21802    if (json.has("_url"))
21803      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
21804    if (json.has("name"))
21805      res.setNameElement(parseString(json.get("name").getAsString()));
21806    if (json.has("_name"))
21807      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
21808    if (json.has("datasetId"))
21809      res.setDatasetIdElement(parseString(json.get("datasetId").getAsString()));
21810    if (json.has("_datasetId"))
21811      parseElementProperties(json.getAsJsonObject("_datasetId"), res.getDatasetIdElement());
21812    if (json.has("variantsetId"))
21813      res.setVariantsetIdElement(parseString(json.get("variantsetId").getAsString()));
21814    if (json.has("_variantsetId"))
21815      parseElementProperties(json.getAsJsonObject("_variantsetId"), res.getVariantsetIdElement());
21816    if (json.has("readsetId"))
21817      res.setReadsetIdElement(parseString(json.get("readsetId").getAsString()));
21818    if (json.has("_readsetId"))
21819      parseElementProperties(json.getAsJsonObject("_readsetId"), res.getReadsetIdElement());
21820  }
21821
21822  protected Sequence.SequenceStructureVariantComponent parseSequenceSequenceStructureVariantComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
21823    Sequence.SequenceStructureVariantComponent res = new Sequence.SequenceStructureVariantComponent();
21824    parseSequenceSequenceStructureVariantComponentProperties(json, owner, res);
21825    return res;
21826  }
21827
21828  protected void parseSequenceSequenceStructureVariantComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceStructureVariantComponent res) throws IOException, FHIRFormatError {
21829    parseBackboneElementProperties(json, res);
21830    if (json.has("precision"))
21831      res.setPrecisionElement(parseString(json.get("precision").getAsString()));
21832    if (json.has("_precision"))
21833      parseElementProperties(json.getAsJsonObject("_precision"), res.getPrecisionElement());
21834    if (json.has("reportedaCGHRatio"))
21835      res.setReportedaCGHRatioElement(parseDecimal(json.get("reportedaCGHRatio").getAsBigDecimal()));
21836    if (json.has("_reportedaCGHRatio"))
21837      parseElementProperties(json.getAsJsonObject("_reportedaCGHRatio"), res.getReportedaCGHRatioElement());
21838    if (json.has("length"))
21839      res.setLengthElement(parseInteger(json.get("length").getAsLong()));
21840    if (json.has("_length"))
21841      parseElementProperties(json.getAsJsonObject("_length"), res.getLengthElement());
21842    if (json.has("outer"))
21843      res.setOuter(parseSequenceSequenceStructureVariantOuterComponent(json.getAsJsonObject("outer"), owner));
21844    if (json.has("inner"))
21845      res.setInner(parseSequenceSequenceStructureVariantInnerComponent(json.getAsJsonObject("inner"), owner));
21846  }
21847
21848  protected Sequence.SequenceStructureVariantOuterComponent parseSequenceSequenceStructureVariantOuterComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
21849    Sequence.SequenceStructureVariantOuterComponent res = new Sequence.SequenceStructureVariantOuterComponent();
21850    parseSequenceSequenceStructureVariantOuterComponentProperties(json, owner, res);
21851    return res;
21852  }
21853
21854  protected void parseSequenceSequenceStructureVariantOuterComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceStructureVariantOuterComponent res) throws IOException, FHIRFormatError {
21855    parseBackboneElementProperties(json, res);
21856    if (json.has("start"))
21857      res.setStartElement(parseInteger(json.get("start").getAsLong()));
21858    if (json.has("_start"))
21859      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
21860    if (json.has("end"))
21861      res.setEndElement(parseInteger(json.get("end").getAsLong()));
21862    if (json.has("_end"))
21863      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
21864  }
21865
21866  protected Sequence.SequenceStructureVariantInnerComponent parseSequenceSequenceStructureVariantInnerComponent(JsonObject json, Sequence owner) throws IOException, FHIRFormatError {
21867    Sequence.SequenceStructureVariantInnerComponent res = new Sequence.SequenceStructureVariantInnerComponent();
21868    parseSequenceSequenceStructureVariantInnerComponentProperties(json, owner, res);
21869    return res;
21870  }
21871
21872  protected void parseSequenceSequenceStructureVariantInnerComponentProperties(JsonObject json, Sequence owner, Sequence.SequenceStructureVariantInnerComponent res) throws IOException, FHIRFormatError {
21873    parseBackboneElementProperties(json, res);
21874    if (json.has("start"))
21875      res.setStartElement(parseInteger(json.get("start").getAsLong()));
21876    if (json.has("_start"))
21877      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
21878    if (json.has("end"))
21879      res.setEndElement(parseInteger(json.get("end").getAsLong()));
21880    if (json.has("_end"))
21881      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
21882  }
21883
21884  protected ServiceRequest parseServiceRequest(JsonObject json) throws IOException, FHIRFormatError {
21885    ServiceRequest res = new ServiceRequest();
21886    parseServiceRequestProperties(json, res);
21887    return res;
21888  }
21889
21890  protected void parseServiceRequestProperties(JsonObject json, ServiceRequest res) throws IOException, FHIRFormatError {
21891    parseDomainResourceProperties(json, res);
21892    if (json.has("identifier")) {
21893      JsonArray array = json.getAsJsonArray("identifier");
21894      for (int i = 0; i < array.size(); i++) {
21895        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
21896      }
21897    };
21898    if (json.has("instantiatesCanonical")) {
21899      JsonArray array = json.getAsJsonArray("instantiatesCanonical");
21900      for (int i = 0; i < array.size(); i++) {
21901        res.getInstantiatesCanonical().add(parseCanonical(array.get(i).getAsString()));
21902      }
21903    };
21904    if (json.has("_instantiatesCanonical")) {
21905      JsonArray array = json.getAsJsonArray("_instantiatesCanonical");
21906      for (int i = 0; i < array.size(); i++) {
21907        if (i == res.getInstantiatesCanonical().size())
21908          res.getInstantiatesCanonical().add(parseCanonical(null));
21909        if (array.get(i) instanceof JsonObject) 
21910          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesCanonical().get(i));
21911      }
21912    };
21913    if (json.has("instantiatesUri")) {
21914      JsonArray array = json.getAsJsonArray("instantiatesUri");
21915      for (int i = 0; i < array.size(); i++) {
21916        res.getInstantiatesUri().add(parseUri(array.get(i).getAsString()));
21917      }
21918    };
21919    if (json.has("_instantiatesUri")) {
21920      JsonArray array = json.getAsJsonArray("_instantiatesUri");
21921      for (int i = 0; i < array.size(); i++) {
21922        if (i == res.getInstantiatesUri().size())
21923          res.getInstantiatesUri().add(parseUri(null));
21924        if (array.get(i) instanceof JsonObject) 
21925          parseElementProperties(array.get(i).getAsJsonObject(), res.getInstantiatesUri().get(i));
21926      }
21927    };
21928    if (json.has("basedOn")) {
21929      JsonArray array = json.getAsJsonArray("basedOn");
21930      for (int i = 0; i < array.size(); i++) {
21931        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
21932      }
21933    };
21934    if (json.has("replaces")) {
21935      JsonArray array = json.getAsJsonArray("replaces");
21936      for (int i = 0; i < array.size(); i++) {
21937        res.getReplaces().add(parseReference(array.get(i).getAsJsonObject()));
21938      }
21939    };
21940    if (json.has("requisition"))
21941      res.setRequisition(parseIdentifier(json.getAsJsonObject("requisition")));
21942    if (json.has("status"))
21943      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), ServiceRequest.ServiceRequestStatus.NULL, new ServiceRequest.ServiceRequestStatusEnumFactory()));
21944    if (json.has("_status"))
21945      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
21946    if (json.has("intent"))
21947      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), ServiceRequest.ServiceRequestIntent.NULL, new ServiceRequest.ServiceRequestIntentEnumFactory()));
21948    if (json.has("_intent"))
21949      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
21950    if (json.has("category")) {
21951      JsonArray array = json.getAsJsonArray("category");
21952      for (int i = 0; i < array.size(); i++) {
21953        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21954      }
21955    };
21956    if (json.has("priority"))
21957      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), ServiceRequest.ServiceRequestPriority.NULL, new ServiceRequest.ServiceRequestPriorityEnumFactory()));
21958    if (json.has("_priority"))
21959      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
21960    if (json.has("doNotPerform"))
21961      res.setDoNotPerformElement(parseBoolean(json.get("doNotPerform").getAsBoolean()));
21962    if (json.has("_doNotPerform"))
21963      parseElementProperties(json.getAsJsonObject("_doNotPerform"), res.getDoNotPerformElement());
21964    if (json.has("code"))
21965      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
21966    if (json.has("orderDetail")) {
21967      JsonArray array = json.getAsJsonArray("orderDetail");
21968      for (int i = 0; i < array.size(); i++) {
21969        res.getOrderDetail().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
21970      }
21971    };
21972    Type quantity = parseType("quantity", json);
21973    if (quantity != null)
21974      res.setQuantity(quantity);
21975    if (json.has("subject"))
21976      res.setSubject(parseReference(json.getAsJsonObject("subject")));
21977    if (json.has("context"))
21978      res.setContext(parseReference(json.getAsJsonObject("context")));
21979    Type occurrence = parseType("occurrence", json);
21980    if (occurrence != null)
21981      res.setOccurrence(occurrence);
21982    Type asNeeded = parseType("asNeeded", json);
21983    if (asNeeded != null)
21984      res.setAsNeeded(asNeeded);
21985    if (json.has("authoredOn"))
21986      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
21987    if (json.has("_authoredOn"))
21988      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
21989    if (json.has("requester"))
21990      res.setRequester(parseReference(json.getAsJsonObject("requester")));
21991    if (json.has("performerType"))
21992      res.setPerformerType(parseCodeableConcept(json.getAsJsonObject("performerType")));
21993    if (json.has("performer")) {
21994      JsonArray array = json.getAsJsonArray("performer");
21995      for (int i = 0; i < array.size(); i++) {
21996        res.getPerformer().add(parseReference(array.get(i).getAsJsonObject()));
21997      }
21998    };
21999    if (json.has("locationCode")) {
22000      JsonArray array = json.getAsJsonArray("locationCode");
22001      for (int i = 0; i < array.size(); i++) {
22002        res.getLocationCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22003      }
22004    };
22005    if (json.has("locationReference")) {
22006      JsonArray array = json.getAsJsonArray("locationReference");
22007      for (int i = 0; i < array.size(); i++) {
22008        res.getLocationReference().add(parseReference(array.get(i).getAsJsonObject()));
22009      }
22010    };
22011    if (json.has("reasonCode")) {
22012      JsonArray array = json.getAsJsonArray("reasonCode");
22013      for (int i = 0; i < array.size(); i++) {
22014        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22015      }
22016    };
22017    if (json.has("reasonReference")) {
22018      JsonArray array = json.getAsJsonArray("reasonReference");
22019      for (int i = 0; i < array.size(); i++) {
22020        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
22021      }
22022    };
22023    if (json.has("insurance")) {
22024      JsonArray array = json.getAsJsonArray("insurance");
22025      for (int i = 0; i < array.size(); i++) {
22026        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
22027      }
22028    };
22029    if (json.has("supportingInfo")) {
22030      JsonArray array = json.getAsJsonArray("supportingInfo");
22031      for (int i = 0; i < array.size(); i++) {
22032        res.getSupportingInfo().add(parseReference(array.get(i).getAsJsonObject()));
22033      }
22034    };
22035    if (json.has("specimen")) {
22036      JsonArray array = json.getAsJsonArray("specimen");
22037      for (int i = 0; i < array.size(); i++) {
22038        res.getSpecimen().add(parseReference(array.get(i).getAsJsonObject()));
22039      }
22040    };
22041    if (json.has("bodySite")) {
22042      JsonArray array = json.getAsJsonArray("bodySite");
22043      for (int i = 0; i < array.size(); i++) {
22044        res.getBodySite().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22045      }
22046    };
22047    if (json.has("note")) {
22048      JsonArray array = json.getAsJsonArray("note");
22049      for (int i = 0; i < array.size(); i++) {
22050        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22051      }
22052    };
22053    if (json.has("patientInstruction"))
22054      res.setPatientInstructionElement(parseString(json.get("patientInstruction").getAsString()));
22055    if (json.has("_patientInstruction"))
22056      parseElementProperties(json.getAsJsonObject("_patientInstruction"), res.getPatientInstructionElement());
22057    if (json.has("relevantHistory")) {
22058      JsonArray array = json.getAsJsonArray("relevantHistory");
22059      for (int i = 0; i < array.size(); i++) {
22060        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
22061      }
22062    };
22063  }
22064
22065  protected Slot parseSlot(JsonObject json) throws IOException, FHIRFormatError {
22066    Slot res = new Slot();
22067    parseSlotProperties(json, res);
22068    return res;
22069  }
22070
22071  protected void parseSlotProperties(JsonObject json, Slot res) throws IOException, FHIRFormatError {
22072    parseDomainResourceProperties(json, res);
22073    if (json.has("identifier")) {
22074      JsonArray array = json.getAsJsonArray("identifier");
22075      for (int i = 0; i < array.size(); i++) {
22076        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22077      }
22078    };
22079    if (json.has("serviceCategory")) {
22080      JsonArray array = json.getAsJsonArray("serviceCategory");
22081      for (int i = 0; i < array.size(); i++) {
22082        res.getServiceCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22083      }
22084    };
22085    if (json.has("serviceType")) {
22086      JsonArray array = json.getAsJsonArray("serviceType");
22087      for (int i = 0; i < array.size(); i++) {
22088        res.getServiceType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22089      }
22090    };
22091    if (json.has("specialty")) {
22092      JsonArray array = json.getAsJsonArray("specialty");
22093      for (int i = 0; i < array.size(); i++) {
22094        res.getSpecialty().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22095      }
22096    };
22097    if (json.has("appointmentType"))
22098      res.setAppointmentType(parseCodeableConcept(json.getAsJsonObject("appointmentType")));
22099    if (json.has("schedule"))
22100      res.setSchedule(parseReference(json.getAsJsonObject("schedule")));
22101    if (json.has("status"))
22102      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Slot.SlotStatus.NULL, new Slot.SlotStatusEnumFactory()));
22103    if (json.has("_status"))
22104      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22105    if (json.has("start"))
22106      res.setStartElement(parseInstant(json.get("start").getAsString()));
22107    if (json.has("_start"))
22108      parseElementProperties(json.getAsJsonObject("_start"), res.getStartElement());
22109    if (json.has("end"))
22110      res.setEndElement(parseInstant(json.get("end").getAsString()));
22111    if (json.has("_end"))
22112      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
22113    if (json.has("overbooked"))
22114      res.setOverbookedElement(parseBoolean(json.get("overbooked").getAsBoolean()));
22115    if (json.has("_overbooked"))
22116      parseElementProperties(json.getAsJsonObject("_overbooked"), res.getOverbookedElement());
22117    if (json.has("comment"))
22118      res.setCommentElement(parseString(json.get("comment").getAsString()));
22119    if (json.has("_comment"))
22120      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
22121  }
22122
22123  protected Specimen parseSpecimen(JsonObject json) throws IOException, FHIRFormatError {
22124    Specimen res = new Specimen();
22125    parseSpecimenProperties(json, res);
22126    return res;
22127  }
22128
22129  protected void parseSpecimenProperties(JsonObject json, Specimen res) throws IOException, FHIRFormatError {
22130    parseDomainResourceProperties(json, res);
22131    if (json.has("identifier")) {
22132      JsonArray array = json.getAsJsonArray("identifier");
22133      for (int i = 0; i < array.size(); i++) {
22134        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22135      }
22136    };
22137    if (json.has("accessionIdentifier"))
22138      res.setAccessionIdentifier(parseIdentifier(json.getAsJsonObject("accessionIdentifier")));
22139    if (json.has("status"))
22140      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Specimen.SpecimenStatus.NULL, new Specimen.SpecimenStatusEnumFactory()));
22141    if (json.has("_status"))
22142      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22143    if (json.has("type"))
22144      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22145    if (json.has("subject"))
22146      res.setSubject(parseReference(json.getAsJsonObject("subject")));
22147    if (json.has("receivedTime"))
22148      res.setReceivedTimeElement(parseDateTime(json.get("receivedTime").getAsString()));
22149    if (json.has("_receivedTime"))
22150      parseElementProperties(json.getAsJsonObject("_receivedTime"), res.getReceivedTimeElement());
22151    if (json.has("parent")) {
22152      JsonArray array = json.getAsJsonArray("parent");
22153      for (int i = 0; i < array.size(); i++) {
22154        res.getParent().add(parseReference(array.get(i).getAsJsonObject()));
22155      }
22156    };
22157    if (json.has("request")) {
22158      JsonArray array = json.getAsJsonArray("request");
22159      for (int i = 0; i < array.size(); i++) {
22160        res.getRequest().add(parseReference(array.get(i).getAsJsonObject()));
22161      }
22162    };
22163    if (json.has("collection"))
22164      res.setCollection(parseSpecimenSpecimenCollectionComponent(json.getAsJsonObject("collection"), res));
22165    if (json.has("processing")) {
22166      JsonArray array = json.getAsJsonArray("processing");
22167      for (int i = 0; i < array.size(); i++) {
22168        res.getProcessing().add(parseSpecimenSpecimenProcessingComponent(array.get(i).getAsJsonObject(), res));
22169      }
22170    };
22171    if (json.has("container")) {
22172      JsonArray array = json.getAsJsonArray("container");
22173      for (int i = 0; i < array.size(); i++) {
22174        res.getContainer().add(parseSpecimenSpecimenContainerComponent(array.get(i).getAsJsonObject(), res));
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("note")) {
22184      JsonArray array = json.getAsJsonArray("note");
22185      for (int i = 0; i < array.size(); i++) {
22186        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
22187      }
22188    };
22189  }
22190
22191  protected Specimen.SpecimenCollectionComponent parseSpecimenSpecimenCollectionComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
22192    Specimen.SpecimenCollectionComponent res = new Specimen.SpecimenCollectionComponent();
22193    parseSpecimenSpecimenCollectionComponentProperties(json, owner, res);
22194    return res;
22195  }
22196
22197  protected void parseSpecimenSpecimenCollectionComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenCollectionComponent res) throws IOException, FHIRFormatError {
22198    parseBackboneElementProperties(json, res);
22199    if (json.has("collector"))
22200      res.setCollector(parseReference(json.getAsJsonObject("collector")));
22201    Type collected = parseType("collected", json);
22202    if (collected != null)
22203      res.setCollected(collected);
22204    if (json.has("duration"))
22205      res.setDuration(parseDuration(json.getAsJsonObject("duration")));
22206    if (json.has("quantity"))
22207      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
22208    if (json.has("method"))
22209      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
22210    if (json.has("bodySite"))
22211      res.setBodySite(parseCodeableConcept(json.getAsJsonObject("bodySite")));
22212    Type fastingStatus = parseType("fastingStatus", json);
22213    if (fastingStatus != null)
22214      res.setFastingStatus(fastingStatus);
22215  }
22216
22217  protected Specimen.SpecimenProcessingComponent parseSpecimenSpecimenProcessingComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
22218    Specimen.SpecimenProcessingComponent res = new Specimen.SpecimenProcessingComponent();
22219    parseSpecimenSpecimenProcessingComponentProperties(json, owner, res);
22220    return res;
22221  }
22222
22223  protected void parseSpecimenSpecimenProcessingComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenProcessingComponent res) throws IOException, FHIRFormatError {
22224    parseBackboneElementProperties(json, res);
22225    if (json.has("description"))
22226      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22227    if (json.has("_description"))
22228      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22229    if (json.has("procedure"))
22230      res.setProcedure(parseCodeableConcept(json.getAsJsonObject("procedure")));
22231    if (json.has("additive")) {
22232      JsonArray array = json.getAsJsonArray("additive");
22233      for (int i = 0; i < array.size(); i++) {
22234        res.getAdditive().add(parseReference(array.get(i).getAsJsonObject()));
22235      }
22236    };
22237    Type time = parseType("time", json);
22238    if (time != null)
22239      res.setTime(time);
22240  }
22241
22242  protected Specimen.SpecimenContainerComponent parseSpecimenSpecimenContainerComponent(JsonObject json, Specimen owner) throws IOException, FHIRFormatError {
22243    Specimen.SpecimenContainerComponent res = new Specimen.SpecimenContainerComponent();
22244    parseSpecimenSpecimenContainerComponentProperties(json, owner, res);
22245    return res;
22246  }
22247
22248  protected void parseSpecimenSpecimenContainerComponentProperties(JsonObject json, Specimen owner, Specimen.SpecimenContainerComponent res) throws IOException, FHIRFormatError {
22249    parseBackboneElementProperties(json, res);
22250    if (json.has("identifier")) {
22251      JsonArray array = json.getAsJsonArray("identifier");
22252      for (int i = 0; i < array.size(); i++) {
22253        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22254      }
22255    };
22256    if (json.has("description"))
22257      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22258    if (json.has("_description"))
22259      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22260    if (json.has("type"))
22261      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22262    if (json.has("capacity"))
22263      res.setCapacity(parseQuantity(json.getAsJsonObject("capacity")));
22264    if (json.has("specimenQuantity"))
22265      res.setSpecimenQuantity(parseQuantity(json.getAsJsonObject("specimenQuantity")));
22266    Type additive = parseType("additive", json);
22267    if (additive != null)
22268      res.setAdditive(additive);
22269  }
22270
22271  protected SpecimenDefinition parseSpecimenDefinition(JsonObject json) throws IOException, FHIRFormatError {
22272    SpecimenDefinition res = new SpecimenDefinition();
22273    parseSpecimenDefinitionProperties(json, res);
22274    return res;
22275  }
22276
22277  protected void parseSpecimenDefinitionProperties(JsonObject json, SpecimenDefinition res) throws IOException, FHIRFormatError {
22278    parseDomainResourceProperties(json, res);
22279    if (json.has("identifier"))
22280      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
22281    if (json.has("typeCollected"))
22282      res.setTypeCollected(parseCodeableConcept(json.getAsJsonObject("typeCollected")));
22283    if (json.has("patientPreparation"))
22284      res.setPatientPreparationElement(parseString(json.get("patientPreparation").getAsString()));
22285    if (json.has("_patientPreparation"))
22286      parseElementProperties(json.getAsJsonObject("_patientPreparation"), res.getPatientPreparationElement());
22287    if (json.has("timeAspect"))
22288      res.setTimeAspectElement(parseString(json.get("timeAspect").getAsString()));
22289    if (json.has("_timeAspect"))
22290      parseElementProperties(json.getAsJsonObject("_timeAspect"), res.getTimeAspectElement());
22291    if (json.has("collection")) {
22292      JsonArray array = json.getAsJsonArray("collection");
22293      for (int i = 0; i < array.size(); i++) {
22294        res.getCollection().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22295      }
22296    };
22297    if (json.has("typeTested")) {
22298      JsonArray array = json.getAsJsonArray("typeTested");
22299      for (int i = 0; i < array.size(); i++) {
22300        res.getTypeTested().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(array.get(i).getAsJsonObject(), res));
22301      }
22302    };
22303  }
22304
22305  protected SpecimenDefinition.SpecimenDefinitionTypeTestedComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
22306    SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedComponent();
22307    parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(json, owner, res);
22308    return res;
22309  }
22310
22311  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent res) throws IOException, FHIRFormatError {
22312    parseBackboneElementProperties(json, res);
22313    if (json.has("isDerived"))
22314      res.setIsDerivedElement(parseBoolean(json.get("isDerived").getAsBoolean()));
22315    if (json.has("_isDerived"))
22316      parseElementProperties(json.getAsJsonObject("_isDerived"), res.getIsDerivedElement());
22317    if (json.has("type"))
22318      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22319    if (json.has("preference"))
22320      res.setPreferenceElement(parseEnumeration(json.get("preference").getAsString(), SpecimenDefinition.SpecimenContainedPreference.NULL, new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory()));
22321    if (json.has("_preference"))
22322      parseElementProperties(json.getAsJsonObject("_preference"), res.getPreferenceElement());
22323    if (json.has("container"))
22324      res.setContainer(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(json.getAsJsonObject("container"), owner));
22325    if (json.has("requirement"))
22326      res.setRequirementElement(parseString(json.get("requirement").getAsString()));
22327    if (json.has("_requirement"))
22328      parseElementProperties(json.getAsJsonObject("_requirement"), res.getRequirementElement());
22329    if (json.has("retentionTime"))
22330      res.setRetentionTime(parseDuration(json.getAsJsonObject("retentionTime")));
22331    if (json.has("rejectionCriterion")) {
22332      JsonArray array = json.getAsJsonArray("rejectionCriterion");
22333      for (int i = 0; i < array.size(); i++) {
22334        res.getRejectionCriterion().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22335      }
22336    };
22337    if (json.has("handling")) {
22338      JsonArray array = json.getAsJsonArray("handling");
22339      for (int i = 0; i < array.size(); i++) {
22340        res.getHandling().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(array.get(i).getAsJsonObject(), owner));
22341      }
22342    };
22343  }
22344
22345  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
22346    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent();
22347    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(json, owner, res);
22348    return res;
22349  }
22350
22351  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent res) throws IOException, FHIRFormatError {
22352    parseBackboneElementProperties(json, res);
22353    if (json.has("material"))
22354      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
22355    if (json.has("type"))
22356      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
22357    if (json.has("cap"))
22358      res.setCap(parseCodeableConcept(json.getAsJsonObject("cap")));
22359    if (json.has("description"))
22360      res.setDescriptionElement(parseString(json.get("description").getAsString()));
22361    if (json.has("_description"))
22362      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22363    if (json.has("capacity"))
22364      res.setCapacity(parseQuantity(json.getAsJsonObject("capacity")));
22365    if (json.has("minimumVolume"))
22366      res.setMinimumVolume(parseQuantity(json.getAsJsonObject("minimumVolume")));
22367    if (json.has("additive")) {
22368      JsonArray array = json.getAsJsonArray("additive");
22369      for (int i = 0; i < array.size(); i++) {
22370        res.getAdditive().add(parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(array.get(i).getAsJsonObject(), owner));
22371      }
22372    };
22373    if (json.has("preparation"))
22374      res.setPreparationElement(parseString(json.get("preparation").getAsString()));
22375    if (json.has("_preparation"))
22376      parseElementProperties(json.getAsJsonObject("_preparation"), res.getPreparationElement());
22377  }
22378
22379  protected SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
22380    SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent();
22381    parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(json, owner, res);
22382    return res;
22383  }
22384
22385  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent res) throws IOException, FHIRFormatError {
22386    parseBackboneElementProperties(json, res);
22387    Type additive = parseType("additive", json);
22388    if (additive != null)
22389      res.setAdditive(additive);
22390  }
22391
22392  protected SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(JsonObject json, SpecimenDefinition owner) throws IOException, FHIRFormatError {
22393    SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res = new SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent();
22394    parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(json, owner, res);
22395    return res;
22396  }
22397
22398  protected void parseSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentProperties(JsonObject json, SpecimenDefinition owner, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent res) throws IOException, FHIRFormatError {
22399    parseBackboneElementProperties(json, res);
22400    if (json.has("temperatureQualifier"))
22401      res.setTemperatureQualifier(parseCodeableConcept(json.getAsJsonObject("temperatureQualifier")));
22402    if (json.has("temperatureRange"))
22403      res.setTemperatureRange(parseRange(json.getAsJsonObject("temperatureRange")));
22404    if (json.has("maxDuration"))
22405      res.setMaxDuration(parseDuration(json.getAsJsonObject("maxDuration")));
22406    if (json.has("instruction"))
22407      res.setInstructionElement(parseString(json.get("instruction").getAsString()));
22408    if (json.has("_instruction"))
22409      parseElementProperties(json.getAsJsonObject("_instruction"), res.getInstructionElement());
22410  }
22411
22412  protected StructureDefinition parseStructureDefinition(JsonObject json) throws IOException, FHIRFormatError {
22413    StructureDefinition res = new StructureDefinition();
22414    parseStructureDefinitionProperties(json, res);
22415    return res;
22416  }
22417
22418  protected void parseStructureDefinitionProperties(JsonObject json, StructureDefinition res) throws IOException, FHIRFormatError {
22419    parseDomainResourceProperties(json, res);
22420    if (json.has("url"))
22421      res.setUrlElement(parseUri(json.get("url").getAsString()));
22422    if (json.has("_url"))
22423      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
22424    if (json.has("identifier")) {
22425      JsonArray array = json.getAsJsonArray("identifier");
22426      for (int i = 0; i < array.size(); i++) {
22427        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22428      }
22429    };
22430    if (json.has("version"))
22431      res.setVersionElement(parseString(json.get("version").getAsString()));
22432    if (json.has("_version"))
22433      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
22434    if (json.has("name"))
22435      res.setNameElement(parseString(json.get("name").getAsString()));
22436    if (json.has("_name"))
22437      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22438    if (json.has("title"))
22439      res.setTitleElement(parseString(json.get("title").getAsString()));
22440    if (json.has("_title"))
22441      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22442    if (json.has("status"))
22443      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22444    if (json.has("_status"))
22445      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22446    if (json.has("experimental"))
22447      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22448    if (json.has("_experimental"))
22449      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
22450    if (json.has("date"))
22451      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22452    if (json.has("_date"))
22453      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
22454    if (json.has("publisher"))
22455      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22456    if (json.has("_publisher"))
22457      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
22458    if (json.has("contact")) {
22459      JsonArray array = json.getAsJsonArray("contact");
22460      for (int i = 0; i < array.size(); i++) {
22461        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22462      }
22463    };
22464    if (json.has("description"))
22465      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22466    if (json.has("_description"))
22467      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22468    if (json.has("useContext")) {
22469      JsonArray array = json.getAsJsonArray("useContext");
22470      for (int i = 0; i < array.size(); i++) {
22471        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22472      }
22473    };
22474    if (json.has("jurisdiction")) {
22475      JsonArray array = json.getAsJsonArray("jurisdiction");
22476      for (int i = 0; i < array.size(); i++) {
22477        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22478      }
22479    };
22480    if (json.has("purpose"))
22481      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22482    if (json.has("_purpose"))
22483      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
22484    if (json.has("copyright"))
22485      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22486    if (json.has("_copyright"))
22487      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
22488    if (json.has("keyword")) {
22489      JsonArray array = json.getAsJsonArray("keyword");
22490      for (int i = 0; i < array.size(); i++) {
22491        res.getKeyword().add(parseCoding(array.get(i).getAsJsonObject()));
22492      }
22493    };
22494    if (json.has("fhirVersion"))
22495      res.setFhirVersionElement(parseId(json.get("fhirVersion").getAsString()));
22496    if (json.has("_fhirVersion"))
22497      parseElementProperties(json.getAsJsonObject("_fhirVersion"), res.getFhirVersionElement());
22498    if (json.has("mapping")) {
22499      JsonArray array = json.getAsJsonArray("mapping");
22500      for (int i = 0; i < array.size(); i++) {
22501        res.getMapping().add(parseStructureDefinitionStructureDefinitionMappingComponent(array.get(i).getAsJsonObject(), res));
22502      }
22503    };
22504    if (json.has("kind"))
22505      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), StructureDefinition.StructureDefinitionKind.NULL, new StructureDefinition.StructureDefinitionKindEnumFactory()));
22506    if (json.has("_kind"))
22507      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
22508    if (json.has("abstract"))
22509      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
22510    if (json.has("_abstract"))
22511      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
22512    if (json.has("context")) {
22513      JsonArray array = json.getAsJsonArray("context");
22514      for (int i = 0; i < array.size(); i++) {
22515        res.getContext().add(parseStructureDefinitionStructureDefinitionContextComponent(array.get(i).getAsJsonObject(), res));
22516      }
22517    };
22518    if (json.has("contextInvariant")) {
22519      JsonArray array = json.getAsJsonArray("contextInvariant");
22520      for (int i = 0; i < array.size(); i++) {
22521        res.getContextInvariant().add(parseString(array.get(i).getAsString()));
22522      }
22523    };
22524    if (json.has("_contextInvariant")) {
22525      JsonArray array = json.getAsJsonArray("_contextInvariant");
22526      for (int i = 0; i < array.size(); i++) {
22527        if (i == res.getContextInvariant().size())
22528          res.getContextInvariant().add(parseString(null));
22529        if (array.get(i) instanceof JsonObject) 
22530          parseElementProperties(array.get(i).getAsJsonObject(), res.getContextInvariant().get(i));
22531      }
22532    };
22533    if (json.has("type"))
22534      res.setTypeElement(parseUri(json.get("type").getAsString()));
22535    if (json.has("_type"))
22536      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22537    if (json.has("baseDefinition"))
22538      res.setBaseDefinitionElement(parseCanonical(json.get("baseDefinition").getAsString()));
22539    if (json.has("_baseDefinition"))
22540      parseElementProperties(json.getAsJsonObject("_baseDefinition"), res.getBaseDefinitionElement());
22541    if (json.has("derivation"))
22542      res.setDerivationElement(parseEnumeration(json.get("derivation").getAsString(), StructureDefinition.TypeDerivationRule.NULL, new StructureDefinition.TypeDerivationRuleEnumFactory()));
22543    if (json.has("_derivation"))
22544      parseElementProperties(json.getAsJsonObject("_derivation"), res.getDerivationElement());
22545    if (json.has("snapshot"))
22546      res.setSnapshot(parseStructureDefinitionStructureDefinitionSnapshotComponent(json.getAsJsonObject("snapshot"), res));
22547    if (json.has("differential"))
22548      res.setDifferential(parseStructureDefinitionStructureDefinitionDifferentialComponent(json.getAsJsonObject("differential"), res));
22549  }
22550
22551  protected StructureDefinition.StructureDefinitionMappingComponent parseStructureDefinitionStructureDefinitionMappingComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
22552    StructureDefinition.StructureDefinitionMappingComponent res = new StructureDefinition.StructureDefinitionMappingComponent();
22553    parseStructureDefinitionStructureDefinitionMappingComponentProperties(json, owner, res);
22554    return res;
22555  }
22556
22557  protected void parseStructureDefinitionStructureDefinitionMappingComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionMappingComponent res) throws IOException, FHIRFormatError {
22558    parseBackboneElementProperties(json, res);
22559    if (json.has("identity"))
22560      res.setIdentityElement(parseId(json.get("identity").getAsString()));
22561    if (json.has("_identity"))
22562      parseElementProperties(json.getAsJsonObject("_identity"), res.getIdentityElement());
22563    if (json.has("uri"))
22564      res.setUriElement(parseUri(json.get("uri").getAsString()));
22565    if (json.has("_uri"))
22566      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
22567    if (json.has("name"))
22568      res.setNameElement(parseString(json.get("name").getAsString()));
22569    if (json.has("_name"))
22570      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22571    if (json.has("comment"))
22572      res.setCommentElement(parseString(json.get("comment").getAsString()));
22573    if (json.has("_comment"))
22574      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
22575  }
22576
22577  protected StructureDefinition.StructureDefinitionContextComponent parseStructureDefinitionStructureDefinitionContextComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
22578    StructureDefinition.StructureDefinitionContextComponent res = new StructureDefinition.StructureDefinitionContextComponent();
22579    parseStructureDefinitionStructureDefinitionContextComponentProperties(json, owner, res);
22580    return res;
22581  }
22582
22583  protected void parseStructureDefinitionStructureDefinitionContextComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionContextComponent res) throws IOException, FHIRFormatError {
22584    parseBackboneElementProperties(json, res);
22585    if (json.has("type"))
22586      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), StructureDefinition.ExtensionContextType.NULL, new StructureDefinition.ExtensionContextTypeEnumFactory()));
22587    if (json.has("_type"))
22588      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22589    if (json.has("expression"))
22590      res.setExpressionElement(parseString(json.get("expression").getAsString()));
22591    if (json.has("_expression"))
22592      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
22593  }
22594
22595  protected StructureDefinition.StructureDefinitionSnapshotComponent parseStructureDefinitionStructureDefinitionSnapshotComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
22596    StructureDefinition.StructureDefinitionSnapshotComponent res = new StructureDefinition.StructureDefinitionSnapshotComponent();
22597    parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(json, owner, res);
22598    return res;
22599  }
22600
22601  protected void parseStructureDefinitionStructureDefinitionSnapshotComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionSnapshotComponent res) throws IOException, FHIRFormatError {
22602    parseBackboneElementProperties(json, res);
22603    if (json.has("element")) {
22604      JsonArray array = json.getAsJsonArray("element");
22605      for (int i = 0; i < array.size(); i++) {
22606        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
22607      }
22608    };
22609  }
22610
22611  protected StructureDefinition.StructureDefinitionDifferentialComponent parseStructureDefinitionStructureDefinitionDifferentialComponent(JsonObject json, StructureDefinition owner) throws IOException, FHIRFormatError {
22612    StructureDefinition.StructureDefinitionDifferentialComponent res = new StructureDefinition.StructureDefinitionDifferentialComponent();
22613    parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(json, owner, res);
22614    return res;
22615  }
22616
22617  protected void parseStructureDefinitionStructureDefinitionDifferentialComponentProperties(JsonObject json, StructureDefinition owner, StructureDefinition.StructureDefinitionDifferentialComponent res) throws IOException, FHIRFormatError {
22618    parseBackboneElementProperties(json, res);
22619    if (json.has("element")) {
22620      JsonArray array = json.getAsJsonArray("element");
22621      for (int i = 0; i < array.size(); i++) {
22622        res.getElement().add(parseElementDefinition(array.get(i).getAsJsonObject()));
22623      }
22624    };
22625  }
22626
22627  protected StructureMap parseStructureMap(JsonObject json) throws IOException, FHIRFormatError {
22628    StructureMap res = new StructureMap();
22629    parseStructureMapProperties(json, res);
22630    return res;
22631  }
22632
22633  protected void parseStructureMapProperties(JsonObject json, StructureMap res) throws IOException, FHIRFormatError {
22634    parseDomainResourceProperties(json, res);
22635    if (json.has("url"))
22636      res.setUrlElement(parseUri(json.get("url").getAsString()));
22637    if (json.has("_url"))
22638      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
22639    if (json.has("identifier")) {
22640      JsonArray array = json.getAsJsonArray("identifier");
22641      for (int i = 0; i < array.size(); i++) {
22642        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
22643      }
22644    };
22645    if (json.has("version"))
22646      res.setVersionElement(parseString(json.get("version").getAsString()));
22647    if (json.has("_version"))
22648      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
22649    if (json.has("name"))
22650      res.setNameElement(parseString(json.get("name").getAsString()));
22651    if (json.has("_name"))
22652      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22653    if (json.has("title"))
22654      res.setTitleElement(parseString(json.get("title").getAsString()));
22655    if (json.has("_title"))
22656      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
22657    if (json.has("status"))
22658      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
22659    if (json.has("_status"))
22660      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
22661    if (json.has("experimental"))
22662      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
22663    if (json.has("_experimental"))
22664      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
22665    if (json.has("date"))
22666      res.setDateElement(parseDateTime(json.get("date").getAsString()));
22667    if (json.has("_date"))
22668      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
22669    if (json.has("publisher"))
22670      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
22671    if (json.has("_publisher"))
22672      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
22673    if (json.has("contact")) {
22674      JsonArray array = json.getAsJsonArray("contact");
22675      for (int i = 0; i < array.size(); i++) {
22676        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
22677      }
22678    };
22679    if (json.has("description"))
22680      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
22681    if (json.has("_description"))
22682      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
22683    if (json.has("useContext")) {
22684      JsonArray array = json.getAsJsonArray("useContext");
22685      for (int i = 0; i < array.size(); i++) {
22686        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
22687      }
22688    };
22689    if (json.has("jurisdiction")) {
22690      JsonArray array = json.getAsJsonArray("jurisdiction");
22691      for (int i = 0; i < array.size(); i++) {
22692        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
22693      }
22694    };
22695    if (json.has("purpose"))
22696      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
22697    if (json.has("_purpose"))
22698      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
22699    if (json.has("copyright"))
22700      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
22701    if (json.has("_copyright"))
22702      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
22703    if (json.has("structure")) {
22704      JsonArray array = json.getAsJsonArray("structure");
22705      for (int i = 0; i < array.size(); i++) {
22706        res.getStructure().add(parseStructureMapStructureMapStructureComponent(array.get(i).getAsJsonObject(), res));
22707      }
22708    };
22709    if (json.has("import")) {
22710      JsonArray array = json.getAsJsonArray("import");
22711      for (int i = 0; i < array.size(); i++) {
22712        res.getImport().add(parseCanonical(array.get(i).getAsString()));
22713      }
22714    };
22715    if (json.has("_import")) {
22716      JsonArray array = json.getAsJsonArray("_import");
22717      for (int i = 0; i < array.size(); i++) {
22718        if (i == res.getImport().size())
22719          res.getImport().add(parseCanonical(null));
22720        if (array.get(i) instanceof JsonObject) 
22721          parseElementProperties(array.get(i).getAsJsonObject(), res.getImport().get(i));
22722      }
22723    };
22724    if (json.has("group")) {
22725      JsonArray array = json.getAsJsonArray("group");
22726      for (int i = 0; i < array.size(); i++) {
22727        res.getGroup().add(parseStructureMapStructureMapGroupComponent(array.get(i).getAsJsonObject(), res));
22728      }
22729    };
22730  }
22731
22732  protected StructureMap.StructureMapStructureComponent parseStructureMapStructureMapStructureComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
22733    StructureMap.StructureMapStructureComponent res = new StructureMap.StructureMapStructureComponent();
22734    parseStructureMapStructureMapStructureComponentProperties(json, owner, res);
22735    return res;
22736  }
22737
22738  protected void parseStructureMapStructureMapStructureComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapStructureComponent res) throws IOException, FHIRFormatError {
22739    parseBackboneElementProperties(json, res);
22740    if (json.has("url"))
22741      res.setUrlElement(parseCanonical(json.get("url").getAsString()));
22742    if (json.has("_url"))
22743      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
22744    if (json.has("mode"))
22745      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapModelMode.NULL, new StructureMap.StructureMapModelModeEnumFactory()));
22746    if (json.has("_mode"))
22747      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
22748    if (json.has("alias"))
22749      res.setAliasElement(parseString(json.get("alias").getAsString()));
22750    if (json.has("_alias"))
22751      parseElementProperties(json.getAsJsonObject("_alias"), res.getAliasElement());
22752    if (json.has("documentation"))
22753      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
22754    if (json.has("_documentation"))
22755      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
22756  }
22757
22758  protected StructureMap.StructureMapGroupComponent parseStructureMapStructureMapGroupComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
22759    StructureMap.StructureMapGroupComponent res = new StructureMap.StructureMapGroupComponent();
22760    parseStructureMapStructureMapGroupComponentProperties(json, owner, res);
22761    return res;
22762  }
22763
22764  protected void parseStructureMapStructureMapGroupComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupComponent res) throws IOException, FHIRFormatError {
22765    parseBackboneElementProperties(json, res);
22766    if (json.has("name"))
22767      res.setNameElement(parseId(json.get("name").getAsString()));
22768    if (json.has("_name"))
22769      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22770    if (json.has("extends"))
22771      res.setExtendsElement(parseId(json.get("extends").getAsString()));
22772    if (json.has("_extends"))
22773      parseElementProperties(json.getAsJsonObject("_extends"), res.getExtendsElement());
22774    if (json.has("typeMode"))
22775      res.setTypeModeElement(parseEnumeration(json.get("typeMode").getAsString(), StructureMap.StructureMapGroupTypeMode.NULL, new StructureMap.StructureMapGroupTypeModeEnumFactory()));
22776    if (json.has("_typeMode"))
22777      parseElementProperties(json.getAsJsonObject("_typeMode"), res.getTypeModeElement());
22778    if (json.has("documentation"))
22779      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
22780    if (json.has("_documentation"))
22781      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
22782    if (json.has("input")) {
22783      JsonArray array = json.getAsJsonArray("input");
22784      for (int i = 0; i < array.size(); i++) {
22785        res.getInput().add(parseStructureMapStructureMapGroupInputComponent(array.get(i).getAsJsonObject(), owner));
22786      }
22787    };
22788    if (json.has("rule")) {
22789      JsonArray array = json.getAsJsonArray("rule");
22790      for (int i = 0; i < array.size(); i++) {
22791        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
22792      }
22793    };
22794  }
22795
22796  protected StructureMap.StructureMapGroupInputComponent parseStructureMapStructureMapGroupInputComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
22797    StructureMap.StructureMapGroupInputComponent res = new StructureMap.StructureMapGroupInputComponent();
22798    parseStructureMapStructureMapGroupInputComponentProperties(json, owner, res);
22799    return res;
22800  }
22801
22802  protected void parseStructureMapStructureMapGroupInputComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupInputComponent res) throws IOException, FHIRFormatError {
22803    parseBackboneElementProperties(json, res);
22804    if (json.has("name"))
22805      res.setNameElement(parseId(json.get("name").getAsString()));
22806    if (json.has("_name"))
22807      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22808    if (json.has("type"))
22809      res.setTypeElement(parseString(json.get("type").getAsString()));
22810    if (json.has("_type"))
22811      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22812    if (json.has("mode"))
22813      res.setModeElement(parseEnumeration(json.get("mode").getAsString(), StructureMap.StructureMapInputMode.NULL, new StructureMap.StructureMapInputModeEnumFactory()));
22814    if (json.has("_mode"))
22815      parseElementProperties(json.getAsJsonObject("_mode"), res.getModeElement());
22816    if (json.has("documentation"))
22817      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
22818    if (json.has("_documentation"))
22819      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
22820  }
22821
22822  protected StructureMap.StructureMapGroupRuleComponent parseStructureMapStructureMapGroupRuleComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
22823    StructureMap.StructureMapGroupRuleComponent res = new StructureMap.StructureMapGroupRuleComponent();
22824    parseStructureMapStructureMapGroupRuleComponentProperties(json, owner, res);
22825    return res;
22826  }
22827
22828  protected void parseStructureMapStructureMapGroupRuleComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleComponent res) throws IOException, FHIRFormatError {
22829    parseBackboneElementProperties(json, res);
22830    if (json.has("name"))
22831      res.setNameElement(parseId(json.get("name").getAsString()));
22832    if (json.has("_name"))
22833      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22834    if (json.has("source")) {
22835      JsonArray array = json.getAsJsonArray("source");
22836      for (int i = 0; i < array.size(); i++) {
22837        res.getSource().add(parseStructureMapStructureMapGroupRuleSourceComponent(array.get(i).getAsJsonObject(), owner));
22838      }
22839    };
22840    if (json.has("target")) {
22841      JsonArray array = json.getAsJsonArray("target");
22842      for (int i = 0; i < array.size(); i++) {
22843        res.getTarget().add(parseStructureMapStructureMapGroupRuleTargetComponent(array.get(i).getAsJsonObject(), owner));
22844      }
22845    };
22846    if (json.has("rule")) {
22847      JsonArray array = json.getAsJsonArray("rule");
22848      for (int i = 0; i < array.size(); i++) {
22849        res.getRule().add(parseStructureMapStructureMapGroupRuleComponent(array.get(i).getAsJsonObject(), owner));
22850      }
22851    };
22852    if (json.has("dependent")) {
22853      JsonArray array = json.getAsJsonArray("dependent");
22854      for (int i = 0; i < array.size(); i++) {
22855        res.getDependent().add(parseStructureMapStructureMapGroupRuleDependentComponent(array.get(i).getAsJsonObject(), owner));
22856      }
22857    };
22858    if (json.has("documentation"))
22859      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
22860    if (json.has("_documentation"))
22861      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
22862  }
22863
22864  protected StructureMap.StructureMapGroupRuleSourceComponent parseStructureMapStructureMapGroupRuleSourceComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
22865    StructureMap.StructureMapGroupRuleSourceComponent res = new StructureMap.StructureMapGroupRuleSourceComponent();
22866    parseStructureMapStructureMapGroupRuleSourceComponentProperties(json, owner, res);
22867    return res;
22868  }
22869
22870  protected void parseStructureMapStructureMapGroupRuleSourceComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleSourceComponent res) throws IOException, FHIRFormatError {
22871    parseBackboneElementProperties(json, res);
22872    if (json.has("context"))
22873      res.setContextElement(parseId(json.get("context").getAsString()));
22874    if (json.has("_context"))
22875      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
22876    if (json.has("min"))
22877      res.setMinElement(parseInteger(json.get("min").getAsLong()));
22878    if (json.has("_min"))
22879      parseElementProperties(json.getAsJsonObject("_min"), res.getMinElement());
22880    if (json.has("max"))
22881      res.setMaxElement(parseString(json.get("max").getAsString()));
22882    if (json.has("_max"))
22883      parseElementProperties(json.getAsJsonObject("_max"), res.getMaxElement());
22884    if (json.has("type"))
22885      res.setTypeElement(parseString(json.get("type").getAsString()));
22886    if (json.has("_type"))
22887      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
22888    Type defaultValue = parseType("defaultValue", json);
22889    if (defaultValue != null)
22890      res.setDefaultValue(defaultValue);
22891    if (json.has("element"))
22892      res.setElementElement(parseString(json.get("element").getAsString()));
22893    if (json.has("_element"))
22894      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
22895    if (json.has("listMode"))
22896      res.setListModeElement(parseEnumeration(json.get("listMode").getAsString(), StructureMap.StructureMapSourceListMode.NULL, new StructureMap.StructureMapSourceListModeEnumFactory()));
22897    if (json.has("_listMode"))
22898      parseElementProperties(json.getAsJsonObject("_listMode"), res.getListModeElement());
22899    if (json.has("variable"))
22900      res.setVariableElement(parseId(json.get("variable").getAsString()));
22901    if (json.has("_variable"))
22902      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
22903    if (json.has("condition"))
22904      res.setConditionElement(parseString(json.get("condition").getAsString()));
22905    if (json.has("_condition"))
22906      parseElementProperties(json.getAsJsonObject("_condition"), res.getConditionElement());
22907    if (json.has("check"))
22908      res.setCheckElement(parseString(json.get("check").getAsString()));
22909    if (json.has("_check"))
22910      parseElementProperties(json.getAsJsonObject("_check"), res.getCheckElement());
22911    if (json.has("logMessage"))
22912      res.setLogMessageElement(parseString(json.get("logMessage").getAsString()));
22913    if (json.has("_logMessage"))
22914      parseElementProperties(json.getAsJsonObject("_logMessage"), res.getLogMessageElement());
22915  }
22916
22917  protected StructureMap.StructureMapGroupRuleTargetComponent parseStructureMapStructureMapGroupRuleTargetComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
22918    StructureMap.StructureMapGroupRuleTargetComponent res = new StructureMap.StructureMapGroupRuleTargetComponent();
22919    parseStructureMapStructureMapGroupRuleTargetComponentProperties(json, owner, res);
22920    return res;
22921  }
22922
22923  protected void parseStructureMapStructureMapGroupRuleTargetComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetComponent res) throws IOException, FHIRFormatError {
22924    parseBackboneElementProperties(json, res);
22925    if (json.has("context"))
22926      res.setContextElement(parseId(json.get("context").getAsString()));
22927    if (json.has("_context"))
22928      parseElementProperties(json.getAsJsonObject("_context"), res.getContextElement());
22929    if (json.has("contextType"))
22930      res.setContextTypeElement(parseEnumeration(json.get("contextType").getAsString(), StructureMap.StructureMapContextType.NULL, new StructureMap.StructureMapContextTypeEnumFactory()));
22931    if (json.has("_contextType"))
22932      parseElementProperties(json.getAsJsonObject("_contextType"), res.getContextTypeElement());
22933    if (json.has("element"))
22934      res.setElementElement(parseString(json.get("element").getAsString()));
22935    if (json.has("_element"))
22936      parseElementProperties(json.getAsJsonObject("_element"), res.getElementElement());
22937    if (json.has("variable"))
22938      res.setVariableElement(parseId(json.get("variable").getAsString()));
22939    if (json.has("_variable"))
22940      parseElementProperties(json.getAsJsonObject("_variable"), res.getVariableElement());
22941    if (json.has("listMode")) {
22942      JsonArray array = json.getAsJsonArray("listMode");
22943      for (int i = 0; i < array.size(); i++) {
22944        res.getListMode().add(parseEnumeration(array.get(i).getAsString(), StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
22945      }
22946    };
22947    if (json.has("_listMode")) {
22948      JsonArray array = json.getAsJsonArray("_listMode");
22949      for (int i = 0; i < array.size(); i++) {
22950        if (i == res.getListMode().size())
22951          res.getListMode().add(parseEnumeration(null, StructureMap.StructureMapTargetListMode.NULL, new StructureMap.StructureMapTargetListModeEnumFactory()));
22952        if (array.get(i) instanceof JsonObject) 
22953          parseElementProperties(array.get(i).getAsJsonObject(), res.getListMode().get(i));
22954      }
22955    };
22956    if (json.has("listRuleId"))
22957      res.setListRuleIdElement(parseId(json.get("listRuleId").getAsString()));
22958    if (json.has("_listRuleId"))
22959      parseElementProperties(json.getAsJsonObject("_listRuleId"), res.getListRuleIdElement());
22960    if (json.has("transform"))
22961      res.setTransformElement(parseEnumeration(json.get("transform").getAsString(), StructureMap.StructureMapTransform.NULL, new StructureMap.StructureMapTransformEnumFactory()));
22962    if (json.has("_transform"))
22963      parseElementProperties(json.getAsJsonObject("_transform"), res.getTransformElement());
22964    if (json.has("parameter")) {
22965      JsonArray array = json.getAsJsonArray("parameter");
22966      for (int i = 0; i < array.size(); i++) {
22967        res.getParameter().add(parseStructureMapStructureMapGroupRuleTargetParameterComponent(array.get(i).getAsJsonObject(), owner));
22968      }
22969    };
22970  }
22971
22972  protected StructureMap.StructureMapGroupRuleTargetParameterComponent parseStructureMapStructureMapGroupRuleTargetParameterComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
22973    StructureMap.StructureMapGroupRuleTargetParameterComponent res = new StructureMap.StructureMapGroupRuleTargetParameterComponent();
22974    parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(json, owner, res);
22975    return res;
22976  }
22977
22978  protected void parseStructureMapStructureMapGroupRuleTargetParameterComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleTargetParameterComponent res) throws IOException, FHIRFormatError {
22979    parseBackboneElementProperties(json, res);
22980    Type value = parseType("value", json);
22981    if (value != null)
22982      res.setValue(value);
22983  }
22984
22985  protected StructureMap.StructureMapGroupRuleDependentComponent parseStructureMapStructureMapGroupRuleDependentComponent(JsonObject json, StructureMap owner) throws IOException, FHIRFormatError {
22986    StructureMap.StructureMapGroupRuleDependentComponent res = new StructureMap.StructureMapGroupRuleDependentComponent();
22987    parseStructureMapStructureMapGroupRuleDependentComponentProperties(json, owner, res);
22988    return res;
22989  }
22990
22991  protected void parseStructureMapStructureMapGroupRuleDependentComponentProperties(JsonObject json, StructureMap owner, StructureMap.StructureMapGroupRuleDependentComponent res) throws IOException, FHIRFormatError {
22992    parseBackboneElementProperties(json, res);
22993    if (json.has("name"))
22994      res.setNameElement(parseId(json.get("name").getAsString()));
22995    if (json.has("_name"))
22996      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
22997    if (json.has("variable")) {
22998      JsonArray array = json.getAsJsonArray("variable");
22999      for (int i = 0; i < array.size(); i++) {
23000        res.getVariable().add(parseString(array.get(i).getAsString()));
23001      }
23002    };
23003    if (json.has("_variable")) {
23004      JsonArray array = json.getAsJsonArray("_variable");
23005      for (int i = 0; i < array.size(); i++) {
23006        if (i == res.getVariable().size())
23007          res.getVariable().add(parseString(null));
23008        if (array.get(i) instanceof JsonObject) 
23009          parseElementProperties(array.get(i).getAsJsonObject(), res.getVariable().get(i));
23010      }
23011    };
23012  }
23013
23014  protected Subscription parseSubscription(JsonObject json) throws IOException, FHIRFormatError {
23015    Subscription res = new Subscription();
23016    parseSubscriptionProperties(json, res);
23017    return res;
23018  }
23019
23020  protected void parseSubscriptionProperties(JsonObject json, Subscription res) throws IOException, FHIRFormatError {
23021    parseDomainResourceProperties(json, res);
23022    if (json.has("status"))
23023      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Subscription.SubscriptionStatus.NULL, new Subscription.SubscriptionStatusEnumFactory()));
23024    if (json.has("_status"))
23025      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23026    if (json.has("contact")) {
23027      JsonArray array = json.getAsJsonArray("contact");
23028      for (int i = 0; i < array.size(); i++) {
23029        res.getContact().add(parseContactPoint(array.get(i).getAsJsonObject()));
23030      }
23031    };
23032    if (json.has("end"))
23033      res.setEndElement(parseInstant(json.get("end").getAsString()));
23034    if (json.has("_end"))
23035      parseElementProperties(json.getAsJsonObject("_end"), res.getEndElement());
23036    if (json.has("reason"))
23037      res.setReasonElement(parseString(json.get("reason").getAsString()));
23038    if (json.has("_reason"))
23039      parseElementProperties(json.getAsJsonObject("_reason"), res.getReasonElement());
23040    if (json.has("criteria"))
23041      res.setCriteriaElement(parseString(json.get("criteria").getAsString()));
23042    if (json.has("_criteria"))
23043      parseElementProperties(json.getAsJsonObject("_criteria"), res.getCriteriaElement());
23044    if (json.has("error"))
23045      res.setErrorElement(parseString(json.get("error").getAsString()));
23046    if (json.has("_error"))
23047      parseElementProperties(json.getAsJsonObject("_error"), res.getErrorElement());
23048    if (json.has("channel"))
23049      res.setChannel(parseSubscriptionSubscriptionChannelComponent(json.getAsJsonObject("channel"), res));
23050    if (json.has("tag")) {
23051      JsonArray array = json.getAsJsonArray("tag");
23052      for (int i = 0; i < array.size(); i++) {
23053        res.getTag().add(parseCoding(array.get(i).getAsJsonObject()));
23054      }
23055    };
23056  }
23057
23058  protected Subscription.SubscriptionChannelComponent parseSubscriptionSubscriptionChannelComponent(JsonObject json, Subscription owner) throws IOException, FHIRFormatError {
23059    Subscription.SubscriptionChannelComponent res = new Subscription.SubscriptionChannelComponent();
23060    parseSubscriptionSubscriptionChannelComponentProperties(json, owner, res);
23061    return res;
23062  }
23063
23064  protected void parseSubscriptionSubscriptionChannelComponentProperties(JsonObject json, Subscription owner, Subscription.SubscriptionChannelComponent res) throws IOException, FHIRFormatError {
23065    parseBackboneElementProperties(json, res);
23066    if (json.has("type"))
23067      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), Subscription.SubscriptionChannelType.NULL, new Subscription.SubscriptionChannelTypeEnumFactory()));
23068    if (json.has("_type"))
23069      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
23070    if (json.has("endpoint"))
23071      res.setEndpointElement(parseUrl(json.get("endpoint").getAsString()));
23072    if (json.has("_endpoint"))
23073      parseElementProperties(json.getAsJsonObject("_endpoint"), res.getEndpointElement());
23074    if (json.has("payload"))
23075      res.setPayloadElement(parseString(json.get("payload").getAsString()));
23076    if (json.has("_payload"))
23077      parseElementProperties(json.getAsJsonObject("_payload"), res.getPayloadElement());
23078    if (json.has("header")) {
23079      JsonArray array = json.getAsJsonArray("header");
23080      for (int i = 0; i < array.size(); i++) {
23081        res.getHeader().add(parseString(array.get(i).getAsString()));
23082      }
23083    };
23084    if (json.has("_header")) {
23085      JsonArray array = json.getAsJsonArray("_header");
23086      for (int i = 0; i < array.size(); i++) {
23087        if (i == res.getHeader().size())
23088          res.getHeader().add(parseString(null));
23089        if (array.get(i) instanceof JsonObject) 
23090          parseElementProperties(array.get(i).getAsJsonObject(), res.getHeader().get(i));
23091      }
23092    };
23093  }
23094
23095  protected Substance parseSubstance(JsonObject json) throws IOException, FHIRFormatError {
23096    Substance res = new Substance();
23097    parseSubstanceProperties(json, res);
23098    return res;
23099  }
23100
23101  protected void parseSubstanceProperties(JsonObject json, Substance res) throws IOException, FHIRFormatError {
23102    parseDomainResourceProperties(json, res);
23103    if (json.has("identifier")) {
23104      JsonArray array = json.getAsJsonArray("identifier");
23105      for (int i = 0; i < array.size(); i++) {
23106        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23107      }
23108    };
23109    if (json.has("status"))
23110      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Substance.FHIRSubstanceStatus.NULL, new Substance.FHIRSubstanceStatusEnumFactory()));
23111    if (json.has("_status"))
23112      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23113    if (json.has("category")) {
23114      JsonArray array = json.getAsJsonArray("category");
23115      for (int i = 0; i < array.size(); i++) {
23116        res.getCategory().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23117      }
23118    };
23119    if (json.has("code"))
23120      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
23121    if (json.has("description"))
23122      res.setDescriptionElement(parseString(json.get("description").getAsString()));
23123    if (json.has("_description"))
23124      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
23125    if (json.has("instance")) {
23126      JsonArray array = json.getAsJsonArray("instance");
23127      for (int i = 0; i < array.size(); i++) {
23128        res.getInstance().add(parseSubstanceSubstanceInstanceComponent(array.get(i).getAsJsonObject(), res));
23129      }
23130    };
23131    if (json.has("ingredient")) {
23132      JsonArray array = json.getAsJsonArray("ingredient");
23133      for (int i = 0; i < array.size(); i++) {
23134        res.getIngredient().add(parseSubstanceSubstanceIngredientComponent(array.get(i).getAsJsonObject(), res));
23135      }
23136    };
23137  }
23138
23139  protected Substance.SubstanceInstanceComponent parseSubstanceSubstanceInstanceComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
23140    Substance.SubstanceInstanceComponent res = new Substance.SubstanceInstanceComponent();
23141    parseSubstanceSubstanceInstanceComponentProperties(json, owner, res);
23142    return res;
23143  }
23144
23145  protected void parseSubstanceSubstanceInstanceComponentProperties(JsonObject json, Substance owner, Substance.SubstanceInstanceComponent res) throws IOException, FHIRFormatError {
23146    parseBackboneElementProperties(json, res);
23147    if (json.has("identifier"))
23148      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
23149    if (json.has("expiry"))
23150      res.setExpiryElement(parseDateTime(json.get("expiry").getAsString()));
23151    if (json.has("_expiry"))
23152      parseElementProperties(json.getAsJsonObject("_expiry"), res.getExpiryElement());
23153    if (json.has("quantity"))
23154      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
23155  }
23156
23157  protected Substance.SubstanceIngredientComponent parseSubstanceSubstanceIngredientComponent(JsonObject json, Substance owner) throws IOException, FHIRFormatError {
23158    Substance.SubstanceIngredientComponent res = new Substance.SubstanceIngredientComponent();
23159    parseSubstanceSubstanceIngredientComponentProperties(json, owner, res);
23160    return res;
23161  }
23162
23163  protected void parseSubstanceSubstanceIngredientComponentProperties(JsonObject json, Substance owner, Substance.SubstanceIngredientComponent res) throws IOException, FHIRFormatError {
23164    parseBackboneElementProperties(json, res);
23165    if (json.has("quantity"))
23166      res.setQuantity(parseRatio(json.getAsJsonObject("quantity")));
23167    Type substance = parseType("substance", json);
23168    if (substance != null)
23169      res.setSubstance(substance);
23170  }
23171
23172  protected SubstancePolymer parseSubstancePolymer(JsonObject json) throws IOException, FHIRFormatError {
23173    SubstancePolymer res = new SubstancePolymer();
23174    parseSubstancePolymerProperties(json, res);
23175    return res;
23176  }
23177
23178  protected void parseSubstancePolymerProperties(JsonObject json, SubstancePolymer res) throws IOException, FHIRFormatError {
23179    parseDomainResourceProperties(json, res);
23180    if (json.has("class"))
23181      res.setClass_(parseCodeableConcept(json.getAsJsonObject("class")));
23182    if (json.has("geometry"))
23183      res.setGeometry(parseCodeableConcept(json.getAsJsonObject("geometry")));
23184    if (json.has("copolymerConnectivity")) {
23185      JsonArray array = json.getAsJsonArray("copolymerConnectivity");
23186      for (int i = 0; i < array.size(); i++) {
23187        res.getCopolymerConnectivity().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23188      }
23189    };
23190    if (json.has("modification")) {
23191      JsonArray array = json.getAsJsonArray("modification");
23192      for (int i = 0; i < array.size(); i++) {
23193        res.getModification().add(parseString(array.get(i).getAsString()));
23194      }
23195    };
23196    if (json.has("_modification")) {
23197      JsonArray array = json.getAsJsonArray("_modification");
23198      for (int i = 0; i < array.size(); i++) {
23199        if (i == res.getModification().size())
23200          res.getModification().add(parseString(null));
23201        if (array.get(i) instanceof JsonObject) 
23202          parseElementProperties(array.get(i).getAsJsonObject(), res.getModification().get(i));
23203      }
23204    };
23205    if (json.has("monomerSet")) {
23206      JsonArray array = json.getAsJsonArray("monomerSet");
23207      for (int i = 0; i < array.size(); i++) {
23208        res.getMonomerSet().add(parseSubstancePolymerSubstancePolymerMonomerSetComponent(array.get(i).getAsJsonObject(), res));
23209      }
23210    };
23211    if (json.has("repeat")) {
23212      JsonArray array = json.getAsJsonArray("repeat");
23213      for (int i = 0; i < array.size(); i++) {
23214        res.getRepeat().add(parseSubstancePolymerSubstancePolymerRepeatComponent(array.get(i).getAsJsonObject(), res));
23215      }
23216    };
23217  }
23218
23219  protected SubstancePolymer.SubstancePolymerMonomerSetComponent parseSubstancePolymerSubstancePolymerMonomerSetComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
23220    SubstancePolymer.SubstancePolymerMonomerSetComponent res = new SubstancePolymer.SubstancePolymerMonomerSetComponent();
23221    parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(json, owner, res);
23222    return res;
23223  }
23224
23225  protected void parseSubstancePolymerSubstancePolymerMonomerSetComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetComponent res) throws IOException, FHIRFormatError {
23226    parseBackboneElementProperties(json, res);
23227    if (json.has("ratioType"))
23228      res.setRatioType(parseCodeableConcept(json.getAsJsonObject("ratioType")));
23229    if (json.has("startingMaterial")) {
23230      JsonArray array = json.getAsJsonArray("startingMaterial");
23231      for (int i = 0; i < array.size(); i++) {
23232        res.getStartingMaterial().add(parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(array.get(i).getAsJsonObject(), owner));
23233      }
23234    };
23235  }
23236
23237  protected SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
23238    SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res = new SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent();
23239    parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(json, owner, res);
23240    return res;
23241  }
23242
23243  protected void parseSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent res) throws IOException, FHIRFormatError {
23244    parseBackboneElementProperties(json, res);
23245    if (json.has("material"))
23246      res.setMaterial(parseCodeableConcept(json.getAsJsonObject("material")));
23247    if (json.has("type"))
23248      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23249    if (json.has("isDefining"))
23250      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
23251    if (json.has("_isDefining"))
23252      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
23253    if (json.has("amount"))
23254      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
23255  }
23256
23257  protected SubstancePolymer.SubstancePolymerRepeatComponent parseSubstancePolymerSubstancePolymerRepeatComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
23258    SubstancePolymer.SubstancePolymerRepeatComponent res = new SubstancePolymer.SubstancePolymerRepeatComponent();
23259    parseSubstancePolymerSubstancePolymerRepeatComponentProperties(json, owner, res);
23260    return res;
23261  }
23262
23263  protected void parseSubstancePolymerSubstancePolymerRepeatComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatComponent res) throws IOException, FHIRFormatError {
23264    parseBackboneElementProperties(json, res);
23265    if (json.has("numberOfUnits"))
23266      res.setNumberOfUnitsElement(parseInteger(json.get("numberOfUnits").getAsLong()));
23267    if (json.has("_numberOfUnits"))
23268      parseElementProperties(json.getAsJsonObject("_numberOfUnits"), res.getNumberOfUnitsElement());
23269    if (json.has("averageMolecularFormula"))
23270      res.setAverageMolecularFormulaElement(parseString(json.get("averageMolecularFormula").getAsString()));
23271    if (json.has("_averageMolecularFormula"))
23272      parseElementProperties(json.getAsJsonObject("_averageMolecularFormula"), res.getAverageMolecularFormulaElement());
23273    if (json.has("repeatUnitAmountType"))
23274      res.setRepeatUnitAmountType(parseCodeableConcept(json.getAsJsonObject("repeatUnitAmountType")));
23275    if (json.has("repeatUnit")) {
23276      JsonArray array = json.getAsJsonArray("repeatUnit");
23277      for (int i = 0; i < array.size(); i++) {
23278        res.getRepeatUnit().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(array.get(i).getAsJsonObject(), owner));
23279      }
23280    };
23281  }
23282
23283  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
23284    SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent();
23285    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(json, owner, res);
23286    return res;
23287  }
23288
23289  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent res) throws IOException, FHIRFormatError {
23290    parseBackboneElementProperties(json, res);
23291    if (json.has("orientationOfPolymerisation"))
23292      res.setOrientationOfPolymerisation(parseCodeableConcept(json.getAsJsonObject("orientationOfPolymerisation")));
23293    if (json.has("repeatUnit"))
23294      res.setRepeatUnitElement(parseString(json.get("repeatUnit").getAsString()));
23295    if (json.has("_repeatUnit"))
23296      parseElementProperties(json.getAsJsonObject("_repeatUnit"), res.getRepeatUnitElement());
23297    if (json.has("amount"))
23298      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
23299    if (json.has("degreeOfPolymerisation")) {
23300      JsonArray array = json.getAsJsonArray("degreeOfPolymerisation");
23301      for (int i = 0; i < array.size(); i++) {
23302        res.getDegreeOfPolymerisation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(array.get(i).getAsJsonObject(), owner));
23303      }
23304    };
23305    if (json.has("structuralRepresentation")) {
23306      JsonArray array = json.getAsJsonArray("structuralRepresentation");
23307      for (int i = 0; i < array.size(); i++) {
23308        res.getStructuralRepresentation().add(parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(array.get(i).getAsJsonObject(), owner));
23309      }
23310    };
23311  }
23312
23313  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
23314    SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent();
23315    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(json, owner, res);
23316    return res;
23317  }
23318
23319  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent res) throws IOException, FHIRFormatError {
23320    parseBackboneElementProperties(json, res);
23321    if (json.has("degree"))
23322      res.setDegree(parseCodeableConcept(json.getAsJsonObject("degree")));
23323    if (json.has("amount"))
23324      res.setAmount(parseSubstanceAmount(json.getAsJsonObject("amount")));
23325  }
23326
23327  protected SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(JsonObject json, SubstancePolymer owner) throws IOException, FHIRFormatError {
23328    SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res = new SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent();
23329    parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(json, owner, res);
23330    return res;
23331  }
23332
23333  protected void parseSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentProperties(JsonObject json, SubstancePolymer owner, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
23334    parseBackboneElementProperties(json, res);
23335    if (json.has("type"))
23336      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23337    if (json.has("representation"))
23338      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
23339    if (json.has("_representation"))
23340      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
23341    if (json.has("attachment"))
23342      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
23343  }
23344
23345  protected SubstanceReferenceInformation parseSubstanceReferenceInformation(JsonObject json) throws IOException, FHIRFormatError {
23346    SubstanceReferenceInformation res = new SubstanceReferenceInformation();
23347    parseSubstanceReferenceInformationProperties(json, res);
23348    return res;
23349  }
23350
23351  protected void parseSubstanceReferenceInformationProperties(JsonObject json, SubstanceReferenceInformation res) throws IOException, FHIRFormatError {
23352    parseDomainResourceProperties(json, res);
23353    if (json.has("comment"))
23354      res.setCommentElement(parseString(json.get("comment").getAsString()));
23355    if (json.has("_comment"))
23356      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
23357    if (json.has("gene")) {
23358      JsonArray array = json.getAsJsonArray("gene");
23359      for (int i = 0; i < array.size(); i++) {
23360        res.getGene().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(array.get(i).getAsJsonObject(), res));
23361      }
23362    };
23363    if (json.has("geneElement")) {
23364      JsonArray array = json.getAsJsonArray("geneElement");
23365      for (int i = 0; i < array.size(); i++) {
23366        res.getGeneElement().add(parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(array.get(i).getAsJsonObject(), res));
23367      }
23368    };
23369    if (json.has("classification")) {
23370      JsonArray array = json.getAsJsonArray("classification");
23371      for (int i = 0; i < array.size(); i++) {
23372        res.getClassification().add(parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(array.get(i).getAsJsonObject(), res));
23373      }
23374    };
23375    if (json.has("relationship")) {
23376      JsonArray array = json.getAsJsonArray("relationship");
23377      for (int i = 0; i < array.size(); i++) {
23378        res.getRelationship().add(parseSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponent(array.get(i).getAsJsonObject(), res));
23379      }
23380    };
23381    if (json.has("target")) {
23382      JsonArray array = json.getAsJsonArray("target");
23383      for (int i = 0; i < array.size(); i++) {
23384        res.getTarget().add(parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(array.get(i).getAsJsonObject(), res));
23385      }
23386    };
23387  }
23388
23389  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
23390    SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent();
23391    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(json, owner, res);
23392    return res;
23393  }
23394
23395  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent res) throws IOException, FHIRFormatError {
23396    parseBackboneElementProperties(json, res);
23397    if (json.has("geneSequenceOrigin"))
23398      res.setGeneSequenceOrigin(parseCodeableConcept(json.getAsJsonObject("geneSequenceOrigin")));
23399    if (json.has("gene"))
23400      res.setGene(parseCodeableConcept(json.getAsJsonObject("gene")));
23401    if (json.has("source")) {
23402      JsonArray array = json.getAsJsonArray("source");
23403      for (int i = 0; i < array.size(); i++) {
23404        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
23405      }
23406    };
23407  }
23408
23409  protected SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
23410    SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent();
23411    parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(json, owner, res);
23412    return res;
23413  }
23414
23415  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent res) throws IOException, FHIRFormatError {
23416    parseBackboneElementProperties(json, res);
23417    if (json.has("type"))
23418      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23419    if (json.has("element"))
23420      res.setElement(parseIdentifier(json.getAsJsonObject("element")));
23421    if (json.has("source")) {
23422      JsonArray array = json.getAsJsonArray("source");
23423      for (int i = 0; i < array.size(); i++) {
23424        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
23425      }
23426    };
23427  }
23428
23429  protected SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
23430    SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent();
23431    parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(json, owner, res);
23432    return res;
23433  }
23434
23435  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent res) throws IOException, FHIRFormatError {
23436    parseBackboneElementProperties(json, res);
23437    if (json.has("domain"))
23438      res.setDomain(parseCodeableConcept(json.getAsJsonObject("domain")));
23439    if (json.has("classification"))
23440      res.setClassification(parseCodeableConcept(json.getAsJsonObject("classification")));
23441    if (json.has("subtype")) {
23442      JsonArray array = json.getAsJsonArray("subtype");
23443      for (int i = 0; i < array.size(); i++) {
23444        res.getSubtype().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23445      }
23446    };
23447    if (json.has("source")) {
23448      JsonArray array = json.getAsJsonArray("source");
23449      for (int i = 0; i < array.size(); i++) {
23450        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
23451      }
23452    };
23453  }
23454
23455  protected SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent parseSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
23456    SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent();
23457    parseSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponentProperties(json, owner, res);
23458    return res;
23459  }
23460
23461  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent res) throws IOException, FHIRFormatError {
23462    parseBackboneElementProperties(json, res);
23463    Type substance = parseType("substance", json);
23464    if (substance != null)
23465      res.setSubstance(substance);
23466    if (json.has("relationship"))
23467      res.setRelationship(parseCodeableConcept(json.getAsJsonObject("relationship")));
23468    if (json.has("interaction"))
23469      res.setInteraction(parseCodeableConcept(json.getAsJsonObject("interaction")));
23470    if (json.has("isDefining"))
23471      res.setIsDefiningElement(parseBoolean(json.get("isDefining").getAsBoolean()));
23472    if (json.has("_isDefining"))
23473      parseElementProperties(json.getAsJsonObject("_isDefining"), res.getIsDefiningElement());
23474    Type amount = parseType("amount", json);
23475    if (amount != null)
23476      res.setAmount(amount);
23477    if (json.has("amountType"))
23478      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
23479    if (json.has("amountText"))
23480      res.setAmountTextElement(parseString(json.get("amountText").getAsString()));
23481    if (json.has("_amountText"))
23482      parseElementProperties(json.getAsJsonObject("_amountText"), res.getAmountTextElement());
23483    if (json.has("source")) {
23484      JsonArray array = json.getAsJsonArray("source");
23485      for (int i = 0; i < array.size(); i++) {
23486        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
23487      }
23488    };
23489  }
23490
23491  protected SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(JsonObject json, SubstanceReferenceInformation owner) throws IOException, FHIRFormatError {
23492    SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res = new SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent();
23493    parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(json, owner, res);
23494    return res;
23495  }
23496
23497  protected void parseSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentProperties(JsonObject json, SubstanceReferenceInformation owner, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent res) throws IOException, FHIRFormatError {
23498    parseBackboneElementProperties(json, res);
23499    if (json.has("target"))
23500      res.setTarget(parseIdentifier(json.getAsJsonObject("target")));
23501    if (json.has("type"))
23502      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23503    if (json.has("interaction"))
23504      res.setInteraction(parseCodeableConcept(json.getAsJsonObject("interaction")));
23505    if (json.has("organism"))
23506      res.setOrganism(parseCodeableConcept(json.getAsJsonObject("organism")));
23507    if (json.has("organismType"))
23508      res.setOrganismType(parseCodeableConcept(json.getAsJsonObject("organismType")));
23509    if (json.has("source")) {
23510      JsonArray array = json.getAsJsonArray("source");
23511      for (int i = 0; i < array.size(); i++) {
23512        res.getSource().add(parseReference(array.get(i).getAsJsonObject()));
23513      }
23514    };
23515    Type amount = parseType("amount", json);
23516    if (amount != null)
23517      res.setAmount(amount);
23518    if (json.has("amountType"))
23519      res.setAmountType(parseCodeableConcept(json.getAsJsonObject("amountType")));
23520  }
23521
23522  protected SubstanceSpecification parseSubstanceSpecification(JsonObject json) throws IOException, FHIRFormatError {
23523    SubstanceSpecification res = new SubstanceSpecification();
23524    parseSubstanceSpecificationProperties(json, res);
23525    return res;
23526  }
23527
23528  protected void parseSubstanceSpecificationProperties(JsonObject json, SubstanceSpecification res) throws IOException, FHIRFormatError {
23529    parseDomainResourceProperties(json, res);
23530    if (json.has("comment"))
23531      res.setCommentElement(parseString(json.get("comment").getAsString()));
23532    if (json.has("_comment"))
23533      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
23534    if (json.has("stoichiometric"))
23535      res.setStoichiometricElement(parseBoolean(json.get("stoichiometric").getAsBoolean()));
23536    if (json.has("_stoichiometric"))
23537      parseElementProperties(json.getAsJsonObject("_stoichiometric"), res.getStoichiometricElement());
23538    if (json.has("identifier"))
23539      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
23540    if (json.has("type"))
23541      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23542    if (json.has("referenceSource")) {
23543      JsonArray array = json.getAsJsonArray("referenceSource");
23544      for (int i = 0; i < array.size(); i++) {
23545        res.getReferenceSource().add(parseString(array.get(i).getAsString()));
23546      }
23547    };
23548    if (json.has("_referenceSource")) {
23549      JsonArray array = json.getAsJsonArray("_referenceSource");
23550      for (int i = 0; i < array.size(); i++) {
23551        if (i == res.getReferenceSource().size())
23552          res.getReferenceSource().add(parseString(null));
23553        if (array.get(i) instanceof JsonObject) 
23554          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferenceSource().get(i));
23555      }
23556    };
23557    if (json.has("moiety")) {
23558      JsonArray array = json.getAsJsonArray("moiety");
23559      for (int i = 0; i < array.size(); i++) {
23560        res.getMoiety().add(parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(array.get(i).getAsJsonObject(), res));
23561      }
23562    };
23563    if (json.has("property")) {
23564      JsonArray array = json.getAsJsonArray("property");
23565      for (int i = 0; i < array.size(); i++) {
23566        res.getProperty().add(parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(array.get(i).getAsJsonObject(), res));
23567      }
23568    };
23569    if (json.has("referenceInformation"))
23570      res.setReferenceInformation(parseReference(json.getAsJsonObject("referenceInformation")));
23571    if (json.has("structure"))
23572      res.setStructure(parseSubstanceSpecificationSubstanceSpecificationStructureComponent(json.getAsJsonObject("structure"), res));
23573    if (json.has("substanceCode")) {
23574      JsonArray array = json.getAsJsonArray("substanceCode");
23575      for (int i = 0; i < array.size(); i++) {
23576        res.getSubstanceCode().add(parseSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponent(array.get(i).getAsJsonObject(), res));
23577      }
23578    };
23579    if (json.has("substanceName")) {
23580      JsonArray array = json.getAsJsonArray("substanceName");
23581      for (int i = 0; i < array.size(); i++) {
23582        res.getSubstanceName().add(parseSubstanceSpecificationSubstanceSpecificationSubstanceNameComponent(array.get(i).getAsJsonObject(), res));
23583      }
23584    };
23585    if (json.has("molecularWeight")) {
23586      JsonArray array = json.getAsJsonArray("molecularWeight");
23587      for (int i = 0; i < array.size(); i++) {
23588        res.getMolecularWeight().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(array.get(i).getAsJsonObject(), res));
23589      }
23590    };
23591    if (json.has("polymer"))
23592      res.setPolymer(parseReference(json.getAsJsonObject("polymer")));
23593  }
23594
23595  protected SubstanceSpecification.SubstanceSpecificationMoietyComponent parseSubstanceSpecificationSubstanceSpecificationMoietyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
23596    SubstanceSpecification.SubstanceSpecificationMoietyComponent res = new SubstanceSpecification.SubstanceSpecificationMoietyComponent();
23597    parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(json, owner, res);
23598    return res;
23599  }
23600
23601  protected void parseSubstanceSpecificationSubstanceSpecificationMoietyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationMoietyComponent res) throws IOException, FHIRFormatError {
23602    parseBackboneElementProperties(json, res);
23603    if (json.has("role"))
23604      res.setRole(parseCodeableConcept(json.getAsJsonObject("role")));
23605    if (json.has("identifier"))
23606      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
23607    if (json.has("name"))
23608      res.setNameElement(parseString(json.get("name").getAsString()));
23609    if (json.has("_name"))
23610      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23611    if (json.has("stereochemistry"))
23612      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
23613    if (json.has("opticalActivity"))
23614      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
23615    if (json.has("molecularFormula"))
23616      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
23617    if (json.has("_molecularFormula"))
23618      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
23619    if (json.has("amount"))
23620      res.setAmountElement(parseString(json.get("amount").getAsString()));
23621    if (json.has("_amount"))
23622      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
23623  }
23624
23625  protected SubstanceSpecification.SubstanceSpecificationPropertyComponent parseSubstanceSpecificationSubstanceSpecificationPropertyComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
23626    SubstanceSpecification.SubstanceSpecificationPropertyComponent res = new SubstanceSpecification.SubstanceSpecificationPropertyComponent();
23627    parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(json, owner, res);
23628    return res;
23629  }
23630
23631  protected void parseSubstanceSpecificationSubstanceSpecificationPropertyComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationPropertyComponent res) throws IOException, FHIRFormatError {
23632    parseBackboneElementProperties(json, res);
23633    if (json.has("type"))
23634      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23635    if (json.has("name"))
23636      res.setName(parseCodeableConcept(json.getAsJsonObject("name")));
23637    if (json.has("parameters"))
23638      res.setParametersElement(parseString(json.get("parameters").getAsString()));
23639    if (json.has("_parameters"))
23640      parseElementProperties(json.getAsJsonObject("_parameters"), res.getParametersElement());
23641    if (json.has("substanceId"))
23642      res.setSubstanceId(parseIdentifier(json.getAsJsonObject("substanceId")));
23643    if (json.has("substanceName"))
23644      res.setSubstanceNameElement(parseString(json.get("substanceName").getAsString()));
23645    if (json.has("_substanceName"))
23646      parseElementProperties(json.getAsJsonObject("_substanceName"), res.getSubstanceNameElement());
23647    if (json.has("amount"))
23648      res.setAmountElement(parseString(json.get("amount").getAsString()));
23649    if (json.has("_amount"))
23650      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
23651  }
23652
23653  protected SubstanceSpecification.SubstanceSpecificationStructureComponent parseSubstanceSpecificationSubstanceSpecificationStructureComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
23654    SubstanceSpecification.SubstanceSpecificationStructureComponent res = new SubstanceSpecification.SubstanceSpecificationStructureComponent();
23655    parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(json, owner, res);
23656    return res;
23657  }
23658
23659  protected void parseSubstanceSpecificationSubstanceSpecificationStructureComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureComponent res) throws IOException, FHIRFormatError {
23660    parseBackboneElementProperties(json, res);
23661    if (json.has("stereochemistry"))
23662      res.setStereochemistry(parseCodeableConcept(json.getAsJsonObject("stereochemistry")));
23663    if (json.has("opticalActivity"))
23664      res.setOpticalActivity(parseCodeableConcept(json.getAsJsonObject("opticalActivity")));
23665    if (json.has("molecularFormula"))
23666      res.setMolecularFormulaElement(parseString(json.get("molecularFormula").getAsString()));
23667    if (json.has("_molecularFormula"))
23668      parseElementProperties(json.getAsJsonObject("_molecularFormula"), res.getMolecularFormulaElement());
23669    if (json.has("molecularFormulaByMoiety"))
23670      res.setMolecularFormulaByMoietyElement(parseString(json.get("molecularFormulaByMoiety").getAsString()));
23671    if (json.has("_molecularFormulaByMoiety"))
23672      parseElementProperties(json.getAsJsonObject("_molecularFormulaByMoiety"), res.getMolecularFormulaByMoietyElement());
23673    if (json.has("isotope")) {
23674      JsonArray array = json.getAsJsonArray("isotope");
23675      for (int i = 0; i < array.size(); i++) {
23676        res.getIsotope().add(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(array.get(i).getAsJsonObject(), owner));
23677      }
23678    };
23679    if (json.has("molecularWeight"))
23680      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight"), owner));
23681    if (json.has("referenceSource")) {
23682      JsonArray array = json.getAsJsonArray("referenceSource");
23683      for (int i = 0; i < array.size(); i++) {
23684        res.getReferenceSource().add(parseReference(array.get(i).getAsJsonObject()));
23685      }
23686    };
23687    if (json.has("structuralRepresentation")) {
23688      JsonArray array = json.getAsJsonArray("structuralRepresentation");
23689      for (int i = 0; i < array.size(); i++) {
23690        res.getStructuralRepresentation().add(parseSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponent(array.get(i).getAsJsonObject(), owner));
23691      }
23692    };
23693  }
23694
23695  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
23696    SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent();
23697    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(json, owner, res);
23698    return res;
23699  }
23700
23701  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent res) throws IOException, FHIRFormatError {
23702    parseBackboneElementProperties(json, res);
23703    if (json.has("nuclideId"))
23704      res.setNuclideId(parseIdentifier(json.getAsJsonObject("nuclideId")));
23705    if (json.has("nuclideName"))
23706      res.setNuclideName(parseCodeableConcept(json.getAsJsonObject("nuclideName")));
23707    if (json.has("substitutionType"))
23708      res.setSubstitutionType(parseCodeableConcept(json.getAsJsonObject("substitutionType")));
23709    if (json.has("nuclideHalfLife"))
23710      res.setNuclideHalfLife(parseQuantity(json.getAsJsonObject("nuclideHalfLife")));
23711    if (json.has("amount"))
23712      res.setAmountElement(parseString(json.get("amount").getAsString()));
23713    if (json.has("_amount"))
23714      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
23715    if (json.has("molecularWeight"))
23716      res.setMolecularWeight(parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(json.getAsJsonObject("molecularWeight"), owner));
23717  }
23718
23719  protected SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
23720    SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res = new SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent();
23721    parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(json, owner, res);
23722    return res;
23723  }
23724
23725  protected void parseSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent res) throws IOException, FHIRFormatError {
23726    parseBackboneElementProperties(json, res);
23727    if (json.has("method"))
23728      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
23729    if (json.has("type"))
23730      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23731    if (json.has("amount"))
23732      res.setAmountElement(parseString(json.get("amount").getAsString()));
23733    if (json.has("_amount"))
23734      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
23735  }
23736
23737  protected SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent parseSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
23738    SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent res = new SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent();
23739    parseSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponentProperties(json, owner, res);
23740    return res;
23741  }
23742
23743  protected void parseSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent res) throws IOException, FHIRFormatError {
23744    parseBackboneElementProperties(json, res);
23745    if (json.has("type"))
23746      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23747    if (json.has("representation"))
23748      res.setRepresentationElement(parseString(json.get("representation").getAsString()));
23749    if (json.has("_representation"))
23750      parseElementProperties(json.getAsJsonObject("_representation"), res.getRepresentationElement());
23751    if (json.has("attachment"))
23752      res.setAttachment(parseAttachment(json.getAsJsonObject("attachment")));
23753  }
23754
23755  protected SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent parseSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
23756    SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent res = new SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent();
23757    parseSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponentProperties(json, owner, res);
23758    return res;
23759  }
23760
23761  protected void parseSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent res) throws IOException, FHIRFormatError {
23762    parseBackboneElementProperties(json, res);
23763    if (json.has("code"))
23764      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
23765    if (json.has("status"))
23766      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
23767    if (json.has("statusDate"))
23768      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
23769    if (json.has("_statusDate"))
23770      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
23771    if (json.has("comment"))
23772      res.setCommentElement(parseString(json.get("comment").getAsString()));
23773    if (json.has("_comment"))
23774      parseElementProperties(json.getAsJsonObject("_comment"), res.getCommentElement());
23775    if (json.has("referenceSource")) {
23776      JsonArray array = json.getAsJsonArray("referenceSource");
23777      for (int i = 0; i < array.size(); i++) {
23778        res.getReferenceSource().add(parseString(array.get(i).getAsString()));
23779      }
23780    };
23781    if (json.has("_referenceSource")) {
23782      JsonArray array = json.getAsJsonArray("_referenceSource");
23783      for (int i = 0; i < array.size(); i++) {
23784        if (i == res.getReferenceSource().size())
23785          res.getReferenceSource().add(parseString(null));
23786        if (array.get(i) instanceof JsonObject) 
23787          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferenceSource().get(i));
23788      }
23789    };
23790  }
23791
23792  protected SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent parseSubstanceSpecificationSubstanceSpecificationSubstanceNameComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
23793    SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent res = new SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent();
23794    parseSubstanceSpecificationSubstanceSpecificationSubstanceNameComponentProperties(json, owner, res);
23795    return res;
23796  }
23797
23798  protected void parseSubstanceSpecificationSubstanceSpecificationSubstanceNameComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent res) throws IOException, FHIRFormatError {
23799    parseBackboneElementProperties(json, res);
23800    if (json.has("name"))
23801      res.setNameElement(parseString(json.get("name").getAsString()));
23802    if (json.has("_name"))
23803      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
23804    if (json.has("type"))
23805      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23806    if (json.has("language")) {
23807      JsonArray array = json.getAsJsonArray("language");
23808      for (int i = 0; i < array.size(); i++) {
23809        res.getLanguage().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23810      }
23811    };
23812    if (json.has("domain")) {
23813      JsonArray array = json.getAsJsonArray("domain");
23814      for (int i = 0; i < array.size(); i++) {
23815        res.getDomain().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23816      }
23817    };
23818    if (json.has("jurisdiction")) {
23819      JsonArray array = json.getAsJsonArray("jurisdiction");
23820      for (int i = 0; i < array.size(); i++) {
23821        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23822      }
23823    };
23824    if (json.has("officialName")) {
23825      JsonArray array = json.getAsJsonArray("officialName");
23826      for (int i = 0; i < array.size(); i++) {
23827        res.getOfficialName().add(parseSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponent(array.get(i).getAsJsonObject(), owner));
23828      }
23829    };
23830    if (json.has("referenceSource")) {
23831      JsonArray array = json.getAsJsonArray("referenceSource");
23832      for (int i = 0; i < array.size(); i++) {
23833        res.getReferenceSource().add(parseString(array.get(i).getAsString()));
23834      }
23835    };
23836    if (json.has("_referenceSource")) {
23837      JsonArray array = json.getAsJsonArray("_referenceSource");
23838      for (int i = 0; i < array.size(); i++) {
23839        if (i == res.getReferenceSource().size())
23840          res.getReferenceSource().add(parseString(null));
23841        if (array.get(i) instanceof JsonObject) 
23842          parseElementProperties(array.get(i).getAsJsonObject(), res.getReferenceSource().get(i));
23843      }
23844    };
23845  }
23846
23847  protected SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent parseSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponent(JsonObject json, SubstanceSpecification owner) throws IOException, FHIRFormatError {
23848    SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent res = new SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent();
23849    parseSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponentProperties(json, owner, res);
23850    return res;
23851  }
23852
23853  protected void parseSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponentProperties(JsonObject json, SubstanceSpecification owner, SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent res) throws IOException, FHIRFormatError {
23854    parseBackboneElementProperties(json, res);
23855    if (json.has("authority"))
23856      res.setAuthority(parseCodeableConcept(json.getAsJsonObject("authority")));
23857    if (json.has("status"))
23858      res.setStatus(parseCodeableConcept(json.getAsJsonObject("status")));
23859    if (json.has("date"))
23860      res.setDateElement(parseDateTime(json.get("date").getAsString()));
23861    if (json.has("_date"))
23862      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
23863  }
23864
23865  protected SupplyDelivery parseSupplyDelivery(JsonObject json) throws IOException, FHIRFormatError {
23866    SupplyDelivery res = new SupplyDelivery();
23867    parseSupplyDeliveryProperties(json, res);
23868    return res;
23869  }
23870
23871  protected void parseSupplyDeliveryProperties(JsonObject json, SupplyDelivery res) throws IOException, FHIRFormatError {
23872    parseDomainResourceProperties(json, res);
23873    if (json.has("identifier")) {
23874      JsonArray array = json.getAsJsonArray("identifier");
23875      for (int i = 0; i < array.size(); i++) {
23876        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
23877      }
23878    };
23879    if (json.has("basedOn")) {
23880      JsonArray array = json.getAsJsonArray("basedOn");
23881      for (int i = 0; i < array.size(); i++) {
23882        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
23883      }
23884    };
23885    if (json.has("partOf")) {
23886      JsonArray array = json.getAsJsonArray("partOf");
23887      for (int i = 0; i < array.size(); i++) {
23888        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
23889      }
23890    };
23891    if (json.has("status"))
23892      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyDelivery.SupplyDeliveryStatus.NULL, new SupplyDelivery.SupplyDeliveryStatusEnumFactory()));
23893    if (json.has("_status"))
23894      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23895    if (json.has("patient"))
23896      res.setPatient(parseReference(json.getAsJsonObject("patient")));
23897    if (json.has("type"))
23898      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
23899    if (json.has("suppliedItem"))
23900      res.setSuppliedItem(parseSupplyDeliverySupplyDeliverySuppliedItemComponent(json.getAsJsonObject("suppliedItem"), res));
23901    Type occurrence = parseType("occurrence", json);
23902    if (occurrence != null)
23903      res.setOccurrence(occurrence);
23904    if (json.has("supplier"))
23905      res.setSupplier(parseReference(json.getAsJsonObject("supplier")));
23906    if (json.has("destination"))
23907      res.setDestination(parseReference(json.getAsJsonObject("destination")));
23908    if (json.has("receiver")) {
23909      JsonArray array = json.getAsJsonArray("receiver");
23910      for (int i = 0; i < array.size(); i++) {
23911        res.getReceiver().add(parseReference(array.get(i).getAsJsonObject()));
23912      }
23913    };
23914  }
23915
23916  protected SupplyDelivery.SupplyDeliverySuppliedItemComponent parseSupplyDeliverySupplyDeliverySuppliedItemComponent(JsonObject json, SupplyDelivery owner) throws IOException, FHIRFormatError {
23917    SupplyDelivery.SupplyDeliverySuppliedItemComponent res = new SupplyDelivery.SupplyDeliverySuppliedItemComponent();
23918    parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(json, owner, res);
23919    return res;
23920  }
23921
23922  protected void parseSupplyDeliverySupplyDeliverySuppliedItemComponentProperties(JsonObject json, SupplyDelivery owner, SupplyDelivery.SupplyDeliverySuppliedItemComponent res) throws IOException, FHIRFormatError {
23923    parseBackboneElementProperties(json, res);
23924    if (json.has("quantity"))
23925      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
23926    Type item = parseType("item", json);
23927    if (item != null)
23928      res.setItem(item);
23929  }
23930
23931  protected SupplyRequest parseSupplyRequest(JsonObject json) throws IOException, FHIRFormatError {
23932    SupplyRequest res = new SupplyRequest();
23933    parseSupplyRequestProperties(json, res);
23934    return res;
23935  }
23936
23937  protected void parseSupplyRequestProperties(JsonObject json, SupplyRequest res) throws IOException, FHIRFormatError {
23938    parseDomainResourceProperties(json, res);
23939    if (json.has("identifier"))
23940      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
23941    if (json.has("status"))
23942      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), SupplyRequest.SupplyRequestStatus.NULL, new SupplyRequest.SupplyRequestStatusEnumFactory()));
23943    if (json.has("_status"))
23944      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
23945    if (json.has("category"))
23946      res.setCategory(parseCodeableConcept(json.getAsJsonObject("category")));
23947    if (json.has("priority"))
23948      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), SupplyRequest.RequestPriority.NULL, new SupplyRequest.RequestPriorityEnumFactory()));
23949    if (json.has("_priority"))
23950      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
23951    Type item = parseType("item", json);
23952    if (item != null)
23953      res.setItem(item);
23954    if (json.has("quantity"))
23955      res.setQuantity(parseQuantity(json.getAsJsonObject("quantity")));
23956    if (json.has("parameter")) {
23957      JsonArray array = json.getAsJsonArray("parameter");
23958      for (int i = 0; i < array.size(); i++) {
23959        res.getParameter().add(parseSupplyRequestSupplyRequestParameterComponent(array.get(i).getAsJsonObject(), res));
23960      }
23961    };
23962    Type occurrence = parseType("occurrence", json);
23963    if (occurrence != null)
23964      res.setOccurrence(occurrence);
23965    if (json.has("authoredOn"))
23966      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
23967    if (json.has("_authoredOn"))
23968      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
23969    if (json.has("requester"))
23970      res.setRequester(parseReference(json.getAsJsonObject("requester")));
23971    if (json.has("supplier")) {
23972      JsonArray array = json.getAsJsonArray("supplier");
23973      for (int i = 0; i < array.size(); i++) {
23974        res.getSupplier().add(parseReference(array.get(i).getAsJsonObject()));
23975      }
23976    };
23977    if (json.has("reasonCode")) {
23978      JsonArray array = json.getAsJsonArray("reasonCode");
23979      for (int i = 0; i < array.size(); i++) {
23980        res.getReasonCode().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
23981      }
23982    };
23983    if (json.has("reasonReference")) {
23984      JsonArray array = json.getAsJsonArray("reasonReference");
23985      for (int i = 0; i < array.size(); i++) {
23986        res.getReasonReference().add(parseReference(array.get(i).getAsJsonObject()));
23987      }
23988    };
23989    if (json.has("deliverFrom"))
23990      res.setDeliverFrom(parseReference(json.getAsJsonObject("deliverFrom")));
23991    if (json.has("deliverTo"))
23992      res.setDeliverTo(parseReference(json.getAsJsonObject("deliverTo")));
23993  }
23994
23995  protected SupplyRequest.SupplyRequestParameterComponent parseSupplyRequestSupplyRequestParameterComponent(JsonObject json, SupplyRequest owner) throws IOException, FHIRFormatError {
23996    SupplyRequest.SupplyRequestParameterComponent res = new SupplyRequest.SupplyRequestParameterComponent();
23997    parseSupplyRequestSupplyRequestParameterComponentProperties(json, owner, res);
23998    return res;
23999  }
24000
24001  protected void parseSupplyRequestSupplyRequestParameterComponentProperties(JsonObject json, SupplyRequest owner, SupplyRequest.SupplyRequestParameterComponent res) throws IOException, FHIRFormatError {
24002    parseBackboneElementProperties(json, res);
24003    if (json.has("code"))
24004      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
24005    Type value = parseType("value", json);
24006    if (value != null)
24007      res.setValue(value);
24008  }
24009
24010  protected Task parseTask(JsonObject json) throws IOException, FHIRFormatError {
24011    Task res = new Task();
24012    parseTaskProperties(json, res);
24013    return res;
24014  }
24015
24016  protected void parseTaskProperties(JsonObject json, Task res) throws IOException, FHIRFormatError {
24017    parseDomainResourceProperties(json, res);
24018    if (json.has("identifier")) {
24019      JsonArray array = json.getAsJsonArray("identifier");
24020      for (int i = 0; i < array.size(); i++) {
24021        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
24022      }
24023    };
24024    if (json.has("instantiatesCanonical"))
24025      res.setInstantiatesCanonicalElement(parseCanonical(json.get("instantiatesCanonical").getAsString()));
24026    if (json.has("_instantiatesCanonical"))
24027      parseElementProperties(json.getAsJsonObject("_instantiatesCanonical"), res.getInstantiatesCanonicalElement());
24028    if (json.has("instantiatesUri"))
24029      res.setInstantiatesUriElement(parseUri(json.get("instantiatesUri").getAsString()));
24030    if (json.has("_instantiatesUri"))
24031      parseElementProperties(json.getAsJsonObject("_instantiatesUri"), res.getInstantiatesUriElement());
24032    if (json.has("basedOn")) {
24033      JsonArray array = json.getAsJsonArray("basedOn");
24034      for (int i = 0; i < array.size(); i++) {
24035        res.getBasedOn().add(parseReference(array.get(i).getAsJsonObject()));
24036      }
24037    };
24038    if (json.has("groupIdentifier"))
24039      res.setGroupIdentifier(parseIdentifier(json.getAsJsonObject("groupIdentifier")));
24040    if (json.has("partOf")) {
24041      JsonArray array = json.getAsJsonArray("partOf");
24042      for (int i = 0; i < array.size(); i++) {
24043        res.getPartOf().add(parseReference(array.get(i).getAsJsonObject()));
24044      }
24045    };
24046    if (json.has("status"))
24047      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Task.TaskStatus.NULL, new Task.TaskStatusEnumFactory()));
24048    if (json.has("_status"))
24049      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24050    if (json.has("statusReason"))
24051      res.setStatusReason(parseCodeableConcept(json.getAsJsonObject("statusReason")));
24052    if (json.has("businessStatus"))
24053      res.setBusinessStatus(parseCodeableConcept(json.getAsJsonObject("businessStatus")));
24054    if (json.has("intent"))
24055      res.setIntentElement(parseEnumeration(json.get("intent").getAsString(), Task.TaskIntent.NULL, new Task.TaskIntentEnumFactory()));
24056    if (json.has("_intent"))
24057      parseElementProperties(json.getAsJsonObject("_intent"), res.getIntentElement());
24058    if (json.has("priority"))
24059      res.setPriorityElement(parseEnumeration(json.get("priority").getAsString(), Task.TaskPriority.NULL, new Task.TaskPriorityEnumFactory()));
24060    if (json.has("_priority"))
24061      parseElementProperties(json.getAsJsonObject("_priority"), res.getPriorityElement());
24062    if (json.has("code"))
24063      res.setCode(parseCodeableConcept(json.getAsJsonObject("code")));
24064    if (json.has("description"))
24065      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24066    if (json.has("_description"))
24067      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24068    if (json.has("focus"))
24069      res.setFocus(parseReference(json.getAsJsonObject("focus")));
24070    if (json.has("for"))
24071      res.setFor(parseReference(json.getAsJsonObject("for")));
24072    if (json.has("context"))
24073      res.setContext(parseReference(json.getAsJsonObject("context")));
24074    if (json.has("executionPeriod"))
24075      res.setExecutionPeriod(parsePeriod(json.getAsJsonObject("executionPeriod")));
24076    if (json.has("authoredOn"))
24077      res.setAuthoredOnElement(parseDateTime(json.get("authoredOn").getAsString()));
24078    if (json.has("_authoredOn"))
24079      parseElementProperties(json.getAsJsonObject("_authoredOn"), res.getAuthoredOnElement());
24080    if (json.has("lastModified"))
24081      res.setLastModifiedElement(parseDateTime(json.get("lastModified").getAsString()));
24082    if (json.has("_lastModified"))
24083      parseElementProperties(json.getAsJsonObject("_lastModified"), res.getLastModifiedElement());
24084    if (json.has("requester"))
24085      res.setRequester(parseReference(json.getAsJsonObject("requester")));
24086    if (json.has("performerType")) {
24087      JsonArray array = json.getAsJsonArray("performerType");
24088      for (int i = 0; i < array.size(); i++) {
24089        res.getPerformerType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24090      }
24091    };
24092    if (json.has("owner"))
24093      res.setOwner(parseReference(json.getAsJsonObject("owner")));
24094    if (json.has("location"))
24095      res.setLocation(parseReference(json.getAsJsonObject("location")));
24096    if (json.has("reasonCode"))
24097      res.setReasonCode(parseCodeableConcept(json.getAsJsonObject("reasonCode")));
24098    if (json.has("reasonReference"))
24099      res.setReasonReference(parseReference(json.getAsJsonObject("reasonReference")));
24100    if (json.has("insurance")) {
24101      JsonArray array = json.getAsJsonArray("insurance");
24102      for (int i = 0; i < array.size(); i++) {
24103        res.getInsurance().add(parseReference(array.get(i).getAsJsonObject()));
24104      }
24105    };
24106    if (json.has("note")) {
24107      JsonArray array = json.getAsJsonArray("note");
24108      for (int i = 0; i < array.size(); i++) {
24109        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
24110      }
24111    };
24112    if (json.has("relevantHistory")) {
24113      JsonArray array = json.getAsJsonArray("relevantHistory");
24114      for (int i = 0; i < array.size(); i++) {
24115        res.getRelevantHistory().add(parseReference(array.get(i).getAsJsonObject()));
24116      }
24117    };
24118    if (json.has("restriction"))
24119      res.setRestriction(parseTaskTaskRestrictionComponent(json.getAsJsonObject("restriction"), res));
24120    if (json.has("input")) {
24121      JsonArray array = json.getAsJsonArray("input");
24122      for (int i = 0; i < array.size(); i++) {
24123        res.getInput().add(parseTaskParameterComponent(array.get(i).getAsJsonObject(), res));
24124      }
24125    };
24126    if (json.has("output")) {
24127      JsonArray array = json.getAsJsonArray("output");
24128      for (int i = 0; i < array.size(); i++) {
24129        res.getOutput().add(parseTaskTaskOutputComponent(array.get(i).getAsJsonObject(), res));
24130      }
24131    };
24132  }
24133
24134  protected Task.TaskRestrictionComponent parseTaskTaskRestrictionComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
24135    Task.TaskRestrictionComponent res = new Task.TaskRestrictionComponent();
24136    parseTaskTaskRestrictionComponentProperties(json, owner, res);
24137    return res;
24138  }
24139
24140  protected void parseTaskTaskRestrictionComponentProperties(JsonObject json, Task owner, Task.TaskRestrictionComponent res) throws IOException, FHIRFormatError {
24141    parseBackboneElementProperties(json, res);
24142    if (json.has("repetitions"))
24143      res.setRepetitionsElement(parsePositiveInt(json.get("repetitions").getAsString()));
24144    if (json.has("_repetitions"))
24145      parseElementProperties(json.getAsJsonObject("_repetitions"), res.getRepetitionsElement());
24146    if (json.has("period"))
24147      res.setPeriod(parsePeriod(json.getAsJsonObject("period")));
24148    if (json.has("recipient")) {
24149      JsonArray array = json.getAsJsonArray("recipient");
24150      for (int i = 0; i < array.size(); i++) {
24151        res.getRecipient().add(parseReference(array.get(i).getAsJsonObject()));
24152      }
24153    };
24154  }
24155
24156  protected Task.ParameterComponent parseTaskParameterComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
24157    Task.ParameterComponent res = new Task.ParameterComponent();
24158    parseTaskParameterComponentProperties(json, owner, res);
24159    return res;
24160  }
24161
24162  protected void parseTaskParameterComponentProperties(JsonObject json, Task owner, Task.ParameterComponent res) throws IOException, FHIRFormatError {
24163    parseBackboneElementProperties(json, res);
24164    if (json.has("type"))
24165      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24166    Type value = parseType("value", json);
24167    if (value != null)
24168      res.setValue(value);
24169  }
24170
24171  protected Task.TaskOutputComponent parseTaskTaskOutputComponent(JsonObject json, Task owner) throws IOException, FHIRFormatError {
24172    Task.TaskOutputComponent res = new Task.TaskOutputComponent();
24173    parseTaskTaskOutputComponentProperties(json, owner, res);
24174    return res;
24175  }
24176
24177  protected void parseTaskTaskOutputComponentProperties(JsonObject json, Task owner, Task.TaskOutputComponent res) throws IOException, FHIRFormatError {
24178    parseBackboneElementProperties(json, res);
24179    if (json.has("type"))
24180      res.setType(parseCodeableConcept(json.getAsJsonObject("type")));
24181    Type value = parseType("value", json);
24182    if (value != null)
24183      res.setValue(value);
24184  }
24185
24186  protected TerminologyCapabilities parseTerminologyCapabilities(JsonObject json) throws IOException, FHIRFormatError {
24187    TerminologyCapabilities res = new TerminologyCapabilities();
24188    parseTerminologyCapabilitiesProperties(json, res);
24189    return res;
24190  }
24191
24192  protected void parseTerminologyCapabilitiesProperties(JsonObject json, TerminologyCapabilities res) throws IOException, FHIRFormatError {
24193    parseDomainResourceProperties(json, res);
24194    if (json.has("url"))
24195      res.setUrlElement(parseUri(json.get("url").getAsString()));
24196    if (json.has("_url"))
24197      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
24198    if (json.has("version"))
24199      res.setVersionElement(parseString(json.get("version").getAsString()));
24200    if (json.has("_version"))
24201      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
24202    if (json.has("name"))
24203      res.setNameElement(parseString(json.get("name").getAsString()));
24204    if (json.has("_name"))
24205      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24206    if (json.has("title"))
24207      res.setTitleElement(parseString(json.get("title").getAsString()));
24208    if (json.has("_title"))
24209      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
24210    if (json.has("status"))
24211      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24212    if (json.has("_status"))
24213      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24214    if (json.has("experimental"))
24215      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24216    if (json.has("_experimental"))
24217      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
24218    if (json.has("date"))
24219      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24220    if (json.has("_date"))
24221      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
24222    if (json.has("publisher"))
24223      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24224    if (json.has("_publisher"))
24225      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
24226    if (json.has("contact")) {
24227      JsonArray array = json.getAsJsonArray("contact");
24228      for (int i = 0; i < array.size(); i++) {
24229        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24230      }
24231    };
24232    if (json.has("description"))
24233      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24234    if (json.has("_description"))
24235      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24236    if (json.has("useContext")) {
24237      JsonArray array = json.getAsJsonArray("useContext");
24238      for (int i = 0; i < array.size(); i++) {
24239        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24240      }
24241    };
24242    if (json.has("jurisdiction")) {
24243      JsonArray array = json.getAsJsonArray("jurisdiction");
24244      for (int i = 0; i < array.size(); i++) {
24245        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24246      }
24247    };
24248    if (json.has("purpose"))
24249      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24250    if (json.has("_purpose"))
24251      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
24252    if (json.has("copyright"))
24253      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24254    if (json.has("_copyright"))
24255      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
24256    if (json.has("kind"))
24257      res.setKindElement(parseEnumeration(json.get("kind").getAsString(), TerminologyCapabilities.CapabilityStatementKind.NULL, new TerminologyCapabilities.CapabilityStatementKindEnumFactory()));
24258    if (json.has("_kind"))
24259      parseElementProperties(json.getAsJsonObject("_kind"), res.getKindElement());
24260    if (json.has("software"))
24261      res.setSoftware(parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(json.getAsJsonObject("software"), res));
24262    if (json.has("implementation"))
24263      res.setImplementation(parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(json.getAsJsonObject("implementation"), res));
24264    if (json.has("lockedDate"))
24265      res.setLockedDateElement(parseBoolean(json.get("lockedDate").getAsBoolean()));
24266    if (json.has("_lockedDate"))
24267      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
24268    if (json.has("codeSystem")) {
24269      JsonArray array = json.getAsJsonArray("codeSystem");
24270      for (int i = 0; i < array.size(); i++) {
24271        res.getCodeSystem().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(array.get(i).getAsJsonObject(), res));
24272      }
24273    };
24274    if (json.has("expansion"))
24275      res.setExpansion(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(json.getAsJsonObject("expansion"), res));
24276    if (json.has("codeSearch"))
24277      res.setCodeSearchElement(parseEnumeration(json.get("codeSearch").getAsString(), TerminologyCapabilities.CodeSearchSupport.NULL, new TerminologyCapabilities.CodeSearchSupportEnumFactory()));
24278    if (json.has("_codeSearch"))
24279      parseElementProperties(json.getAsJsonObject("_codeSearch"), res.getCodeSearchElement());
24280    if (json.has("validateCode"))
24281      res.setValidateCode(parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(json.getAsJsonObject("validateCode"), res));
24282    if (json.has("translation"))
24283      res.setTranslation(parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(json.getAsJsonObject("translation"), res));
24284    if (json.has("closure"))
24285      res.setClosure(parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(json.getAsJsonObject("closure"), res));
24286  }
24287
24288  protected TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
24289    TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res = new TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent();
24290    parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(json, owner, res);
24291    return res;
24292  }
24293
24294  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent res) throws IOException, FHIRFormatError {
24295    parseBackboneElementProperties(json, res);
24296    if (json.has("name"))
24297      res.setNameElement(parseString(json.get("name").getAsString()));
24298    if (json.has("_name"))
24299      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24300    if (json.has("version"))
24301      res.setVersionElement(parseString(json.get("version").getAsString()));
24302    if (json.has("_version"))
24303      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
24304  }
24305
24306  protected TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
24307    TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent();
24308    parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(json, owner, res);
24309    return res;
24310  }
24311
24312  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent res) throws IOException, FHIRFormatError {
24313    parseBackboneElementProperties(json, res);
24314    if (json.has("description"))
24315      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24316    if (json.has("_description"))
24317      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24318    if (json.has("url"))
24319      res.setUrlElement(parseUrl(json.get("url").getAsString()));
24320    if (json.has("_url"))
24321      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
24322  }
24323
24324  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
24325    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent();
24326    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(json, owner, res);
24327    return res;
24328  }
24329
24330  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent res) throws IOException, FHIRFormatError {
24331    parseBackboneElementProperties(json, res);
24332    if (json.has("uri"))
24333      res.setUriElement(parseCanonical(json.get("uri").getAsString()));
24334    if (json.has("_uri"))
24335      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
24336    if (json.has("version")) {
24337      JsonArray array = json.getAsJsonArray("version");
24338      for (int i = 0; i < array.size(); i++) {
24339        res.getVersion().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(array.get(i).getAsJsonObject(), owner));
24340      }
24341    };
24342    if (json.has("subsumption"))
24343      res.setSubsumptionElement(parseBoolean(json.get("subsumption").getAsBoolean()));
24344    if (json.has("_subsumption"))
24345      parseElementProperties(json.getAsJsonObject("_subsumption"), res.getSubsumptionElement());
24346  }
24347
24348  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
24349    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent();
24350    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(json, owner, res);
24351    return res;
24352  }
24353
24354  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent res) throws IOException, FHIRFormatError {
24355    parseBackboneElementProperties(json, res);
24356    if (json.has("code"))
24357      res.setCodeElement(parseString(json.get("code").getAsString()));
24358    if (json.has("_code"))
24359      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
24360    if (json.has("isDefault"))
24361      res.setIsDefaultElement(parseBoolean(json.get("isDefault").getAsBoolean()));
24362    if (json.has("_isDefault"))
24363      parseElementProperties(json.getAsJsonObject("_isDefault"), res.getIsDefaultElement());
24364    if (json.has("compositional"))
24365      res.setCompositionalElement(parseBoolean(json.get("compositional").getAsBoolean()));
24366    if (json.has("_compositional"))
24367      parseElementProperties(json.getAsJsonObject("_compositional"), res.getCompositionalElement());
24368    if (json.has("language")) {
24369      JsonArray array = json.getAsJsonArray("language");
24370      for (int i = 0; i < array.size(); i++) {
24371        res.getLanguage().add(parseCode(array.get(i).getAsString()));
24372      }
24373    };
24374    if (json.has("_language")) {
24375      JsonArray array = json.getAsJsonArray("_language");
24376      for (int i = 0; i < array.size(); i++) {
24377        if (i == res.getLanguage().size())
24378          res.getLanguage().add(parseCode(null));
24379        if (array.get(i) instanceof JsonObject) 
24380          parseElementProperties(array.get(i).getAsJsonObject(), res.getLanguage().get(i));
24381      }
24382    };
24383    if (json.has("filter")) {
24384      JsonArray array = json.getAsJsonArray("filter");
24385      for (int i = 0; i < array.size(); i++) {
24386        res.getFilter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(array.get(i).getAsJsonObject(), owner));
24387      }
24388    };
24389    if (json.has("property")) {
24390      JsonArray array = json.getAsJsonArray("property");
24391      for (int i = 0; i < array.size(); i++) {
24392        res.getProperty().add(parseCode(array.get(i).getAsString()));
24393      }
24394    };
24395    if (json.has("_property")) {
24396      JsonArray array = json.getAsJsonArray("_property");
24397      for (int i = 0; i < array.size(); i++) {
24398        if (i == res.getProperty().size())
24399          res.getProperty().add(parseCode(null));
24400        if (array.get(i) instanceof JsonObject) 
24401          parseElementProperties(array.get(i).getAsJsonObject(), res.getProperty().get(i));
24402      }
24403    };
24404  }
24405
24406  protected TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
24407    TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent();
24408    parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(json, owner, res);
24409    return res;
24410  }
24411
24412  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent res) throws IOException, FHIRFormatError {
24413    parseBackboneElementProperties(json, res);
24414    if (json.has("code"))
24415      res.setCodeElement(parseCode(json.get("code").getAsString()));
24416    if (json.has("_code"))
24417      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
24418    if (json.has("op")) {
24419      JsonArray array = json.getAsJsonArray("op");
24420      for (int i = 0; i < array.size(); i++) {
24421        res.getOp().add(parseCode(array.get(i).getAsString()));
24422      }
24423    };
24424    if (json.has("_op")) {
24425      JsonArray array = json.getAsJsonArray("_op");
24426      for (int i = 0; i < array.size(); i++) {
24427        if (i == res.getOp().size())
24428          res.getOp().add(parseCode(null));
24429        if (array.get(i) instanceof JsonObject) 
24430          parseElementProperties(array.get(i).getAsJsonObject(), res.getOp().get(i));
24431      }
24432    };
24433  }
24434
24435  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
24436    TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent();
24437    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(json, owner, res);
24438    return res;
24439  }
24440
24441  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent res) throws IOException, FHIRFormatError {
24442    parseBackboneElementProperties(json, res);
24443    if (json.has("hierarchical"))
24444      res.setHierarchicalElement(parseBoolean(json.get("hierarchical").getAsBoolean()));
24445    if (json.has("_hierarchical"))
24446      parseElementProperties(json.getAsJsonObject("_hierarchical"), res.getHierarchicalElement());
24447    if (json.has("paging"))
24448      res.setPagingElement(parseBoolean(json.get("paging").getAsBoolean()));
24449    if (json.has("_paging"))
24450      parseElementProperties(json.getAsJsonObject("_paging"), res.getPagingElement());
24451    if (json.has("incomplete"))
24452      res.setIncompleteElement(parseBoolean(json.get("incomplete").getAsBoolean()));
24453    if (json.has("_incomplete"))
24454      parseElementProperties(json.getAsJsonObject("_incomplete"), res.getIncompleteElement());
24455    if (json.has("parameter")) {
24456      JsonArray array = json.getAsJsonArray("parameter");
24457      for (int i = 0; i < array.size(); i++) {
24458        res.getParameter().add(parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
24459      }
24460    };
24461    if (json.has("textFilter"))
24462      res.setTextFilterElement(parseMarkdown(json.get("textFilter").getAsString()));
24463    if (json.has("_textFilter"))
24464      parseElementProperties(json.getAsJsonObject("_textFilter"), res.getTextFilterElement());
24465  }
24466
24467  protected TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
24468    TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res = new TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent();
24469    parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(json, owner, res);
24470    return res;
24471  }
24472
24473  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent res) throws IOException, FHIRFormatError {
24474    parseBackboneElementProperties(json, res);
24475    if (json.has("name"))
24476      res.setNameElement(parseCode(json.get("name").getAsString()));
24477    if (json.has("_name"))
24478      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24479    if (json.has("documentation"))
24480      res.setDocumentationElement(parseString(json.get("documentation").getAsString()));
24481    if (json.has("_documentation"))
24482      parseElementProperties(json.getAsJsonObject("_documentation"), res.getDocumentationElement());
24483  }
24484
24485  protected TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
24486    TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res = new TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent();
24487    parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(json, owner, res);
24488    return res;
24489  }
24490
24491  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent res) throws IOException, FHIRFormatError {
24492    parseBackboneElementProperties(json, res);
24493    if (json.has("translations"))
24494      res.setTranslationsElement(parseBoolean(json.get("translations").getAsBoolean()));
24495    if (json.has("_translations"))
24496      parseElementProperties(json.getAsJsonObject("_translations"), res.getTranslationsElement());
24497  }
24498
24499  protected TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
24500    TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res = new TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent();
24501    parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(json, owner, res);
24502    return res;
24503  }
24504
24505  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent res) throws IOException, FHIRFormatError {
24506    parseBackboneElementProperties(json, res);
24507    if (json.has("needsMap"))
24508      res.setNeedsMapElement(parseBoolean(json.get("needsMap").getAsBoolean()));
24509    if (json.has("_needsMap"))
24510      parseElementProperties(json.getAsJsonObject("_needsMap"), res.getNeedsMapElement());
24511  }
24512
24513  protected TerminologyCapabilities.TerminologyCapabilitiesClosureComponent parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(JsonObject json, TerminologyCapabilities owner) throws IOException, FHIRFormatError {
24514    TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res = new TerminologyCapabilities.TerminologyCapabilitiesClosureComponent();
24515    parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(json, owner, res);
24516    return res;
24517  }
24518
24519  protected void parseTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentProperties(JsonObject json, TerminologyCapabilities owner, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent res) throws IOException, FHIRFormatError {
24520    parseBackboneElementProperties(json, res);
24521    if (json.has("translation"))
24522      res.setTranslationElement(parseBoolean(json.get("translation").getAsBoolean()));
24523    if (json.has("_translation"))
24524      parseElementProperties(json.getAsJsonObject("_translation"), res.getTranslationElement());
24525  }
24526
24527  protected TestReport parseTestReport(JsonObject json) throws IOException, FHIRFormatError {
24528    TestReport res = new TestReport();
24529    parseTestReportProperties(json, res);
24530    return res;
24531  }
24532
24533  protected void parseTestReportProperties(JsonObject json, TestReport res) throws IOException, FHIRFormatError {
24534    parseDomainResourceProperties(json, res);
24535    if (json.has("identifier"))
24536      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24537    if (json.has("name"))
24538      res.setNameElement(parseString(json.get("name").getAsString()));
24539    if (json.has("_name"))
24540      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24541    if (json.has("status"))
24542      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), TestReport.TestReportStatus.NULL, new TestReport.TestReportStatusEnumFactory()));
24543    if (json.has("_status"))
24544      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24545    if (json.has("testScript"))
24546      res.setTestScript(parseReference(json.getAsJsonObject("testScript")));
24547    if (json.has("result"))
24548      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportResult.NULL, new TestReport.TestReportResultEnumFactory()));
24549    if (json.has("_result"))
24550      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
24551    if (json.has("score"))
24552      res.setScoreElement(parseDecimal(json.get("score").getAsBigDecimal()));
24553    if (json.has("_score"))
24554      parseElementProperties(json.getAsJsonObject("_score"), res.getScoreElement());
24555    if (json.has("tester"))
24556      res.setTesterElement(parseString(json.get("tester").getAsString()));
24557    if (json.has("_tester"))
24558      parseElementProperties(json.getAsJsonObject("_tester"), res.getTesterElement());
24559    if (json.has("issued"))
24560      res.setIssuedElement(parseDateTime(json.get("issued").getAsString()));
24561    if (json.has("_issued"))
24562      parseElementProperties(json.getAsJsonObject("_issued"), res.getIssuedElement());
24563    if (json.has("participant")) {
24564      JsonArray array = json.getAsJsonArray("participant");
24565      for (int i = 0; i < array.size(); i++) {
24566        res.getParticipant().add(parseTestReportTestReportParticipantComponent(array.get(i).getAsJsonObject(), res));
24567      }
24568    };
24569    if (json.has("setup"))
24570      res.setSetup(parseTestReportTestReportSetupComponent(json.getAsJsonObject("setup"), res));
24571    if (json.has("test")) {
24572      JsonArray array = json.getAsJsonArray("test");
24573      for (int i = 0; i < array.size(); i++) {
24574        res.getTest().add(parseTestReportTestReportTestComponent(array.get(i).getAsJsonObject(), res));
24575      }
24576    };
24577    if (json.has("teardown"))
24578      res.setTeardown(parseTestReportTestReportTeardownComponent(json.getAsJsonObject("teardown"), res));
24579  }
24580
24581  protected TestReport.TestReportParticipantComponent parseTestReportTestReportParticipantComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
24582    TestReport.TestReportParticipantComponent res = new TestReport.TestReportParticipantComponent();
24583    parseTestReportTestReportParticipantComponentProperties(json, owner, res);
24584    return res;
24585  }
24586
24587  protected void parseTestReportTestReportParticipantComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportParticipantComponent res) throws IOException, FHIRFormatError {
24588    parseBackboneElementProperties(json, res);
24589    if (json.has("type"))
24590      res.setTypeElement(parseEnumeration(json.get("type").getAsString(), TestReport.TestReportParticipantType.NULL, new TestReport.TestReportParticipantTypeEnumFactory()));
24591    if (json.has("_type"))
24592      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
24593    if (json.has("uri"))
24594      res.setUriElement(parseUri(json.get("uri").getAsString()));
24595    if (json.has("_uri"))
24596      parseElementProperties(json.getAsJsonObject("_uri"), res.getUriElement());
24597    if (json.has("display"))
24598      res.setDisplayElement(parseString(json.get("display").getAsString()));
24599    if (json.has("_display"))
24600      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
24601  }
24602
24603  protected TestReport.TestReportSetupComponent parseTestReportTestReportSetupComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
24604    TestReport.TestReportSetupComponent res = new TestReport.TestReportSetupComponent();
24605    parseTestReportTestReportSetupComponentProperties(json, owner, res);
24606    return res;
24607  }
24608
24609  protected void parseTestReportTestReportSetupComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportSetupComponent res) throws IOException, FHIRFormatError {
24610    parseBackboneElementProperties(json, res);
24611    if (json.has("action")) {
24612      JsonArray array = json.getAsJsonArray("action");
24613      for (int i = 0; i < array.size(); i++) {
24614        res.getAction().add(parseTestReportSetupActionComponent(array.get(i).getAsJsonObject(), owner));
24615      }
24616    };
24617  }
24618
24619  protected TestReport.SetupActionComponent parseTestReportSetupActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
24620    TestReport.SetupActionComponent res = new TestReport.SetupActionComponent();
24621    parseTestReportSetupActionComponentProperties(json, owner, res);
24622    return res;
24623  }
24624
24625  protected void parseTestReportSetupActionComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionComponent res) throws IOException, FHIRFormatError {
24626    parseBackboneElementProperties(json, res);
24627    if (json.has("operation"))
24628      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
24629    if (json.has("assert"))
24630      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
24631  }
24632
24633  protected TestReport.SetupActionOperationComponent parseTestReportSetupActionOperationComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
24634    TestReport.SetupActionOperationComponent res = new TestReport.SetupActionOperationComponent();
24635    parseTestReportSetupActionOperationComponentProperties(json, owner, res);
24636    return res;
24637  }
24638
24639  protected void parseTestReportSetupActionOperationComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
24640    parseBackboneElementProperties(json, res);
24641    if (json.has("result"))
24642      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
24643    if (json.has("_result"))
24644      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
24645    if (json.has("message"))
24646      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
24647    if (json.has("_message"))
24648      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
24649    if (json.has("detail"))
24650      res.setDetailElement(parseUri(json.get("detail").getAsString()));
24651    if (json.has("_detail"))
24652      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
24653  }
24654
24655  protected TestReport.SetupActionAssertComponent parseTestReportSetupActionAssertComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
24656    TestReport.SetupActionAssertComponent res = new TestReport.SetupActionAssertComponent();
24657    parseTestReportSetupActionAssertComponentProperties(json, owner, res);
24658    return res;
24659  }
24660
24661  protected void parseTestReportSetupActionAssertComponentProperties(JsonObject json, TestReport owner, TestReport.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
24662    parseBackboneElementProperties(json, res);
24663    if (json.has("result"))
24664      res.setResultElement(parseEnumeration(json.get("result").getAsString(), TestReport.TestReportActionResult.NULL, new TestReport.TestReportActionResultEnumFactory()));
24665    if (json.has("_result"))
24666      parseElementProperties(json.getAsJsonObject("_result"), res.getResultElement());
24667    if (json.has("message"))
24668      res.setMessageElement(parseMarkdown(json.get("message").getAsString()));
24669    if (json.has("_message"))
24670      parseElementProperties(json.getAsJsonObject("_message"), res.getMessageElement());
24671    if (json.has("detail"))
24672      res.setDetailElement(parseString(json.get("detail").getAsString()));
24673    if (json.has("_detail"))
24674      parseElementProperties(json.getAsJsonObject("_detail"), res.getDetailElement());
24675  }
24676
24677  protected TestReport.TestReportTestComponent parseTestReportTestReportTestComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
24678    TestReport.TestReportTestComponent res = new TestReport.TestReportTestComponent();
24679    parseTestReportTestReportTestComponentProperties(json, owner, res);
24680    return res;
24681  }
24682
24683  protected void parseTestReportTestReportTestComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTestComponent res) throws IOException, FHIRFormatError {
24684    parseBackboneElementProperties(json, res);
24685    if (json.has("name"))
24686      res.setNameElement(parseString(json.get("name").getAsString()));
24687    if (json.has("_name"))
24688      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24689    if (json.has("description"))
24690      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24691    if (json.has("_description"))
24692      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24693    if (json.has("action")) {
24694      JsonArray array = json.getAsJsonArray("action");
24695      for (int i = 0; i < array.size(); i++) {
24696        res.getAction().add(parseTestReportTestActionComponent(array.get(i).getAsJsonObject(), owner));
24697      }
24698    };
24699  }
24700
24701  protected TestReport.TestActionComponent parseTestReportTestActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
24702    TestReport.TestActionComponent res = new TestReport.TestActionComponent();
24703    parseTestReportTestActionComponentProperties(json, owner, res);
24704    return res;
24705  }
24706
24707  protected void parseTestReportTestActionComponentProperties(JsonObject json, TestReport owner, TestReport.TestActionComponent res) throws IOException, FHIRFormatError {
24708    parseBackboneElementProperties(json, res);
24709    if (json.has("operation"))
24710      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
24711    if (json.has("assert"))
24712      res.setAssert(parseTestReportSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
24713  }
24714
24715  protected TestReport.TestReportTeardownComponent parseTestReportTestReportTeardownComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
24716    TestReport.TestReportTeardownComponent res = new TestReport.TestReportTeardownComponent();
24717    parseTestReportTestReportTeardownComponentProperties(json, owner, res);
24718    return res;
24719  }
24720
24721  protected void parseTestReportTestReportTeardownComponentProperties(JsonObject json, TestReport owner, TestReport.TestReportTeardownComponent res) throws IOException, FHIRFormatError {
24722    parseBackboneElementProperties(json, res);
24723    if (json.has("action")) {
24724      JsonArray array = json.getAsJsonArray("action");
24725      for (int i = 0; i < array.size(); i++) {
24726        res.getAction().add(parseTestReportTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
24727      }
24728    };
24729  }
24730
24731  protected TestReport.TeardownActionComponent parseTestReportTeardownActionComponent(JsonObject json, TestReport owner) throws IOException, FHIRFormatError {
24732    TestReport.TeardownActionComponent res = new TestReport.TeardownActionComponent();
24733    parseTestReportTeardownActionComponentProperties(json, owner, res);
24734    return res;
24735  }
24736
24737  protected void parseTestReportTeardownActionComponentProperties(JsonObject json, TestReport owner, TestReport.TeardownActionComponent res) throws IOException, FHIRFormatError {
24738    parseBackboneElementProperties(json, res);
24739    if (json.has("operation"))
24740      res.setOperation(parseTestReportSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
24741  }
24742
24743  protected TestScript parseTestScript(JsonObject json) throws IOException, FHIRFormatError {
24744    TestScript res = new TestScript();
24745    parseTestScriptProperties(json, res);
24746    return res;
24747  }
24748
24749  protected void parseTestScriptProperties(JsonObject json, TestScript res) throws IOException, FHIRFormatError {
24750    parseDomainResourceProperties(json, res);
24751    if (json.has("url"))
24752      res.setUrlElement(parseUri(json.get("url").getAsString()));
24753    if (json.has("_url"))
24754      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
24755    if (json.has("identifier"))
24756      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
24757    if (json.has("version"))
24758      res.setVersionElement(parseString(json.get("version").getAsString()));
24759    if (json.has("_version"))
24760      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
24761    if (json.has("name"))
24762      res.setNameElement(parseString(json.get("name").getAsString()));
24763    if (json.has("_name"))
24764      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
24765    if (json.has("title"))
24766      res.setTitleElement(parseString(json.get("title").getAsString()));
24767    if (json.has("_title"))
24768      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
24769    if (json.has("status"))
24770      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
24771    if (json.has("_status"))
24772      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
24773    if (json.has("experimental"))
24774      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
24775    if (json.has("_experimental"))
24776      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
24777    if (json.has("date"))
24778      res.setDateElement(parseDateTime(json.get("date").getAsString()));
24779    if (json.has("_date"))
24780      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
24781    if (json.has("publisher"))
24782      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
24783    if (json.has("_publisher"))
24784      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
24785    if (json.has("contact")) {
24786      JsonArray array = json.getAsJsonArray("contact");
24787      for (int i = 0; i < array.size(); i++) {
24788        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
24789      }
24790    };
24791    if (json.has("description"))
24792      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
24793    if (json.has("_description"))
24794      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24795    if (json.has("useContext")) {
24796      JsonArray array = json.getAsJsonArray("useContext");
24797      for (int i = 0; i < array.size(); i++) {
24798        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
24799      }
24800    };
24801    if (json.has("jurisdiction")) {
24802      JsonArray array = json.getAsJsonArray("jurisdiction");
24803      for (int i = 0; i < array.size(); i++) {
24804        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
24805      }
24806    };
24807    if (json.has("purpose"))
24808      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
24809    if (json.has("_purpose"))
24810      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
24811    if (json.has("copyright"))
24812      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
24813    if (json.has("_copyright"))
24814      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
24815    if (json.has("origin")) {
24816      JsonArray array = json.getAsJsonArray("origin");
24817      for (int i = 0; i < array.size(); i++) {
24818        res.getOrigin().add(parseTestScriptTestScriptOriginComponent(array.get(i).getAsJsonObject(), res));
24819      }
24820    };
24821    if (json.has("destination")) {
24822      JsonArray array = json.getAsJsonArray("destination");
24823      for (int i = 0; i < array.size(); i++) {
24824        res.getDestination().add(parseTestScriptTestScriptDestinationComponent(array.get(i).getAsJsonObject(), res));
24825      }
24826    };
24827    if (json.has("metadata"))
24828      res.setMetadata(parseTestScriptTestScriptMetadataComponent(json.getAsJsonObject("metadata"), res));
24829    if (json.has("fixture")) {
24830      JsonArray array = json.getAsJsonArray("fixture");
24831      for (int i = 0; i < array.size(); i++) {
24832        res.getFixture().add(parseTestScriptTestScriptFixtureComponent(array.get(i).getAsJsonObject(), res));
24833      }
24834    };
24835    if (json.has("profile")) {
24836      JsonArray array = json.getAsJsonArray("profile");
24837      for (int i = 0; i < array.size(); i++) {
24838        res.getProfile().add(parseReference(array.get(i).getAsJsonObject()));
24839      }
24840    };
24841    if (json.has("variable")) {
24842      JsonArray array = json.getAsJsonArray("variable");
24843      for (int i = 0; i < array.size(); i++) {
24844        res.getVariable().add(parseTestScriptTestScriptVariableComponent(array.get(i).getAsJsonObject(), res));
24845      }
24846    };
24847    if (json.has("rule")) {
24848      JsonArray array = json.getAsJsonArray("rule");
24849      for (int i = 0; i < array.size(); i++) {
24850        res.getRule().add(parseTestScriptTestScriptRuleComponent(array.get(i).getAsJsonObject(), res));
24851      }
24852    };
24853    if (json.has("ruleset")) {
24854      JsonArray array = json.getAsJsonArray("ruleset");
24855      for (int i = 0; i < array.size(); i++) {
24856        res.getRuleset().add(parseTestScriptTestScriptRulesetComponent(array.get(i).getAsJsonObject(), res));
24857      }
24858    };
24859    if (json.has("setup"))
24860      res.setSetup(parseTestScriptTestScriptSetupComponent(json.getAsJsonObject("setup"), res));
24861    if (json.has("test")) {
24862      JsonArray array = json.getAsJsonArray("test");
24863      for (int i = 0; i < array.size(); i++) {
24864        res.getTest().add(parseTestScriptTestScriptTestComponent(array.get(i).getAsJsonObject(), res));
24865      }
24866    };
24867    if (json.has("teardown"))
24868      res.setTeardown(parseTestScriptTestScriptTeardownComponent(json.getAsJsonObject("teardown"), res));
24869  }
24870
24871  protected TestScript.TestScriptOriginComponent parseTestScriptTestScriptOriginComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
24872    TestScript.TestScriptOriginComponent res = new TestScript.TestScriptOriginComponent();
24873    parseTestScriptTestScriptOriginComponentProperties(json, owner, res);
24874    return res;
24875  }
24876
24877  protected void parseTestScriptTestScriptOriginComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptOriginComponent res) throws IOException, FHIRFormatError {
24878    parseBackboneElementProperties(json, res);
24879    if (json.has("index"))
24880      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
24881    if (json.has("_index"))
24882      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
24883    if (json.has("profile"))
24884      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
24885  }
24886
24887  protected TestScript.TestScriptDestinationComponent parseTestScriptTestScriptDestinationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
24888    TestScript.TestScriptDestinationComponent res = new TestScript.TestScriptDestinationComponent();
24889    parseTestScriptTestScriptDestinationComponentProperties(json, owner, res);
24890    return res;
24891  }
24892
24893  protected void parseTestScriptTestScriptDestinationComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptDestinationComponent res) throws IOException, FHIRFormatError {
24894    parseBackboneElementProperties(json, res);
24895    if (json.has("index"))
24896      res.setIndexElement(parseInteger(json.get("index").getAsLong()));
24897    if (json.has("_index"))
24898      parseElementProperties(json.getAsJsonObject("_index"), res.getIndexElement());
24899    if (json.has("profile"))
24900      res.setProfile(parseCoding(json.getAsJsonObject("profile")));
24901  }
24902
24903  protected TestScript.TestScriptMetadataComponent parseTestScriptTestScriptMetadataComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
24904    TestScript.TestScriptMetadataComponent res = new TestScript.TestScriptMetadataComponent();
24905    parseTestScriptTestScriptMetadataComponentProperties(json, owner, res);
24906    return res;
24907  }
24908
24909  protected void parseTestScriptTestScriptMetadataComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataComponent res) throws IOException, FHIRFormatError {
24910    parseBackboneElementProperties(json, res);
24911    if (json.has("link")) {
24912      JsonArray array = json.getAsJsonArray("link");
24913      for (int i = 0; i < array.size(); i++) {
24914        res.getLink().add(parseTestScriptTestScriptMetadataLinkComponent(array.get(i).getAsJsonObject(), owner));
24915      }
24916    };
24917    if (json.has("capability")) {
24918      JsonArray array = json.getAsJsonArray("capability");
24919      for (int i = 0; i < array.size(); i++) {
24920        res.getCapability().add(parseTestScriptTestScriptMetadataCapabilityComponent(array.get(i).getAsJsonObject(), owner));
24921      }
24922    };
24923  }
24924
24925  protected TestScript.TestScriptMetadataLinkComponent parseTestScriptTestScriptMetadataLinkComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
24926    TestScript.TestScriptMetadataLinkComponent res = new TestScript.TestScriptMetadataLinkComponent();
24927    parseTestScriptTestScriptMetadataLinkComponentProperties(json, owner, res);
24928    return res;
24929  }
24930
24931  protected void parseTestScriptTestScriptMetadataLinkComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataLinkComponent res) throws IOException, FHIRFormatError {
24932    parseBackboneElementProperties(json, res);
24933    if (json.has("url"))
24934      res.setUrlElement(parseUri(json.get("url").getAsString()));
24935    if (json.has("_url"))
24936      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
24937    if (json.has("description"))
24938      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24939    if (json.has("_description"))
24940      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24941  }
24942
24943  protected TestScript.TestScriptMetadataCapabilityComponent parseTestScriptTestScriptMetadataCapabilityComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
24944    TestScript.TestScriptMetadataCapabilityComponent res = new TestScript.TestScriptMetadataCapabilityComponent();
24945    parseTestScriptTestScriptMetadataCapabilityComponentProperties(json, owner, res);
24946    return res;
24947  }
24948
24949  protected void parseTestScriptTestScriptMetadataCapabilityComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptMetadataCapabilityComponent res) throws IOException, FHIRFormatError {
24950    parseBackboneElementProperties(json, res);
24951    if (json.has("required"))
24952      res.setRequiredElement(parseBoolean(json.get("required").getAsBoolean()));
24953    if (json.has("_required"))
24954      parseElementProperties(json.getAsJsonObject("_required"), res.getRequiredElement());
24955    if (json.has("validated"))
24956      res.setValidatedElement(parseBoolean(json.get("validated").getAsBoolean()));
24957    if (json.has("_validated"))
24958      parseElementProperties(json.getAsJsonObject("_validated"), res.getValidatedElement());
24959    if (json.has("description"))
24960      res.setDescriptionElement(parseString(json.get("description").getAsString()));
24961    if (json.has("_description"))
24962      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
24963    if (json.has("origin")) {
24964      JsonArray array = json.getAsJsonArray("origin");
24965      for (int i = 0; i < array.size(); i++) {
24966        res.getOrigin().add(parseInteger(array.get(i).getAsLong()));
24967      }
24968    };
24969    if (json.has("_origin")) {
24970      JsonArray array = json.getAsJsonArray("_origin");
24971      for (int i = 0; i < array.size(); i++) {
24972        if (i == res.getOrigin().size())
24973          res.getOrigin().add(parseInteger(null));
24974        if (array.get(i) instanceof JsonObject) 
24975          parseElementProperties(array.get(i).getAsJsonObject(), res.getOrigin().get(i));
24976      }
24977    };
24978    if (json.has("destination"))
24979      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
24980    if (json.has("_destination"))
24981      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
24982    if (json.has("link")) {
24983      JsonArray array = json.getAsJsonArray("link");
24984      for (int i = 0; i < array.size(); i++) {
24985        res.getLink().add(parseUri(array.get(i).getAsString()));
24986      }
24987    };
24988    if (json.has("_link")) {
24989      JsonArray array = json.getAsJsonArray("_link");
24990      for (int i = 0; i < array.size(); i++) {
24991        if (i == res.getLink().size())
24992          res.getLink().add(parseUri(null));
24993        if (array.get(i) instanceof JsonObject) 
24994          parseElementProperties(array.get(i).getAsJsonObject(), res.getLink().get(i));
24995      }
24996    };
24997    if (json.has("capabilities"))
24998      res.setCapabilitiesElement(parseCanonical(json.get("capabilities").getAsString()));
24999    if (json.has("_capabilities"))
25000      parseElementProperties(json.getAsJsonObject("_capabilities"), res.getCapabilitiesElement());
25001  }
25002
25003  protected TestScript.TestScriptFixtureComponent parseTestScriptTestScriptFixtureComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25004    TestScript.TestScriptFixtureComponent res = new TestScript.TestScriptFixtureComponent();
25005    parseTestScriptTestScriptFixtureComponentProperties(json, owner, res);
25006    return res;
25007  }
25008
25009  protected void parseTestScriptTestScriptFixtureComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptFixtureComponent res) throws IOException, FHIRFormatError {
25010    parseBackboneElementProperties(json, res);
25011    if (json.has("autocreate"))
25012      res.setAutocreateElement(parseBoolean(json.get("autocreate").getAsBoolean()));
25013    if (json.has("_autocreate"))
25014      parseElementProperties(json.getAsJsonObject("_autocreate"), res.getAutocreateElement());
25015    if (json.has("autodelete"))
25016      res.setAutodeleteElement(parseBoolean(json.get("autodelete").getAsBoolean()));
25017    if (json.has("_autodelete"))
25018      parseElementProperties(json.getAsJsonObject("_autodelete"), res.getAutodeleteElement());
25019    if (json.has("resource"))
25020      res.setResource(parseReference(json.getAsJsonObject("resource")));
25021  }
25022
25023  protected TestScript.TestScriptVariableComponent parseTestScriptTestScriptVariableComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25024    TestScript.TestScriptVariableComponent res = new TestScript.TestScriptVariableComponent();
25025    parseTestScriptTestScriptVariableComponentProperties(json, owner, res);
25026    return res;
25027  }
25028
25029  protected void parseTestScriptTestScriptVariableComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptVariableComponent res) throws IOException, FHIRFormatError {
25030    parseBackboneElementProperties(json, res);
25031    if (json.has("name"))
25032      res.setNameElement(parseString(json.get("name").getAsString()));
25033    if (json.has("_name"))
25034      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25035    if (json.has("defaultValue"))
25036      res.setDefaultValueElement(parseString(json.get("defaultValue").getAsString()));
25037    if (json.has("_defaultValue"))
25038      parseElementProperties(json.getAsJsonObject("_defaultValue"), res.getDefaultValueElement());
25039    if (json.has("description"))
25040      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25041    if (json.has("_description"))
25042      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25043    if (json.has("expression"))
25044      res.setExpressionElement(parseString(json.get("expression").getAsString()));
25045    if (json.has("_expression"))
25046      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
25047    if (json.has("headerField"))
25048      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
25049    if (json.has("_headerField"))
25050      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
25051    if (json.has("hint"))
25052      res.setHintElement(parseString(json.get("hint").getAsString()));
25053    if (json.has("_hint"))
25054      parseElementProperties(json.getAsJsonObject("_hint"), res.getHintElement());
25055    if (json.has("path"))
25056      res.setPathElement(parseString(json.get("path").getAsString()));
25057    if (json.has("_path"))
25058      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
25059    if (json.has("sourceId"))
25060      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
25061    if (json.has("_sourceId"))
25062      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
25063  }
25064
25065  protected TestScript.TestScriptRuleComponent parseTestScriptTestScriptRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25066    TestScript.TestScriptRuleComponent res = new TestScript.TestScriptRuleComponent();
25067    parseTestScriptTestScriptRuleComponentProperties(json, owner, res);
25068    return res;
25069  }
25070
25071  protected void parseTestScriptTestScriptRuleComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptRuleComponent res) throws IOException, FHIRFormatError {
25072    parseBackboneElementProperties(json, res);
25073    if (json.has("resource"))
25074      res.setResource(parseReference(json.getAsJsonObject("resource")));
25075    if (json.has("param")) {
25076      JsonArray array = json.getAsJsonArray("param");
25077      for (int i = 0; i < array.size(); i++) {
25078        res.getParam().add(parseTestScriptRuleParamComponent(array.get(i).getAsJsonObject(), owner));
25079      }
25080    };
25081  }
25082
25083  protected TestScript.RuleParamComponent parseTestScriptRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25084    TestScript.RuleParamComponent res = new TestScript.RuleParamComponent();
25085    parseTestScriptRuleParamComponentProperties(json, owner, res);
25086    return res;
25087  }
25088
25089  protected void parseTestScriptRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.RuleParamComponent res) throws IOException, FHIRFormatError {
25090    parseBackboneElementProperties(json, res);
25091    if (json.has("name"))
25092      res.setNameElement(parseString(json.get("name").getAsString()));
25093    if (json.has("_name"))
25094      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25095    if (json.has("value"))
25096      res.setValueElement(parseString(json.get("value").getAsString()));
25097    if (json.has("_value"))
25098      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
25099  }
25100
25101  protected TestScript.TestScriptRulesetComponent parseTestScriptTestScriptRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25102    TestScript.TestScriptRulesetComponent res = new TestScript.TestScriptRulesetComponent();
25103    parseTestScriptTestScriptRulesetComponentProperties(json, owner, res);
25104    return res;
25105  }
25106
25107  protected void parseTestScriptTestScriptRulesetComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptRulesetComponent res) throws IOException, FHIRFormatError {
25108    parseBackboneElementProperties(json, res);
25109    if (json.has("resource"))
25110      res.setResource(parseReference(json.getAsJsonObject("resource")));
25111    if (json.has("rule")) {
25112      JsonArray array = json.getAsJsonArray("rule");
25113      for (int i = 0; i < array.size(); i++) {
25114        res.getRule().add(parseTestScriptRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
25115      }
25116    };
25117  }
25118
25119  protected TestScript.RulesetRuleComponent parseTestScriptRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25120    TestScript.RulesetRuleComponent res = new TestScript.RulesetRuleComponent();
25121    parseTestScriptRulesetRuleComponentProperties(json, owner, res);
25122    return res;
25123  }
25124
25125  protected void parseTestScriptRulesetRuleComponentProperties(JsonObject json, TestScript owner, TestScript.RulesetRuleComponent res) throws IOException, FHIRFormatError {
25126    parseBackboneElementProperties(json, res);
25127    if (json.has("ruleId"))
25128      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
25129    if (json.has("_ruleId"))
25130      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
25131    if (json.has("param")) {
25132      JsonArray array = json.getAsJsonArray("param");
25133      for (int i = 0; i < array.size(); i++) {
25134        res.getParam().add(parseTestScriptRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
25135      }
25136    };
25137  }
25138
25139  protected TestScript.RulesetRuleParamComponent parseTestScriptRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25140    TestScript.RulesetRuleParamComponent res = new TestScript.RulesetRuleParamComponent();
25141    parseTestScriptRulesetRuleParamComponentProperties(json, owner, res);
25142    return res;
25143  }
25144
25145  protected void parseTestScriptRulesetRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.RulesetRuleParamComponent res) throws IOException, FHIRFormatError {
25146    parseBackboneElementProperties(json, res);
25147    if (json.has("name"))
25148      res.setNameElement(parseString(json.get("name").getAsString()));
25149    if (json.has("_name"))
25150      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25151    if (json.has("value"))
25152      res.setValueElement(parseString(json.get("value").getAsString()));
25153    if (json.has("_value"))
25154      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
25155  }
25156
25157  protected TestScript.TestScriptSetupComponent parseTestScriptTestScriptSetupComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25158    TestScript.TestScriptSetupComponent res = new TestScript.TestScriptSetupComponent();
25159    parseTestScriptTestScriptSetupComponentProperties(json, owner, res);
25160    return res;
25161  }
25162
25163  protected void parseTestScriptTestScriptSetupComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptSetupComponent res) throws IOException, FHIRFormatError {
25164    parseBackboneElementProperties(json, res);
25165    if (json.has("action")) {
25166      JsonArray array = json.getAsJsonArray("action");
25167      for (int i = 0; i < array.size(); i++) {
25168        res.getAction().add(parseTestScriptSetupActionComponent(array.get(i).getAsJsonObject(), owner));
25169      }
25170    };
25171  }
25172
25173  protected TestScript.SetupActionComponent parseTestScriptSetupActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25174    TestScript.SetupActionComponent res = new TestScript.SetupActionComponent();
25175    parseTestScriptSetupActionComponentProperties(json, owner, res);
25176    return res;
25177  }
25178
25179  protected void parseTestScriptSetupActionComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionComponent res) throws IOException, FHIRFormatError {
25180    parseBackboneElementProperties(json, res);
25181    if (json.has("operation"))
25182      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
25183    if (json.has("assert"))
25184      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
25185  }
25186
25187  protected TestScript.SetupActionOperationComponent parseTestScriptSetupActionOperationComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25188    TestScript.SetupActionOperationComponent res = new TestScript.SetupActionOperationComponent();
25189    parseTestScriptSetupActionOperationComponentProperties(json, owner, res);
25190    return res;
25191  }
25192
25193  protected void parseTestScriptSetupActionOperationComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationComponent res) throws IOException, FHIRFormatError {
25194    parseBackboneElementProperties(json, res);
25195    if (json.has("type"))
25196      res.setType(parseCoding(json.getAsJsonObject("type")));
25197    if (json.has("resource"))
25198      res.setResourceElement(parseCode(json.get("resource").getAsString()));
25199    if (json.has("_resource"))
25200      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
25201    if (json.has("label"))
25202      res.setLabelElement(parseString(json.get("label").getAsString()));
25203    if (json.has("_label"))
25204      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
25205    if (json.has("description"))
25206      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25207    if (json.has("_description"))
25208      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25209    if (json.has("accept"))
25210      res.setAcceptElement(parseCode(json.get("accept").getAsString()));
25211    if (json.has("_accept"))
25212      parseElementProperties(json.getAsJsonObject("_accept"), res.getAcceptElement());
25213    if (json.has("contentType"))
25214      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
25215    if (json.has("_contentType"))
25216      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
25217    if (json.has("destination"))
25218      res.setDestinationElement(parseInteger(json.get("destination").getAsLong()));
25219    if (json.has("_destination"))
25220      parseElementProperties(json.getAsJsonObject("_destination"), res.getDestinationElement());
25221    if (json.has("encodeRequestUrl"))
25222      res.setEncodeRequestUrlElement(parseBoolean(json.get("encodeRequestUrl").getAsBoolean()));
25223    if (json.has("_encodeRequestUrl"))
25224      parseElementProperties(json.getAsJsonObject("_encodeRequestUrl"), res.getEncodeRequestUrlElement());
25225    if (json.has("origin"))
25226      res.setOriginElement(parseInteger(json.get("origin").getAsLong()));
25227    if (json.has("_origin"))
25228      parseElementProperties(json.getAsJsonObject("_origin"), res.getOriginElement());
25229    if (json.has("params"))
25230      res.setParamsElement(parseString(json.get("params").getAsString()));
25231    if (json.has("_params"))
25232      parseElementProperties(json.getAsJsonObject("_params"), res.getParamsElement());
25233    if (json.has("requestHeader")) {
25234      JsonArray array = json.getAsJsonArray("requestHeader");
25235      for (int i = 0; i < array.size(); i++) {
25236        res.getRequestHeader().add(parseTestScriptSetupActionOperationRequestHeaderComponent(array.get(i).getAsJsonObject(), owner));
25237      }
25238    };
25239    if (json.has("requestId"))
25240      res.setRequestIdElement(parseId(json.get("requestId").getAsString()));
25241    if (json.has("_requestId"))
25242      parseElementProperties(json.getAsJsonObject("_requestId"), res.getRequestIdElement());
25243    if (json.has("responseId"))
25244      res.setResponseIdElement(parseId(json.get("responseId").getAsString()));
25245    if (json.has("_responseId"))
25246      parseElementProperties(json.getAsJsonObject("_responseId"), res.getResponseIdElement());
25247    if (json.has("sourceId"))
25248      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
25249    if (json.has("_sourceId"))
25250      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
25251    if (json.has("targetId"))
25252      res.setTargetIdElement(parseId(json.get("targetId").getAsString()));
25253    if (json.has("_targetId"))
25254      parseElementProperties(json.getAsJsonObject("_targetId"), res.getTargetIdElement());
25255    if (json.has("url"))
25256      res.setUrlElement(parseString(json.get("url").getAsString()));
25257    if (json.has("_url"))
25258      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
25259  }
25260
25261  protected TestScript.SetupActionOperationRequestHeaderComponent parseTestScriptSetupActionOperationRequestHeaderComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25262    TestScript.SetupActionOperationRequestHeaderComponent res = new TestScript.SetupActionOperationRequestHeaderComponent();
25263    parseTestScriptSetupActionOperationRequestHeaderComponentProperties(json, owner, res);
25264    return res;
25265  }
25266
25267  protected void parseTestScriptSetupActionOperationRequestHeaderComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionOperationRequestHeaderComponent res) throws IOException, FHIRFormatError {
25268    parseBackboneElementProperties(json, res);
25269    if (json.has("field"))
25270      res.setFieldElement(parseString(json.get("field").getAsString()));
25271    if (json.has("_field"))
25272      parseElementProperties(json.getAsJsonObject("_field"), res.getFieldElement());
25273    if (json.has("value"))
25274      res.setValueElement(parseString(json.get("value").getAsString()));
25275    if (json.has("_value"))
25276      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
25277  }
25278
25279  protected TestScript.SetupActionAssertComponent parseTestScriptSetupActionAssertComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25280    TestScript.SetupActionAssertComponent res = new TestScript.SetupActionAssertComponent();
25281    parseTestScriptSetupActionAssertComponentProperties(json, owner, res);
25282    return res;
25283  }
25284
25285  protected void parseTestScriptSetupActionAssertComponentProperties(JsonObject json, TestScript owner, TestScript.SetupActionAssertComponent res) throws IOException, FHIRFormatError {
25286    parseBackboneElementProperties(json, res);
25287    if (json.has("label"))
25288      res.setLabelElement(parseString(json.get("label").getAsString()));
25289    if (json.has("_label"))
25290      parseElementProperties(json.getAsJsonObject("_label"), res.getLabelElement());
25291    if (json.has("description"))
25292      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25293    if (json.has("_description"))
25294      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25295    if (json.has("direction"))
25296      res.setDirectionElement(parseEnumeration(json.get("direction").getAsString(), TestScript.AssertionDirectionType.NULL, new TestScript.AssertionDirectionTypeEnumFactory()));
25297    if (json.has("_direction"))
25298      parseElementProperties(json.getAsJsonObject("_direction"), res.getDirectionElement());
25299    if (json.has("compareToSourceId"))
25300      res.setCompareToSourceIdElement(parseString(json.get("compareToSourceId").getAsString()));
25301    if (json.has("_compareToSourceId"))
25302      parseElementProperties(json.getAsJsonObject("_compareToSourceId"), res.getCompareToSourceIdElement());
25303    if (json.has("compareToSourceExpression"))
25304      res.setCompareToSourceExpressionElement(parseString(json.get("compareToSourceExpression").getAsString()));
25305    if (json.has("_compareToSourceExpression"))
25306      parseElementProperties(json.getAsJsonObject("_compareToSourceExpression"), res.getCompareToSourceExpressionElement());
25307    if (json.has("compareToSourcePath"))
25308      res.setCompareToSourcePathElement(parseString(json.get("compareToSourcePath").getAsString()));
25309    if (json.has("_compareToSourcePath"))
25310      parseElementProperties(json.getAsJsonObject("_compareToSourcePath"), res.getCompareToSourcePathElement());
25311    if (json.has("contentType"))
25312      res.setContentTypeElement(parseCode(json.get("contentType").getAsString()));
25313    if (json.has("_contentType"))
25314      parseElementProperties(json.getAsJsonObject("_contentType"), res.getContentTypeElement());
25315    if (json.has("expression"))
25316      res.setExpressionElement(parseString(json.get("expression").getAsString()));
25317    if (json.has("_expression"))
25318      parseElementProperties(json.getAsJsonObject("_expression"), res.getExpressionElement());
25319    if (json.has("headerField"))
25320      res.setHeaderFieldElement(parseString(json.get("headerField").getAsString()));
25321    if (json.has("_headerField"))
25322      parseElementProperties(json.getAsJsonObject("_headerField"), res.getHeaderFieldElement());
25323    if (json.has("minimumId"))
25324      res.setMinimumIdElement(parseString(json.get("minimumId").getAsString()));
25325    if (json.has("_minimumId"))
25326      parseElementProperties(json.getAsJsonObject("_minimumId"), res.getMinimumIdElement());
25327    if (json.has("navigationLinks"))
25328      res.setNavigationLinksElement(parseBoolean(json.get("navigationLinks").getAsBoolean()));
25329    if (json.has("_navigationLinks"))
25330      parseElementProperties(json.getAsJsonObject("_navigationLinks"), res.getNavigationLinksElement());
25331    if (json.has("operator"))
25332      res.setOperatorElement(parseEnumeration(json.get("operator").getAsString(), TestScript.AssertionOperatorType.NULL, new TestScript.AssertionOperatorTypeEnumFactory()));
25333    if (json.has("_operator"))
25334      parseElementProperties(json.getAsJsonObject("_operator"), res.getOperatorElement());
25335    if (json.has("path"))
25336      res.setPathElement(parseString(json.get("path").getAsString()));
25337    if (json.has("_path"))
25338      parseElementProperties(json.getAsJsonObject("_path"), res.getPathElement());
25339    if (json.has("requestMethod"))
25340      res.setRequestMethodElement(parseEnumeration(json.get("requestMethod").getAsString(), TestScript.TestScriptRequestMethodCode.NULL, new TestScript.TestScriptRequestMethodCodeEnumFactory()));
25341    if (json.has("_requestMethod"))
25342      parseElementProperties(json.getAsJsonObject("_requestMethod"), res.getRequestMethodElement());
25343    if (json.has("requestURL"))
25344      res.setRequestURLElement(parseString(json.get("requestURL").getAsString()));
25345    if (json.has("_requestURL"))
25346      parseElementProperties(json.getAsJsonObject("_requestURL"), res.getRequestURLElement());
25347    if (json.has("resource"))
25348      res.setResourceElement(parseCode(json.get("resource").getAsString()));
25349    if (json.has("_resource"))
25350      parseElementProperties(json.getAsJsonObject("_resource"), res.getResourceElement());
25351    if (json.has("response"))
25352      res.setResponseElement(parseEnumeration(json.get("response").getAsString(), TestScript.AssertionResponseTypes.NULL, new TestScript.AssertionResponseTypesEnumFactory()));
25353    if (json.has("_response"))
25354      parseElementProperties(json.getAsJsonObject("_response"), res.getResponseElement());
25355    if (json.has("responseCode"))
25356      res.setResponseCodeElement(parseString(json.get("responseCode").getAsString()));
25357    if (json.has("_responseCode"))
25358      parseElementProperties(json.getAsJsonObject("_responseCode"), res.getResponseCodeElement());
25359    if (json.has("rule"))
25360      res.setRule(parseTestScriptActionAssertRuleComponent(json.getAsJsonObject("rule"), owner));
25361    if (json.has("ruleset"))
25362      res.setRuleset(parseTestScriptActionAssertRulesetComponent(json.getAsJsonObject("ruleset"), owner));
25363    if (json.has("sourceId"))
25364      res.setSourceIdElement(parseId(json.get("sourceId").getAsString()));
25365    if (json.has("_sourceId"))
25366      parseElementProperties(json.getAsJsonObject("_sourceId"), res.getSourceIdElement());
25367    if (json.has("validateProfileId"))
25368      res.setValidateProfileIdElement(parseId(json.get("validateProfileId").getAsString()));
25369    if (json.has("_validateProfileId"))
25370      parseElementProperties(json.getAsJsonObject("_validateProfileId"), res.getValidateProfileIdElement());
25371    if (json.has("value"))
25372      res.setValueElement(parseString(json.get("value").getAsString()));
25373    if (json.has("_value"))
25374      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
25375    if (json.has("warningOnly"))
25376      res.setWarningOnlyElement(parseBoolean(json.get("warningOnly").getAsBoolean()));
25377    if (json.has("_warningOnly"))
25378      parseElementProperties(json.getAsJsonObject("_warningOnly"), res.getWarningOnlyElement());
25379  }
25380
25381  protected TestScript.ActionAssertRuleComponent parseTestScriptActionAssertRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25382    TestScript.ActionAssertRuleComponent res = new TestScript.ActionAssertRuleComponent();
25383    parseTestScriptActionAssertRuleComponentProperties(json, owner, res);
25384    return res;
25385  }
25386
25387  protected void parseTestScriptActionAssertRuleComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRuleComponent res) throws IOException, FHIRFormatError {
25388    parseBackboneElementProperties(json, res);
25389    if (json.has("ruleId"))
25390      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
25391    if (json.has("_ruleId"))
25392      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
25393    if (json.has("param")) {
25394      JsonArray array = json.getAsJsonArray("param");
25395      for (int i = 0; i < array.size(); i++) {
25396        res.getParam().add(parseTestScriptActionAssertRuleParamComponent(array.get(i).getAsJsonObject(), owner));
25397      }
25398    };
25399  }
25400
25401  protected TestScript.ActionAssertRuleParamComponent parseTestScriptActionAssertRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25402    TestScript.ActionAssertRuleParamComponent res = new TestScript.ActionAssertRuleParamComponent();
25403    parseTestScriptActionAssertRuleParamComponentProperties(json, owner, res);
25404    return res;
25405  }
25406
25407  protected void parseTestScriptActionAssertRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRuleParamComponent res) throws IOException, FHIRFormatError {
25408    parseBackboneElementProperties(json, res);
25409    if (json.has("name"))
25410      res.setNameElement(parseString(json.get("name").getAsString()));
25411    if (json.has("_name"))
25412      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25413    if (json.has("value"))
25414      res.setValueElement(parseString(json.get("value").getAsString()));
25415    if (json.has("_value"))
25416      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
25417  }
25418
25419  protected TestScript.ActionAssertRulesetComponent parseTestScriptActionAssertRulesetComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25420    TestScript.ActionAssertRulesetComponent res = new TestScript.ActionAssertRulesetComponent();
25421    parseTestScriptActionAssertRulesetComponentProperties(json, owner, res);
25422    return res;
25423  }
25424
25425  protected void parseTestScriptActionAssertRulesetComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetComponent res) throws IOException, FHIRFormatError {
25426    parseBackboneElementProperties(json, res);
25427    if (json.has("rulesetId"))
25428      res.setRulesetIdElement(parseId(json.get("rulesetId").getAsString()));
25429    if (json.has("_rulesetId"))
25430      parseElementProperties(json.getAsJsonObject("_rulesetId"), res.getRulesetIdElement());
25431    if (json.has("rule")) {
25432      JsonArray array = json.getAsJsonArray("rule");
25433      for (int i = 0; i < array.size(); i++) {
25434        res.getRule().add(parseTestScriptActionAssertRulesetRuleComponent(array.get(i).getAsJsonObject(), owner));
25435      }
25436    };
25437  }
25438
25439  protected TestScript.ActionAssertRulesetRuleComponent parseTestScriptActionAssertRulesetRuleComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25440    TestScript.ActionAssertRulesetRuleComponent res = new TestScript.ActionAssertRulesetRuleComponent();
25441    parseTestScriptActionAssertRulesetRuleComponentProperties(json, owner, res);
25442    return res;
25443  }
25444
25445  protected void parseTestScriptActionAssertRulesetRuleComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetRuleComponent res) throws IOException, FHIRFormatError {
25446    parseBackboneElementProperties(json, res);
25447    if (json.has("ruleId"))
25448      res.setRuleIdElement(parseId(json.get("ruleId").getAsString()));
25449    if (json.has("_ruleId"))
25450      parseElementProperties(json.getAsJsonObject("_ruleId"), res.getRuleIdElement());
25451    if (json.has("param")) {
25452      JsonArray array = json.getAsJsonArray("param");
25453      for (int i = 0; i < array.size(); i++) {
25454        res.getParam().add(parseTestScriptActionAssertRulesetRuleParamComponent(array.get(i).getAsJsonObject(), owner));
25455      }
25456    };
25457  }
25458
25459  protected TestScript.ActionAssertRulesetRuleParamComponent parseTestScriptActionAssertRulesetRuleParamComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25460    TestScript.ActionAssertRulesetRuleParamComponent res = new TestScript.ActionAssertRulesetRuleParamComponent();
25461    parseTestScriptActionAssertRulesetRuleParamComponentProperties(json, owner, res);
25462    return res;
25463  }
25464
25465  protected void parseTestScriptActionAssertRulesetRuleParamComponentProperties(JsonObject json, TestScript owner, TestScript.ActionAssertRulesetRuleParamComponent res) throws IOException, FHIRFormatError {
25466    parseBackboneElementProperties(json, res);
25467    if (json.has("name"))
25468      res.setNameElement(parseString(json.get("name").getAsString()));
25469    if (json.has("_name"))
25470      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25471    if (json.has("value"))
25472      res.setValueElement(parseString(json.get("value").getAsString()));
25473    if (json.has("_value"))
25474      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
25475  }
25476
25477  protected TestScript.TestScriptTestComponent parseTestScriptTestScriptTestComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25478    TestScript.TestScriptTestComponent res = new TestScript.TestScriptTestComponent();
25479    parseTestScriptTestScriptTestComponentProperties(json, owner, res);
25480    return res;
25481  }
25482
25483  protected void parseTestScriptTestScriptTestComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTestComponent res) throws IOException, FHIRFormatError {
25484    parseBackboneElementProperties(json, res);
25485    if (json.has("name"))
25486      res.setNameElement(parseString(json.get("name").getAsString()));
25487    if (json.has("_name"))
25488      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25489    if (json.has("description"))
25490      res.setDescriptionElement(parseString(json.get("description").getAsString()));
25491    if (json.has("_description"))
25492      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25493    if (json.has("action")) {
25494      JsonArray array = json.getAsJsonArray("action");
25495      for (int i = 0; i < array.size(); i++) {
25496        res.getAction().add(parseTestScriptTestActionComponent(array.get(i).getAsJsonObject(), owner));
25497      }
25498    };
25499  }
25500
25501  protected TestScript.TestActionComponent parseTestScriptTestActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25502    TestScript.TestActionComponent res = new TestScript.TestActionComponent();
25503    parseTestScriptTestActionComponentProperties(json, owner, res);
25504    return res;
25505  }
25506
25507  protected void parseTestScriptTestActionComponentProperties(JsonObject json, TestScript owner, TestScript.TestActionComponent res) throws IOException, FHIRFormatError {
25508    parseBackboneElementProperties(json, res);
25509    if (json.has("operation"))
25510      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
25511    if (json.has("assert"))
25512      res.setAssert(parseTestScriptSetupActionAssertComponent(json.getAsJsonObject("assert"), owner));
25513  }
25514
25515  protected TestScript.TestScriptTeardownComponent parseTestScriptTestScriptTeardownComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25516    TestScript.TestScriptTeardownComponent res = new TestScript.TestScriptTeardownComponent();
25517    parseTestScriptTestScriptTeardownComponentProperties(json, owner, res);
25518    return res;
25519  }
25520
25521  protected void parseTestScriptTestScriptTeardownComponentProperties(JsonObject json, TestScript owner, TestScript.TestScriptTeardownComponent res) throws IOException, FHIRFormatError {
25522    parseBackboneElementProperties(json, res);
25523    if (json.has("action")) {
25524      JsonArray array = json.getAsJsonArray("action");
25525      for (int i = 0; i < array.size(); i++) {
25526        res.getAction().add(parseTestScriptTeardownActionComponent(array.get(i).getAsJsonObject(), owner));
25527      }
25528    };
25529  }
25530
25531  protected TestScript.TeardownActionComponent parseTestScriptTeardownActionComponent(JsonObject json, TestScript owner) throws IOException, FHIRFormatError {
25532    TestScript.TeardownActionComponent res = new TestScript.TeardownActionComponent();
25533    parseTestScriptTeardownActionComponentProperties(json, owner, res);
25534    return res;
25535  }
25536
25537  protected void parseTestScriptTeardownActionComponentProperties(JsonObject json, TestScript owner, TestScript.TeardownActionComponent res) throws IOException, FHIRFormatError {
25538    parseBackboneElementProperties(json, res);
25539    if (json.has("operation"))
25540      res.setOperation(parseTestScriptSetupActionOperationComponent(json.getAsJsonObject("operation"), owner));
25541  }
25542
25543  protected UserSession parseUserSession(JsonObject json) throws IOException, FHIRFormatError {
25544    UserSession res = new UserSession();
25545    parseUserSessionProperties(json, res);
25546    return res;
25547  }
25548
25549  protected void parseUserSessionProperties(JsonObject json, UserSession res) throws IOException, FHIRFormatError {
25550    parseDomainResourceProperties(json, res);
25551    if (json.has("identifier"))
25552      res.setIdentifier(parseIdentifier(json.getAsJsonObject("identifier")));
25553    if (json.has("user"))
25554      res.setUser(parseReference(json.getAsJsonObject("user")));
25555    if (json.has("status"))
25556      res.setStatus(parseUserSessionUserSessionStatusComponent(json.getAsJsonObject("status"), res));
25557    if (json.has("workstation"))
25558      res.setWorkstation(parseIdentifier(json.getAsJsonObject("workstation")));
25559    if (json.has("focus")) {
25560      JsonArray array = json.getAsJsonArray("focus");
25561      for (int i = 0; i < array.size(); i++) {
25562        res.getFocus().add(parseReference(array.get(i).getAsJsonObject()));
25563      }
25564    };
25565    if (json.has("created"))
25566      res.setCreatedElement(parseInstant(json.get("created").getAsString()));
25567    if (json.has("_created"))
25568      parseElementProperties(json.getAsJsonObject("_created"), res.getCreatedElement());
25569    if (json.has("expires"))
25570      res.setExpiresElement(parseInstant(json.get("expires").getAsString()));
25571    if (json.has("_expires"))
25572      parseElementProperties(json.getAsJsonObject("_expires"), res.getExpiresElement());
25573    if (json.has("context")) {
25574      JsonArray array = json.getAsJsonArray("context");
25575      for (int i = 0; i < array.size(); i++) {
25576        res.getContext().add(parseUserSessionUserSessionContextComponent(array.get(i).getAsJsonObject(), res));
25577      }
25578    };
25579  }
25580
25581  protected UserSession.UserSessionStatusComponent parseUserSessionUserSessionStatusComponent(JsonObject json, UserSession owner) throws IOException, FHIRFormatError {
25582    UserSession.UserSessionStatusComponent res = new UserSession.UserSessionStatusComponent();
25583    parseUserSessionUserSessionStatusComponentProperties(json, owner, res);
25584    return res;
25585  }
25586
25587  protected void parseUserSessionUserSessionStatusComponentProperties(JsonObject json, UserSession owner, UserSession.UserSessionStatusComponent res) throws IOException, FHIRFormatError {
25588    parseBackboneElementProperties(json, res);
25589    if (json.has("code"))
25590      res.setCodeElement(parseEnumeration(json.get("code").getAsString(), UserSession.UserSessionStatus.NULL, new UserSession.UserSessionStatusEnumFactory()));
25591    if (json.has("_code"))
25592      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
25593    if (json.has("source"))
25594      res.setSourceElement(parseEnumeration(json.get("source").getAsString(), UserSession.UserSessionStatusSource.NULL, new UserSession.UserSessionStatusSourceEnumFactory()));
25595    if (json.has("_source"))
25596      parseElementProperties(json.getAsJsonObject("_source"), res.getSourceElement());
25597  }
25598
25599  protected UserSession.UserSessionContextComponent parseUserSessionUserSessionContextComponent(JsonObject json, UserSession owner) throws IOException, FHIRFormatError {
25600    UserSession.UserSessionContextComponent res = new UserSession.UserSessionContextComponent();
25601    parseUserSessionUserSessionContextComponentProperties(json, owner, res);
25602    return res;
25603  }
25604
25605  protected void parseUserSessionUserSessionContextComponentProperties(JsonObject json, UserSession owner, UserSession.UserSessionContextComponent res) throws IOException, FHIRFormatError {
25606    parseBackboneElementProperties(json, res);
25607    if (json.has("type"))
25608      res.setTypeElement(parseString(json.get("type").getAsString()));
25609    if (json.has("_type"))
25610      parseElementProperties(json.getAsJsonObject("_type"), res.getTypeElement());
25611    Type value = parseType("value", json);
25612    if (value != null)
25613      res.setValue(value);
25614  }
25615
25616  protected ValueSet parseValueSet(JsonObject json) throws IOException, FHIRFormatError {
25617    ValueSet res = new ValueSet();
25618    parseValueSetProperties(json, res);
25619    return res;
25620  }
25621
25622  protected void parseValueSetProperties(JsonObject json, ValueSet res) throws IOException, FHIRFormatError {
25623    parseDomainResourceProperties(json, res);
25624    if (json.has("url"))
25625      res.setUrlElement(parseUri(json.get("url").getAsString()));
25626    if (json.has("_url"))
25627      parseElementProperties(json.getAsJsonObject("_url"), res.getUrlElement());
25628    if (json.has("identifier")) {
25629      JsonArray array = json.getAsJsonArray("identifier");
25630      for (int i = 0; i < array.size(); i++) {
25631        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
25632      }
25633    };
25634    if (json.has("version"))
25635      res.setVersionElement(parseString(json.get("version").getAsString()));
25636    if (json.has("_version"))
25637      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
25638    if (json.has("name"))
25639      res.setNameElement(parseString(json.get("name").getAsString()));
25640    if (json.has("_name"))
25641      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25642    if (json.has("title"))
25643      res.setTitleElement(parseString(json.get("title").getAsString()));
25644    if (json.has("_title"))
25645      parseElementProperties(json.getAsJsonObject("_title"), res.getTitleElement());
25646    if (json.has("status"))
25647      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), Enumerations.PublicationStatus.NULL, new Enumerations.PublicationStatusEnumFactory()));
25648    if (json.has("_status"))
25649      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25650    if (json.has("experimental"))
25651      res.setExperimentalElement(parseBoolean(json.get("experimental").getAsBoolean()));
25652    if (json.has("_experimental"))
25653      parseElementProperties(json.getAsJsonObject("_experimental"), res.getExperimentalElement());
25654    if (json.has("date"))
25655      res.setDateElement(parseDateTime(json.get("date").getAsString()));
25656    if (json.has("_date"))
25657      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
25658    if (json.has("publisher"))
25659      res.setPublisherElement(parseString(json.get("publisher").getAsString()));
25660    if (json.has("_publisher"))
25661      parseElementProperties(json.getAsJsonObject("_publisher"), res.getPublisherElement());
25662    if (json.has("contact")) {
25663      JsonArray array = json.getAsJsonArray("contact");
25664      for (int i = 0; i < array.size(); i++) {
25665        res.getContact().add(parseContactDetail(array.get(i).getAsJsonObject()));
25666      }
25667    };
25668    if (json.has("description"))
25669      res.setDescriptionElement(parseMarkdown(json.get("description").getAsString()));
25670    if (json.has("_description"))
25671      parseElementProperties(json.getAsJsonObject("_description"), res.getDescriptionElement());
25672    if (json.has("useContext")) {
25673      JsonArray array = json.getAsJsonArray("useContext");
25674      for (int i = 0; i < array.size(); i++) {
25675        res.getUseContext().add(parseUsageContext(array.get(i).getAsJsonObject()));
25676      }
25677    };
25678    if (json.has("jurisdiction")) {
25679      JsonArray array = json.getAsJsonArray("jurisdiction");
25680      for (int i = 0; i < array.size(); i++) {
25681        res.getJurisdiction().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25682      }
25683    };
25684    if (json.has("immutable"))
25685      res.setImmutableElement(parseBoolean(json.get("immutable").getAsBoolean()));
25686    if (json.has("_immutable"))
25687      parseElementProperties(json.getAsJsonObject("_immutable"), res.getImmutableElement());
25688    if (json.has("purpose"))
25689      res.setPurposeElement(parseMarkdown(json.get("purpose").getAsString()));
25690    if (json.has("_purpose"))
25691      parseElementProperties(json.getAsJsonObject("_purpose"), res.getPurposeElement());
25692    if (json.has("copyright"))
25693      res.setCopyrightElement(parseMarkdown(json.get("copyright").getAsString()));
25694    if (json.has("_copyright"))
25695      parseElementProperties(json.getAsJsonObject("_copyright"), res.getCopyrightElement());
25696    if (json.has("compose"))
25697      res.setCompose(parseValueSetValueSetComposeComponent(json.getAsJsonObject("compose"), res));
25698    if (json.has("expansion"))
25699      res.setExpansion(parseValueSetValueSetExpansionComponent(json.getAsJsonObject("expansion"), res));
25700  }
25701
25702  protected ValueSet.ValueSetComposeComponent parseValueSetValueSetComposeComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
25703    ValueSet.ValueSetComposeComponent res = new ValueSet.ValueSetComposeComponent();
25704    parseValueSetValueSetComposeComponentProperties(json, owner, res);
25705    return res;
25706  }
25707
25708  protected void parseValueSetValueSetComposeComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetComposeComponent res) throws IOException, FHIRFormatError {
25709    parseBackboneElementProperties(json, res);
25710    if (json.has("lockedDate"))
25711      res.setLockedDateElement(parseDate(json.get("lockedDate").getAsString()));
25712    if (json.has("_lockedDate"))
25713      parseElementProperties(json.getAsJsonObject("_lockedDate"), res.getLockedDateElement());
25714    if (json.has("inactive"))
25715      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
25716    if (json.has("_inactive"))
25717      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
25718    if (json.has("include")) {
25719      JsonArray array = json.getAsJsonArray("include");
25720      for (int i = 0; i < array.size(); i++) {
25721        res.getInclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
25722      }
25723    };
25724    if (json.has("exclude")) {
25725      JsonArray array = json.getAsJsonArray("exclude");
25726      for (int i = 0; i < array.size(); i++) {
25727        res.getExclude().add(parseValueSetConceptSetComponent(array.get(i).getAsJsonObject(), owner));
25728      }
25729    };
25730  }
25731
25732  protected ValueSet.ConceptSetComponent parseValueSetConceptSetComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
25733    ValueSet.ConceptSetComponent res = new ValueSet.ConceptSetComponent();
25734    parseValueSetConceptSetComponentProperties(json, owner, res);
25735    return res;
25736  }
25737
25738  protected void parseValueSetConceptSetComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetComponent res) throws IOException, FHIRFormatError {
25739    parseBackboneElementProperties(json, res);
25740    if (json.has("system"))
25741      res.setSystemElement(parseUri(json.get("system").getAsString()));
25742    if (json.has("_system"))
25743      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
25744    if (json.has("version"))
25745      res.setVersionElement(parseString(json.get("version").getAsString()));
25746    if (json.has("_version"))
25747      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
25748    if (json.has("concept")) {
25749      JsonArray array = json.getAsJsonArray("concept");
25750      for (int i = 0; i < array.size(); i++) {
25751        res.getConcept().add(parseValueSetConceptReferenceComponent(array.get(i).getAsJsonObject(), owner));
25752      }
25753    };
25754    if (json.has("filter")) {
25755      JsonArray array = json.getAsJsonArray("filter");
25756      for (int i = 0; i < array.size(); i++) {
25757        res.getFilter().add(parseValueSetConceptSetFilterComponent(array.get(i).getAsJsonObject(), owner));
25758      }
25759    };
25760    if (json.has("valueSet")) {
25761      JsonArray array = json.getAsJsonArray("valueSet");
25762      for (int i = 0; i < array.size(); i++) {
25763        res.getValueSet().add(parseCanonical(array.get(i).getAsString()));
25764      }
25765    };
25766    if (json.has("_valueSet")) {
25767      JsonArray array = json.getAsJsonArray("_valueSet");
25768      for (int i = 0; i < array.size(); i++) {
25769        if (i == res.getValueSet().size())
25770          res.getValueSet().add(parseCanonical(null));
25771        if (array.get(i) instanceof JsonObject) 
25772          parseElementProperties(array.get(i).getAsJsonObject(), res.getValueSet().get(i));
25773      }
25774    };
25775  }
25776
25777  protected ValueSet.ConceptReferenceComponent parseValueSetConceptReferenceComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
25778    ValueSet.ConceptReferenceComponent res = new ValueSet.ConceptReferenceComponent();
25779    parseValueSetConceptReferenceComponentProperties(json, owner, res);
25780    return res;
25781  }
25782
25783  protected void parseValueSetConceptReferenceComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceComponent res) throws IOException, FHIRFormatError {
25784    parseBackboneElementProperties(json, res);
25785    if (json.has("code"))
25786      res.setCodeElement(parseCode(json.get("code").getAsString()));
25787    if (json.has("_code"))
25788      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
25789    if (json.has("display"))
25790      res.setDisplayElement(parseString(json.get("display").getAsString()));
25791    if (json.has("_display"))
25792      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
25793    if (json.has("designation")) {
25794      JsonArray array = json.getAsJsonArray("designation");
25795      for (int i = 0; i < array.size(); i++) {
25796        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
25797      }
25798    };
25799  }
25800
25801  protected ValueSet.ConceptReferenceDesignationComponent parseValueSetConceptReferenceDesignationComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
25802    ValueSet.ConceptReferenceDesignationComponent res = new ValueSet.ConceptReferenceDesignationComponent();
25803    parseValueSetConceptReferenceDesignationComponentProperties(json, owner, res);
25804    return res;
25805  }
25806
25807  protected void parseValueSetConceptReferenceDesignationComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptReferenceDesignationComponent res) throws IOException, FHIRFormatError {
25808    parseBackboneElementProperties(json, res);
25809    if (json.has("language"))
25810      res.setLanguageElement(parseCode(json.get("language").getAsString()));
25811    if (json.has("_language"))
25812      parseElementProperties(json.getAsJsonObject("_language"), res.getLanguageElement());
25813    if (json.has("use"))
25814      res.setUse(parseCoding(json.getAsJsonObject("use")));
25815    if (json.has("value"))
25816      res.setValueElement(parseString(json.get("value").getAsString()));
25817    if (json.has("_value"))
25818      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
25819  }
25820
25821  protected ValueSet.ConceptSetFilterComponent parseValueSetConceptSetFilterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
25822    ValueSet.ConceptSetFilterComponent res = new ValueSet.ConceptSetFilterComponent();
25823    parseValueSetConceptSetFilterComponentProperties(json, owner, res);
25824    return res;
25825  }
25826
25827  protected void parseValueSetConceptSetFilterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ConceptSetFilterComponent res) throws IOException, FHIRFormatError {
25828    parseBackboneElementProperties(json, res);
25829    if (json.has("property"))
25830      res.setPropertyElement(parseCode(json.get("property").getAsString()));
25831    if (json.has("_property"))
25832      parseElementProperties(json.getAsJsonObject("_property"), res.getPropertyElement());
25833    if (json.has("op"))
25834      res.setOpElement(parseEnumeration(json.get("op").getAsString(), ValueSet.FilterOperator.NULL, new ValueSet.FilterOperatorEnumFactory()));
25835    if (json.has("_op"))
25836      parseElementProperties(json.getAsJsonObject("_op"), res.getOpElement());
25837    if (json.has("value"))
25838      res.setValueElement(parseString(json.get("value").getAsString()));
25839    if (json.has("_value"))
25840      parseElementProperties(json.getAsJsonObject("_value"), res.getValueElement());
25841  }
25842
25843  protected ValueSet.ValueSetExpansionComponent parseValueSetValueSetExpansionComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
25844    ValueSet.ValueSetExpansionComponent res = new ValueSet.ValueSetExpansionComponent();
25845    parseValueSetValueSetExpansionComponentProperties(json, owner, res);
25846    return res;
25847  }
25848
25849  protected void parseValueSetValueSetExpansionComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionComponent res) throws IOException, FHIRFormatError {
25850    parseBackboneElementProperties(json, res);
25851    if (json.has("identifier"))
25852      res.setIdentifierElement(parseUri(json.get("identifier").getAsString()));
25853    if (json.has("_identifier"))
25854      parseElementProperties(json.getAsJsonObject("_identifier"), res.getIdentifierElement());
25855    if (json.has("timestamp"))
25856      res.setTimestampElement(parseDateTime(json.get("timestamp").getAsString()));
25857    if (json.has("_timestamp"))
25858      parseElementProperties(json.getAsJsonObject("_timestamp"), res.getTimestampElement());
25859    if (json.has("total"))
25860      res.setTotalElement(parseInteger(json.get("total").getAsLong()));
25861    if (json.has("_total"))
25862      parseElementProperties(json.getAsJsonObject("_total"), res.getTotalElement());
25863    if (json.has("offset"))
25864      res.setOffsetElement(parseInteger(json.get("offset").getAsLong()));
25865    if (json.has("_offset"))
25866      parseElementProperties(json.getAsJsonObject("_offset"), res.getOffsetElement());
25867    if (json.has("parameter")) {
25868      JsonArray array = json.getAsJsonArray("parameter");
25869      for (int i = 0; i < array.size(); i++) {
25870        res.getParameter().add(parseValueSetValueSetExpansionParameterComponent(array.get(i).getAsJsonObject(), owner));
25871      }
25872    };
25873    if (json.has("contains")) {
25874      JsonArray array = json.getAsJsonArray("contains");
25875      for (int i = 0; i < array.size(); i++) {
25876        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
25877      }
25878    };
25879  }
25880
25881  protected ValueSet.ValueSetExpansionParameterComponent parseValueSetValueSetExpansionParameterComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
25882    ValueSet.ValueSetExpansionParameterComponent res = new ValueSet.ValueSetExpansionParameterComponent();
25883    parseValueSetValueSetExpansionParameterComponentProperties(json, owner, res);
25884    return res;
25885  }
25886
25887  protected void parseValueSetValueSetExpansionParameterComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionParameterComponent res) throws IOException, FHIRFormatError {
25888    parseBackboneElementProperties(json, res);
25889    if (json.has("name"))
25890      res.setNameElement(parseString(json.get("name").getAsString()));
25891    if (json.has("_name"))
25892      parseElementProperties(json.getAsJsonObject("_name"), res.getNameElement());
25893    Type value = parseType("value", json);
25894    if (value != null)
25895      res.setValue(value);
25896  }
25897
25898  protected ValueSet.ValueSetExpansionContainsComponent parseValueSetValueSetExpansionContainsComponent(JsonObject json, ValueSet owner) throws IOException, FHIRFormatError {
25899    ValueSet.ValueSetExpansionContainsComponent res = new ValueSet.ValueSetExpansionContainsComponent();
25900    parseValueSetValueSetExpansionContainsComponentProperties(json, owner, res);
25901    return res;
25902  }
25903
25904  protected void parseValueSetValueSetExpansionContainsComponentProperties(JsonObject json, ValueSet owner, ValueSet.ValueSetExpansionContainsComponent res) throws IOException, FHIRFormatError {
25905    parseBackboneElementProperties(json, res);
25906    if (json.has("system"))
25907      res.setSystemElement(parseUri(json.get("system").getAsString()));
25908    if (json.has("_system"))
25909      parseElementProperties(json.getAsJsonObject("_system"), res.getSystemElement());
25910    if (json.has("abstract"))
25911      res.setAbstractElement(parseBoolean(json.get("abstract").getAsBoolean()));
25912    if (json.has("_abstract"))
25913      parseElementProperties(json.getAsJsonObject("_abstract"), res.getAbstractElement());
25914    if (json.has("inactive"))
25915      res.setInactiveElement(parseBoolean(json.get("inactive").getAsBoolean()));
25916    if (json.has("_inactive"))
25917      parseElementProperties(json.getAsJsonObject("_inactive"), res.getInactiveElement());
25918    if (json.has("version"))
25919      res.setVersionElement(parseString(json.get("version").getAsString()));
25920    if (json.has("_version"))
25921      parseElementProperties(json.getAsJsonObject("_version"), res.getVersionElement());
25922    if (json.has("code"))
25923      res.setCodeElement(parseCode(json.get("code").getAsString()));
25924    if (json.has("_code"))
25925      parseElementProperties(json.getAsJsonObject("_code"), res.getCodeElement());
25926    if (json.has("display"))
25927      res.setDisplayElement(parseString(json.get("display").getAsString()));
25928    if (json.has("_display"))
25929      parseElementProperties(json.getAsJsonObject("_display"), res.getDisplayElement());
25930    if (json.has("designation")) {
25931      JsonArray array = json.getAsJsonArray("designation");
25932      for (int i = 0; i < array.size(); i++) {
25933        res.getDesignation().add(parseValueSetConceptReferenceDesignationComponent(array.get(i).getAsJsonObject(), owner));
25934      }
25935    };
25936    if (json.has("contains")) {
25937      JsonArray array = json.getAsJsonArray("contains");
25938      for (int i = 0; i < array.size(); i++) {
25939        res.getContains().add(parseValueSetValueSetExpansionContainsComponent(array.get(i).getAsJsonObject(), owner));
25940      }
25941    };
25942  }
25943
25944  protected VerificationResult parseVerificationResult(JsonObject json) throws IOException, FHIRFormatError {
25945    VerificationResult res = new VerificationResult();
25946    parseVerificationResultProperties(json, res);
25947    return res;
25948  }
25949
25950  protected void parseVerificationResultProperties(JsonObject json, VerificationResult res) throws IOException, FHIRFormatError {
25951    parseDomainResourceProperties(json, res);
25952    if (json.has("target")) {
25953      JsonArray array = json.getAsJsonArray("target");
25954      for (int i = 0; i < array.size(); i++) {
25955        res.getTarget().add(parseReference(array.get(i).getAsJsonObject()));
25956      }
25957    };
25958    if (json.has("targetLocation")) {
25959      JsonArray array = json.getAsJsonArray("targetLocation");
25960      for (int i = 0; i < array.size(); i++) {
25961        res.getTargetLocation().add(parseString(array.get(i).getAsString()));
25962      }
25963    };
25964    if (json.has("_targetLocation")) {
25965      JsonArray array = json.getAsJsonArray("_targetLocation");
25966      for (int i = 0; i < array.size(); i++) {
25967        if (i == res.getTargetLocation().size())
25968          res.getTargetLocation().add(parseString(null));
25969        if (array.get(i) instanceof JsonObject) 
25970          parseElementProperties(array.get(i).getAsJsonObject(), res.getTargetLocation().get(i));
25971      }
25972    };
25973    if (json.has("need"))
25974      res.setNeed(parseCodeableConcept(json.getAsJsonObject("need")));
25975    if (json.has("status"))
25976      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VerificationResult.Status.NULL, new VerificationResult.StatusEnumFactory()));
25977    if (json.has("_status"))
25978      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
25979    if (json.has("statusDate"))
25980      res.setStatusDateElement(parseDateTime(json.get("statusDate").getAsString()));
25981    if (json.has("_statusDate"))
25982      parseElementProperties(json.getAsJsonObject("_statusDate"), res.getStatusDateElement());
25983    if (json.has("validationType"))
25984      res.setValidationType(parseCodeableConcept(json.getAsJsonObject("validationType")));
25985    if (json.has("validationProcess")) {
25986      JsonArray array = json.getAsJsonArray("validationProcess");
25987      for (int i = 0; i < array.size(); i++) {
25988        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
25989      }
25990    };
25991    if (json.has("frequency"))
25992      res.setFrequency(parseTiming(json.getAsJsonObject("frequency")));
25993    if (json.has("lastPerformed"))
25994      res.setLastPerformedElement(parseDateTime(json.get("lastPerformed").getAsString()));
25995    if (json.has("_lastPerformed"))
25996      parseElementProperties(json.getAsJsonObject("_lastPerformed"), res.getLastPerformedElement());
25997    if (json.has("nextScheduled"))
25998      res.setNextScheduledElement(parseDate(json.get("nextScheduled").getAsString()));
25999    if (json.has("_nextScheduled"))
26000      parseElementProperties(json.getAsJsonObject("_nextScheduled"), res.getNextScheduledElement());
26001    if (json.has("failureAction"))
26002      res.setFailureAction(parseCodeableConcept(json.getAsJsonObject("failureAction")));
26003    if (json.has("primarySource")) {
26004      JsonArray array = json.getAsJsonArray("primarySource");
26005      for (int i = 0; i < array.size(); i++) {
26006        res.getPrimarySource().add(parseVerificationResultVerificationResultPrimarySourceComponent(array.get(i).getAsJsonObject(), res));
26007      }
26008    };
26009    if (json.has("attestation"))
26010      res.setAttestation(parseVerificationResultVerificationResultAttestationComponent(json.getAsJsonObject("attestation"), res));
26011    if (json.has("validator")) {
26012      JsonArray array = json.getAsJsonArray("validator");
26013      for (int i = 0; i < array.size(); i++) {
26014        res.getValidator().add(parseVerificationResultVerificationResultValidatorComponent(array.get(i).getAsJsonObject(), res));
26015      }
26016    };
26017  }
26018
26019  protected VerificationResult.VerificationResultPrimarySourceComponent parseVerificationResultVerificationResultPrimarySourceComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
26020    VerificationResult.VerificationResultPrimarySourceComponent res = new VerificationResult.VerificationResultPrimarySourceComponent();
26021    parseVerificationResultVerificationResultPrimarySourceComponentProperties(json, owner, res);
26022    return res;
26023  }
26024
26025  protected void parseVerificationResultVerificationResultPrimarySourceComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultPrimarySourceComponent res) throws IOException, FHIRFormatError {
26026    parseBackboneElementProperties(json, res);
26027    if (json.has("organization"))
26028      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
26029    if (json.has("type")) {
26030      JsonArray array = json.getAsJsonArray("type");
26031      for (int i = 0; i < array.size(); i++) {
26032        res.getType().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26033      }
26034    };
26035    if (json.has("validationProcess")) {
26036      JsonArray array = json.getAsJsonArray("validationProcess");
26037      for (int i = 0; i < array.size(); i++) {
26038        res.getValidationProcess().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26039      }
26040    };
26041    if (json.has("validationStatus"))
26042      res.setValidationStatus(parseCodeableConcept(json.getAsJsonObject("validationStatus")));
26043    if (json.has("validationDate"))
26044      res.setValidationDateElement(parseDateTime(json.get("validationDate").getAsString()));
26045    if (json.has("_validationDate"))
26046      parseElementProperties(json.getAsJsonObject("_validationDate"), res.getValidationDateElement());
26047    if (json.has("canPushUpdates"))
26048      res.setCanPushUpdates(parseCodeableConcept(json.getAsJsonObject("canPushUpdates")));
26049    if (json.has("pushTypeAvailable")) {
26050      JsonArray array = json.getAsJsonArray("pushTypeAvailable");
26051      for (int i = 0; i < array.size(); i++) {
26052        res.getPushTypeAvailable().add(parseCodeableConcept(array.get(i).getAsJsonObject()));
26053      }
26054    };
26055  }
26056
26057  protected VerificationResult.VerificationResultAttestationComponent parseVerificationResultVerificationResultAttestationComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
26058    VerificationResult.VerificationResultAttestationComponent res = new VerificationResult.VerificationResultAttestationComponent();
26059    parseVerificationResultVerificationResultAttestationComponentProperties(json, owner, res);
26060    return res;
26061  }
26062
26063  protected void parseVerificationResultVerificationResultAttestationComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultAttestationComponent res) throws IOException, FHIRFormatError {
26064    parseBackboneElementProperties(json, res);
26065    if (json.has("source"))
26066      res.setSource(parseReference(json.getAsJsonObject("source")));
26067    if (json.has("organization"))
26068      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
26069    if (json.has("method"))
26070      res.setMethod(parseCodeableConcept(json.getAsJsonObject("method")));
26071    if (json.has("date"))
26072      res.setDateElement(parseDate(json.get("date").getAsString()));
26073    if (json.has("_date"))
26074      parseElementProperties(json.getAsJsonObject("_date"), res.getDateElement());
26075    if (json.has("sourceIdentityCertificate"))
26076      res.setSourceIdentityCertificateElement(parseString(json.get("sourceIdentityCertificate").getAsString()));
26077    if (json.has("_sourceIdentityCertificate"))
26078      parseElementProperties(json.getAsJsonObject("_sourceIdentityCertificate"), res.getSourceIdentityCertificateElement());
26079    if (json.has("proxyIdentityCertificate"))
26080      res.setProxyIdentityCertificateElement(parseString(json.get("proxyIdentityCertificate").getAsString()));
26081    if (json.has("_proxyIdentityCertificate"))
26082      parseElementProperties(json.getAsJsonObject("_proxyIdentityCertificate"), res.getProxyIdentityCertificateElement());
26083    Type signedProxyRight = parseType("signedProxyRight", json);
26084    if (signedProxyRight != null)
26085      res.setSignedProxyRight(signedProxyRight);
26086    Type signedSourceAttestation = parseType("signedSourceAttestation", json);
26087    if (signedSourceAttestation != null)
26088      res.setSignedSourceAttestation(signedSourceAttestation);
26089  }
26090
26091  protected VerificationResult.VerificationResultValidatorComponent parseVerificationResultVerificationResultValidatorComponent(JsonObject json, VerificationResult owner) throws IOException, FHIRFormatError {
26092    VerificationResult.VerificationResultValidatorComponent res = new VerificationResult.VerificationResultValidatorComponent();
26093    parseVerificationResultVerificationResultValidatorComponentProperties(json, owner, res);
26094    return res;
26095  }
26096
26097  protected void parseVerificationResultVerificationResultValidatorComponentProperties(JsonObject json, VerificationResult owner, VerificationResult.VerificationResultValidatorComponent res) throws IOException, FHIRFormatError {
26098    parseBackboneElementProperties(json, res);
26099    if (json.has("organization"))
26100      res.setOrganization(parseReference(json.getAsJsonObject("organization")));
26101    if (json.has("identityCertificate"))
26102      res.setIdentityCertificateElement(parseString(json.get("identityCertificate").getAsString()));
26103    if (json.has("_identityCertificate"))
26104      parseElementProperties(json.getAsJsonObject("_identityCertificate"), res.getIdentityCertificateElement());
26105    Type signedValidatorAttestation = parseType("signedValidatorAttestation", json);
26106    if (signedValidatorAttestation != null)
26107      res.setSignedValidatorAttestation(signedValidatorAttestation);
26108  }
26109
26110  protected VisionPrescription parseVisionPrescription(JsonObject json) throws IOException, FHIRFormatError {
26111    VisionPrescription res = new VisionPrescription();
26112    parseVisionPrescriptionProperties(json, res);
26113    return res;
26114  }
26115
26116  protected void parseVisionPrescriptionProperties(JsonObject json, VisionPrescription res) throws IOException, FHIRFormatError {
26117    parseDomainResourceProperties(json, res);
26118    if (json.has("identifier")) {
26119      JsonArray array = json.getAsJsonArray("identifier");
26120      for (int i = 0; i < array.size(); i++) {
26121        res.getIdentifier().add(parseIdentifier(array.get(i).getAsJsonObject()));
26122      }
26123    };
26124    if (json.has("status"))
26125      res.setStatusElement(parseEnumeration(json.get("status").getAsString(), VisionPrescription.VisionStatus.NULL, new VisionPrescription.VisionStatusEnumFactory()));
26126    if (json.has("_status"))
26127      parseElementProperties(json.getAsJsonObject("_status"), res.getStatusElement());
26128    if (json.has("patient"))
26129      res.setPatient(parseReference(json.getAsJsonObject("patient")));
26130    if (json.has("encounter"))
26131      res.setEncounter(parseReference(json.getAsJsonObject("encounter")));
26132    if (json.has("dateWritten"))
26133      res.setDateWrittenElement(parseDateTime(json.get("dateWritten").getAsString()));
26134    if (json.has("_dateWritten"))
26135      parseElementProperties(json.getAsJsonObject("_dateWritten"), res.getDateWrittenElement());
26136    if (json.has("prescriber"))
26137      res.setPrescriber(parseReference(json.getAsJsonObject("prescriber")));
26138    Type reason = parseType("reason", json);
26139    if (reason != null)
26140      res.setReason(reason);
26141    if (json.has("dispense")) {
26142      JsonArray array = json.getAsJsonArray("dispense");
26143      for (int i = 0; i < array.size(); i++) {
26144        res.getDispense().add(parseVisionPrescriptionVisionPrescriptionDispenseComponent(array.get(i).getAsJsonObject(), res));
26145      }
26146    };
26147  }
26148
26149  protected VisionPrescription.VisionPrescriptionDispenseComponent parseVisionPrescriptionVisionPrescriptionDispenseComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
26150    VisionPrescription.VisionPrescriptionDispenseComponent res = new VisionPrescription.VisionPrescriptionDispenseComponent();
26151    parseVisionPrescriptionVisionPrescriptionDispenseComponentProperties(json, owner, res);
26152    return res;
26153  }
26154
26155  protected void parseVisionPrescriptionVisionPrescriptionDispenseComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.VisionPrescriptionDispenseComponent res) throws IOException, FHIRFormatError {
26156    parseBackboneElementProperties(json, res);
26157    if (json.has("product"))
26158      res.setProduct(parseCodeableConcept(json.getAsJsonObject("product")));
26159    if (json.has("eye"))
26160      res.setEyeElement(parseEnumeration(json.get("eye").getAsString(), VisionPrescription.VisionEyes.NULL, new VisionPrescription.VisionEyesEnumFactory()));
26161    if (json.has("_eye"))
26162      parseElementProperties(json.getAsJsonObject("_eye"), res.getEyeElement());
26163    if (json.has("sphere"))
26164      res.setSphereElement(parseDecimal(json.get("sphere").getAsBigDecimal()));
26165    if (json.has("_sphere"))
26166      parseElementProperties(json.getAsJsonObject("_sphere"), res.getSphereElement());
26167    if (json.has("cylinder"))
26168      res.setCylinderElement(parseDecimal(json.get("cylinder").getAsBigDecimal()));
26169    if (json.has("_cylinder"))
26170      parseElementProperties(json.getAsJsonObject("_cylinder"), res.getCylinderElement());
26171    if (json.has("axis"))
26172      res.setAxisElement(parseInteger(json.get("axis").getAsLong()));
26173    if (json.has("_axis"))
26174      parseElementProperties(json.getAsJsonObject("_axis"), res.getAxisElement());
26175    if (json.has("prism")) {
26176      JsonArray array = json.getAsJsonArray("prism");
26177      for (int i = 0; i < array.size(); i++) {
26178        res.getPrism().add(parseVisionPrescriptionPrismComponent(array.get(i).getAsJsonObject(), owner));
26179      }
26180    };
26181    if (json.has("add"))
26182      res.setAddElement(parseDecimal(json.get("add").getAsBigDecimal()));
26183    if (json.has("_add"))
26184      parseElementProperties(json.getAsJsonObject("_add"), res.getAddElement());
26185    if (json.has("power"))
26186      res.setPowerElement(parseDecimal(json.get("power").getAsBigDecimal()));
26187    if (json.has("_power"))
26188      parseElementProperties(json.getAsJsonObject("_power"), res.getPowerElement());
26189    if (json.has("backCurve"))
26190      res.setBackCurveElement(parseDecimal(json.get("backCurve").getAsBigDecimal()));
26191    if (json.has("_backCurve"))
26192      parseElementProperties(json.getAsJsonObject("_backCurve"), res.getBackCurveElement());
26193    if (json.has("diameter"))
26194      res.setDiameterElement(parseDecimal(json.get("diameter").getAsBigDecimal()));
26195    if (json.has("_diameter"))
26196      parseElementProperties(json.getAsJsonObject("_diameter"), res.getDiameterElement());
26197    if (json.has("duration"))
26198      res.setDuration(parseQuantity(json.getAsJsonObject("duration")));
26199    if (json.has("color"))
26200      res.setColorElement(parseString(json.get("color").getAsString()));
26201    if (json.has("_color"))
26202      parseElementProperties(json.getAsJsonObject("_color"), res.getColorElement());
26203    if (json.has("brand"))
26204      res.setBrandElement(parseString(json.get("brand").getAsString()));
26205    if (json.has("_brand"))
26206      parseElementProperties(json.getAsJsonObject("_brand"), res.getBrandElement());
26207    if (json.has("note")) {
26208      JsonArray array = json.getAsJsonArray("note");
26209      for (int i = 0; i < array.size(); i++) {
26210        res.getNote().add(parseAnnotation(array.get(i).getAsJsonObject()));
26211      }
26212    };
26213  }
26214
26215  protected VisionPrescription.PrismComponent parseVisionPrescriptionPrismComponent(JsonObject json, VisionPrescription owner) throws IOException, FHIRFormatError {
26216    VisionPrescription.PrismComponent res = new VisionPrescription.PrismComponent();
26217    parseVisionPrescriptionPrismComponentProperties(json, owner, res);
26218    return res;
26219  }
26220
26221  protected void parseVisionPrescriptionPrismComponentProperties(JsonObject json, VisionPrescription owner, VisionPrescription.PrismComponent res) throws IOException, FHIRFormatError {
26222    parseBackboneElementProperties(json, res);
26223    if (json.has("amount"))
26224      res.setAmountElement(parseDecimal(json.get("amount").getAsBigDecimal()));
26225    if (json.has("_amount"))
26226      parseElementProperties(json.getAsJsonObject("_amount"), res.getAmountElement());
26227    if (json.has("base"))
26228      res.setBaseElement(parseEnumeration(json.get("base").getAsString(), VisionPrescription.VisionBase.NULL, new VisionPrescription.VisionBaseEnumFactory()));
26229    if (json.has("_base"))
26230      parseElementProperties(json.getAsJsonObject("_base"), res.getBaseElement());
26231  }
26232
26233  @Override
26234  protected Resource parseResource(JsonObject json) throws IOException, FHIRFormatError {
26235    String t = json.get("resourceType").getAsString();
26236    if (Utilities.noString(t))
26237      throw new FHIRFormatError("Unable to find resource type - maybe not a FHIR resource?");
26238    if (t.equals("Parameters"))
26239      return parseParameters(json);
26240    else if (t.equals("Account"))
26241      return parseAccount(json);
26242    else if (t.equals("ActivityDefinition"))
26243      return parseActivityDefinition(json);
26244    else if (t.equals("AdverseEvent"))
26245      return parseAdverseEvent(json);
26246    else if (t.equals("AllergyIntolerance"))
26247      return parseAllergyIntolerance(json);
26248    else if (t.equals("Appointment"))
26249      return parseAppointment(json);
26250    else if (t.equals("AppointmentResponse"))
26251      return parseAppointmentResponse(json);
26252    else if (t.equals("AuditEvent"))
26253      return parseAuditEvent(json);
26254    else if (t.equals("Basic"))
26255      return parseBasic(json);
26256    else if (t.equals("Binary"))
26257      return parseBinary(json);
26258    else if (t.equals("BiologicallyDerivedProduct"))
26259      return parseBiologicallyDerivedProduct(json);
26260    else if (t.equals("BodyStructure"))
26261      return parseBodyStructure(json);
26262    else if (t.equals("Bundle"))
26263      return parseBundle(json);
26264    else if (t.equals("CapabilityStatement"))
26265      return parseCapabilityStatement(json);
26266    else if (t.equals("CarePlan"))
26267      return parseCarePlan(json);
26268    else if (t.equals("CareTeam"))
26269      return parseCareTeam(json);
26270    else if (t.equals("CatalogEntry"))
26271      return parseCatalogEntry(json);
26272    else if (t.equals("ChargeItem"))
26273      return parseChargeItem(json);
26274    else if (t.equals("ChargeItemDefinition"))
26275      return parseChargeItemDefinition(json);
26276    else if (t.equals("Claim"))
26277      return parseClaim(json);
26278    else if (t.equals("ClaimResponse"))
26279      return parseClaimResponse(json);
26280    else if (t.equals("ClinicalImpression"))
26281      return parseClinicalImpression(json);
26282    else if (t.equals("CodeSystem"))
26283      return parseCodeSystem(json);
26284    else if (t.equals("Communication"))
26285      return parseCommunication(json);
26286    else if (t.equals("CommunicationRequest"))
26287      return parseCommunicationRequest(json);
26288    else if (t.equals("CompartmentDefinition"))
26289      return parseCompartmentDefinition(json);
26290    else if (t.equals("Composition"))
26291      return parseComposition(json);
26292    else if (t.equals("ConceptMap"))
26293      return parseConceptMap(json);
26294    else if (t.equals("Condition"))
26295      return parseCondition(json);
26296    else if (t.equals("Consent"))
26297      return parseConsent(json);
26298    else if (t.equals("Contract"))
26299      return parseContract(json);
26300    else if (t.equals("Coverage"))
26301      return parseCoverage(json);
26302    else if (t.equals("CoverageEligibilityRequest"))
26303      return parseCoverageEligibilityRequest(json);
26304    else if (t.equals("CoverageEligibilityResponse"))
26305      return parseCoverageEligibilityResponse(json);
26306    else if (t.equals("DetectedIssue"))
26307      return parseDetectedIssue(json);
26308    else if (t.equals("Device"))
26309      return parseDevice(json);
26310    else if (t.equals("DeviceDefinition"))
26311      return parseDeviceDefinition(json);
26312    else if (t.equals("DeviceMetric"))
26313      return parseDeviceMetric(json);
26314    else if (t.equals("DeviceRequest"))
26315      return parseDeviceRequest(json);
26316    else if (t.equals("DeviceUseStatement"))
26317      return parseDeviceUseStatement(json);
26318    else if (t.equals("DiagnosticReport"))
26319      return parseDiagnosticReport(json);
26320    else if (t.equals("DocumentManifest"))
26321      return parseDocumentManifest(json);
26322    else if (t.equals("DocumentReference"))
26323      return parseDocumentReference(json);
26324    else if (t.equals("Encounter"))
26325      return parseEncounter(json);
26326    else if (t.equals("Endpoint"))
26327      return parseEndpoint(json);
26328    else if (t.equals("EnrollmentRequest"))
26329      return parseEnrollmentRequest(json);
26330    else if (t.equals("EnrollmentResponse"))
26331      return parseEnrollmentResponse(json);
26332    else if (t.equals("EpisodeOfCare"))
26333      return parseEpisodeOfCare(json);
26334    else if (t.equals("EventDefinition"))
26335      return parseEventDefinition(json);
26336    else if (t.equals("ExampleScenario"))
26337      return parseExampleScenario(json);
26338    else if (t.equals("ExplanationOfBenefit"))
26339      return parseExplanationOfBenefit(json);
26340    else if (t.equals("FamilyMemberHistory"))
26341      return parseFamilyMemberHistory(json);
26342    else if (t.equals("Flag"))
26343      return parseFlag(json);
26344    else if (t.equals("Goal"))
26345      return parseGoal(json);
26346    else if (t.equals("GraphDefinition"))
26347      return parseGraphDefinition(json);
26348    else if (t.equals("Group"))
26349      return parseGroup(json);
26350    else if (t.equals("GuidanceResponse"))
26351      return parseGuidanceResponse(json);
26352    else if (t.equals("HealthcareService"))
26353      return parseHealthcareService(json);
26354    else if (t.equals("ImagingStudy"))
26355      return parseImagingStudy(json);
26356    else if (t.equals("Immunization"))
26357      return parseImmunization(json);
26358    else if (t.equals("ImmunizationEvaluation"))
26359      return parseImmunizationEvaluation(json);
26360    else if (t.equals("ImmunizationRecommendation"))
26361      return parseImmunizationRecommendation(json);
26362    else if (t.equals("ImplementationGuide"))
26363      return parseImplementationGuide(json);
26364    else if (t.equals("InsurancePlan"))
26365      return parseInsurancePlan(json);
26366    else if (t.equals("Invoice"))
26367      return parseInvoice(json);
26368    else if (t.equals("ItemInstance"))
26369      return parseItemInstance(json);
26370    else if (t.equals("Library"))
26371      return parseLibrary(json);
26372    else if (t.equals("Linkage"))
26373      return parseLinkage(json);
26374    else if (t.equals("List"))
26375      return parseListResource(json);
26376    else if (t.equals("Location"))
26377      return parseLocation(json);
26378    else if (t.equals("Measure"))
26379      return parseMeasure(json);
26380    else if (t.equals("MeasureReport"))
26381      return parseMeasureReport(json);
26382    else if (t.equals("Media"))
26383      return parseMedia(json);
26384    else if (t.equals("Medication"))
26385      return parseMedication(json);
26386    else if (t.equals("MedicationAdministration"))
26387      return parseMedicationAdministration(json);
26388    else if (t.equals("MedicationDispense"))
26389      return parseMedicationDispense(json);
26390    else if (t.equals("MedicationKnowledge"))
26391      return parseMedicationKnowledge(json);
26392    else if (t.equals("MedicationRequest"))
26393      return parseMedicationRequest(json);
26394    else if (t.equals("MedicationStatement"))
26395      return parseMedicationStatement(json);
26396    else if (t.equals("MedicinalProduct"))
26397      return parseMedicinalProduct(json);
26398    else if (t.equals("MedicinalProductAuthorization"))
26399      return parseMedicinalProductAuthorization(json);
26400    else if (t.equals("MedicinalProductClinicals"))
26401      return parseMedicinalProductClinicals(json);
26402    else if (t.equals("MedicinalProductContraindication"))
26403      return parseMedicinalProductContraindication(json);
26404    else if (t.equals("MedicinalProductDeviceSpec"))
26405      return parseMedicinalProductDeviceSpec(json);
26406    else if (t.equals("MedicinalProductIndication"))
26407      return parseMedicinalProductIndication(json);
26408    else if (t.equals("MedicinalProductIngredient"))
26409      return parseMedicinalProductIngredient(json);
26410    else if (t.equals("MedicinalProductInteraction"))
26411      return parseMedicinalProductInteraction(json);
26412    else if (t.equals("MedicinalProductManufactured"))
26413      return parseMedicinalProductManufactured(json);
26414    else if (t.equals("MedicinalProductPackaged"))
26415      return parseMedicinalProductPackaged(json);
26416    else if (t.equals("MedicinalProductPharmaceutical"))
26417      return parseMedicinalProductPharmaceutical(json);
26418    else if (t.equals("MedicinalProductUndesirableEffect"))
26419      return parseMedicinalProductUndesirableEffect(json);
26420    else if (t.equals("MessageDefinition"))
26421      return parseMessageDefinition(json);
26422    else if (t.equals("MessageHeader"))
26423      return parseMessageHeader(json);
26424    else if (t.equals("NamingSystem"))
26425      return parseNamingSystem(json);
26426    else if (t.equals("NutritionOrder"))
26427      return parseNutritionOrder(json);
26428    else if (t.equals("Observation"))
26429      return parseObservation(json);
26430    else if (t.equals("ObservationDefinition"))
26431      return parseObservationDefinition(json);
26432    else if (t.equals("OperationDefinition"))
26433      return parseOperationDefinition(json);
26434    else if (t.equals("OperationOutcome"))
26435      return parseOperationOutcome(json);
26436    else if (t.equals("Organization"))
26437      return parseOrganization(json);
26438    else if (t.equals("OrganizationAffiliation"))
26439      return parseOrganizationAffiliation(json);
26440    else if (t.equals("Patient"))
26441      return parsePatient(json);
26442    else if (t.equals("PaymentNotice"))
26443      return parsePaymentNotice(json);
26444    else if (t.equals("PaymentReconciliation"))
26445      return parsePaymentReconciliation(json);
26446    else if (t.equals("Person"))
26447      return parsePerson(json);
26448    else if (t.equals("PlanDefinition"))
26449      return parsePlanDefinition(json);
26450    else if (t.equals("Practitioner"))
26451      return parsePractitioner(json);
26452    else if (t.equals("PractitionerRole"))
26453      return parsePractitionerRole(json);
26454    else if (t.equals("Procedure"))
26455      return parseProcedure(json);
26456    else if (t.equals("ProcessRequest"))
26457      return parseProcessRequest(json);
26458    else if (t.equals("ProcessResponse"))
26459      return parseProcessResponse(json);
26460    else if (t.equals("Provenance"))
26461      return parseProvenance(json);
26462    else if (t.equals("Questionnaire"))
26463      return parseQuestionnaire(json);
26464    else if (t.equals("QuestionnaireResponse"))
26465      return parseQuestionnaireResponse(json);
26466    else if (t.equals("RelatedPerson"))
26467      return parseRelatedPerson(json);
26468    else if (t.equals("RequestGroup"))
26469      return parseRequestGroup(json);
26470    else if (t.equals("ResearchStudy"))
26471      return parseResearchStudy(json);
26472    else if (t.equals("ResearchSubject"))
26473      return parseResearchSubject(json);
26474    else if (t.equals("RiskAssessment"))
26475      return parseRiskAssessment(json);
26476    else if (t.equals("Schedule"))
26477      return parseSchedule(json);
26478    else if (t.equals("SearchParameter"))
26479      return parseSearchParameter(json);
26480    else if (t.equals("Sequence"))
26481      return parseSequence(json);
26482    else if (t.equals("ServiceRequest"))
26483      return parseServiceRequest(json);
26484    else if (t.equals("Slot"))
26485      return parseSlot(json);
26486    else if (t.equals("Specimen"))
26487      return parseSpecimen(json);
26488    else if (t.equals("SpecimenDefinition"))
26489      return parseSpecimenDefinition(json);
26490    else if (t.equals("StructureDefinition"))
26491      return parseStructureDefinition(json);
26492    else if (t.equals("StructureMap"))
26493      return parseStructureMap(json);
26494    else if (t.equals("Subscription"))
26495      return parseSubscription(json);
26496    else if (t.equals("Substance"))
26497      return parseSubstance(json);
26498    else if (t.equals("SubstancePolymer"))
26499      return parseSubstancePolymer(json);
26500    else if (t.equals("SubstanceReferenceInformation"))
26501      return parseSubstanceReferenceInformation(json);
26502    else if (t.equals("SubstanceSpecification"))
26503      return parseSubstanceSpecification(json);
26504    else if (t.equals("SupplyDelivery"))
26505      return parseSupplyDelivery(json);
26506    else if (t.equals("SupplyRequest"))
26507      return parseSupplyRequest(json);
26508    else if (t.equals("Task"))
26509      return parseTask(json);
26510    else if (t.equals("TerminologyCapabilities"))
26511      return parseTerminologyCapabilities(json);
26512    else if (t.equals("TestReport"))
26513      return parseTestReport(json);
26514    else if (t.equals("TestScript"))
26515      return parseTestScript(json);
26516    else if (t.equals("UserSession"))
26517      return parseUserSession(json);
26518    else if (t.equals("ValueSet"))
26519      return parseValueSet(json);
26520    else if (t.equals("VerificationResult"))
26521      return parseVerificationResult(json);
26522    else if (t.equals("VisionPrescription"))
26523      return parseVisionPrescription(json);
26524    else if (t.equals("Binary"))
26525      return parseBinary(json);
26526    throw new FHIRFormatError("Unknown.Unrecognised resource type '"+t+"' (in property 'resourceType')");
26527  }
26528
26529  protected Type parseType(String prefix, JsonObject json) throws IOException, FHIRFormatError {
26530    if (json.has(prefix+"Extension"))
26531      return parseExtension(json.getAsJsonObject(prefix+"Extension"));
26532    else if (json.has(prefix+"Narrative"))
26533      return parseNarrative(json.getAsJsonObject(prefix+"Narrative"));
26534    else if (json.has(prefix+"Meta"))
26535      return parseMeta(json.getAsJsonObject(prefix+"Meta"));
26536    else if (json.has(prefix+"Address"))
26537      return parseAddress(json.getAsJsonObject(prefix+"Address"));
26538    else if (json.has(prefix+"Contributor"))
26539      return parseContributor(json.getAsJsonObject(prefix+"Contributor"));
26540    else if (json.has(prefix+"Attachment"))
26541      return parseAttachment(json.getAsJsonObject(prefix+"Attachment"));
26542    else if (json.has(prefix+"Count"))
26543      return parseCount(json.getAsJsonObject(prefix+"Count"));
26544    else if (json.has(prefix+"DataRequirement"))
26545      return parseDataRequirement(json.getAsJsonObject(prefix+"DataRequirement"));
26546    else if (json.has(prefix+"Dosage"))
26547      return parseDosage(json.getAsJsonObject(prefix+"Dosage"));
26548    else if (json.has(prefix+"Money"))
26549      return parseMoney(json.getAsJsonObject(prefix+"Money"));
26550    else if (json.has(prefix+"HumanName"))
26551      return parseHumanName(json.getAsJsonObject(prefix+"HumanName"));
26552    else if (json.has(prefix+"ContactPoint"))
26553      return parseContactPoint(json.getAsJsonObject(prefix+"ContactPoint"));
26554    else if (json.has(prefix+"Identifier"))
26555      return parseIdentifier(json.getAsJsonObject(prefix+"Identifier"));
26556    else if (json.has(prefix+"Coding"))
26557      return parseCoding(json.getAsJsonObject(prefix+"Coding"));
26558    else if (json.has(prefix+"SampledData"))
26559      return parseSampledData(json.getAsJsonObject(prefix+"SampledData"));
26560    else if (json.has(prefix+"Ratio"))
26561      return parseRatio(json.getAsJsonObject(prefix+"Ratio"));
26562    else if (json.has(prefix+"Distance"))
26563      return parseDistance(json.getAsJsonObject(prefix+"Distance"));
26564    else if (json.has(prefix+"Age"))
26565      return parseAge(json.getAsJsonObject(prefix+"Age"));
26566    else if (json.has(prefix+"Reference"))
26567      return parseReference(json.getAsJsonObject(prefix+"Reference"));
26568    else if (json.has(prefix+"TriggerDefinition"))
26569      return parseTriggerDefinition(json.getAsJsonObject(prefix+"TriggerDefinition"));
26570    else if (json.has(prefix+"Quantity"))
26571      return parseQuantity(json.getAsJsonObject(prefix+"Quantity"));
26572    else if (json.has(prefix+"Period"))
26573      return parsePeriod(json.getAsJsonObject(prefix+"Period"));
26574    else if (json.has(prefix+"Duration"))
26575      return parseDuration(json.getAsJsonObject(prefix+"Duration"));
26576    else if (json.has(prefix+"Range"))
26577      return parseRange(json.getAsJsonObject(prefix+"Range"));
26578    else if (json.has(prefix+"RelatedArtifact"))
26579      return parseRelatedArtifact(json.getAsJsonObject(prefix+"RelatedArtifact"));
26580    else if (json.has(prefix+"Annotation"))
26581      return parseAnnotation(json.getAsJsonObject(prefix+"Annotation"));
26582    else if (json.has(prefix+"ContactDetail"))
26583      return parseContactDetail(json.getAsJsonObject(prefix+"ContactDetail"));
26584    else if (json.has(prefix+"UsageContext"))
26585      return parseUsageContext(json.getAsJsonObject(prefix+"UsageContext"));
26586    else if (json.has(prefix+"Expression"))
26587      return parseExpression(json.getAsJsonObject(prefix+"Expression"));
26588    else if (json.has(prefix+"Signature"))
26589      return parseSignature(json.getAsJsonObject(prefix+"Signature"));
26590    else if (json.has(prefix+"Timing"))
26591      return parseTiming(json.getAsJsonObject(prefix+"Timing"));
26592    else if (json.has(prefix+"CodeableConcept"))
26593      return parseCodeableConcept(json.getAsJsonObject(prefix+"CodeableConcept"));
26594    else if (json.has(prefix+"ParameterDefinition"))
26595      return parseParameterDefinition(json.getAsJsonObject(prefix+"ParameterDefinition"));
26596    else if (json.has(prefix+"Date") || json.has("_"+prefix+"Date")) {
26597      Type t = json.has(prefix+"Date") ? parseDate(json.get(prefix+"Date").getAsString()) : new DateType();
26598      if (json.has("_"+prefix+"Date"))
26599        parseElementProperties(json.getAsJsonObject("_"+prefix+"Date"), t);
26600      return t;
26601    }
26602    else if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime")) {
26603      Type t = json.has(prefix+"DateTime") ? parseDateTime(json.get(prefix+"DateTime").getAsString()) : new DateTimeType();
26604      if (json.has("_"+prefix+"DateTime"))
26605        parseElementProperties(json.getAsJsonObject("_"+prefix+"DateTime"), t);
26606      return t;
26607    }
26608    else if (json.has(prefix+"Code") || json.has("_"+prefix+"Code")) {
26609      Type t = json.has(prefix+"Code") ? parseCode(json.get(prefix+"Code").getAsString()) : new CodeType();
26610      if (json.has("_"+prefix+"Code"))
26611        parseElementProperties(json.getAsJsonObject("_"+prefix+"Code"), t);
26612      return t;
26613    }
26614    else if (json.has(prefix+"String") || json.has("_"+prefix+"String")) {
26615      Type t = json.has(prefix+"String") ? parseString(json.get(prefix+"String").getAsString()) : new StringType();
26616      if (json.has("_"+prefix+"String"))
26617        parseElementProperties(json.getAsJsonObject("_"+prefix+"String"), t);
26618      return t;
26619    }
26620    else if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer")) {
26621      Type t = json.has(prefix+"Integer") ? parseInteger(json.get(prefix+"Integer").getAsLong()) : new IntegerType();
26622      if (json.has("_"+prefix+"Integer"))
26623        parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
26624      return t;
26625    }
26626    else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
26627      Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
26628      if (json.has("_"+prefix+"Oid"))
26629        parseElementProperties(json.getAsJsonObject("_"+prefix+"Oid"), t);
26630      return t;
26631    }
26632    else if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical")) {
26633      Type t = json.has(prefix+"Canonical") ? parseCanonical(json.get(prefix+"Canonical").getAsString()) : new CanonicalType();
26634      if (json.has("_"+prefix+"Canonical"))
26635        parseElementProperties(json.getAsJsonObject("_"+prefix+"Canonical"), t);
26636      return t;
26637    }
26638    else if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri")) {
26639      Type t = json.has(prefix+"Uri") ? parseUri(json.get(prefix+"Uri").getAsString()) : new UriType();
26640      if (json.has("_"+prefix+"Uri"))
26641        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uri"), t);
26642      return t;
26643    }
26644    else if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid")) {
26645      Type t = json.has(prefix+"Uuid") ? parseUuid(json.get(prefix+"Uuid").getAsString()) : new UuidType();
26646      if (json.has("_"+prefix+"Uuid"))
26647        parseElementProperties(json.getAsJsonObject("_"+prefix+"Uuid"), t);
26648      return t;
26649    }
26650    else if (json.has(prefix+"Url") || json.has("_"+prefix+"Url")) {
26651      Type t = json.has(prefix+"Url") ? parseUrl(json.get(prefix+"Url").getAsString()) : new UrlType();
26652      if (json.has("_"+prefix+"Url"))
26653        parseElementProperties(json.getAsJsonObject("_"+prefix+"Url"), t);
26654      return t;
26655    }
26656    else if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant")) {
26657      Type t = json.has(prefix+"Instant") ? parseInstant(json.get(prefix+"Instant").getAsString()) : new InstantType();
26658      if (json.has("_"+prefix+"Instant"))
26659        parseElementProperties(json.getAsJsonObject("_"+prefix+"Instant"), t);
26660      return t;
26661    }
26662    else if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean")) {
26663      Type t = json.has(prefix+"Boolean") ? parseBoolean(json.get(prefix+"Boolean").getAsBoolean()) : new BooleanType();
26664      if (json.has("_"+prefix+"Boolean"))
26665        parseElementProperties(json.getAsJsonObject("_"+prefix+"Boolean"), t);
26666      return t;
26667    }
26668    else if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary")) {
26669      Type t = json.has(prefix+"Base64Binary") ? parseBase64Binary(json.get(prefix+"Base64Binary").getAsString()) : new Base64BinaryType();
26670      if (json.has("_"+prefix+"Base64Binary"))
26671        parseElementProperties(json.getAsJsonObject("_"+prefix+"Base64Binary"), t);
26672      return t;
26673    }
26674    else if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt")) {
26675      Type t = json.has(prefix+"UnsignedInt") ? parseUnsignedInt(json.get(prefix+"UnsignedInt").getAsString()) : new UnsignedIntType();
26676      if (json.has("_"+prefix+"UnsignedInt"))
26677        parseElementProperties(json.getAsJsonObject("_"+prefix+"UnsignedInt"), t);
26678      return t;
26679    }
26680    else if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown")) {
26681      Type t = json.has(prefix+"Markdown") ? parseMarkdown(json.get(prefix+"Markdown").getAsString()) : new MarkdownType();
26682      if (json.has("_"+prefix+"Markdown"))
26683        parseElementProperties(json.getAsJsonObject("_"+prefix+"Markdown"), t);
26684      return t;
26685    }
26686    else if (json.has(prefix+"Time") || json.has("_"+prefix+"Time")) {
26687      Type t = json.has(prefix+"Time") ? parseTime(json.get(prefix+"Time").getAsString()) : new TimeType();
26688      if (json.has("_"+prefix+"Time"))
26689        parseElementProperties(json.getAsJsonObject("_"+prefix+"Time"), t);
26690      return t;
26691    }
26692    else if (json.has(prefix+"Id") || json.has("_"+prefix+"Id")) {
26693      Type t = json.has(prefix+"Id") ? parseId(json.get(prefix+"Id").getAsString()) : new IdType();
26694      if (json.has("_"+prefix+"Id"))
26695        parseElementProperties(json.getAsJsonObject("_"+prefix+"Id"), t);
26696      return t;
26697    }
26698    else if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt")) {
26699      Type t = json.has(prefix+"PositiveInt") ? parsePositiveInt(json.get(prefix+"PositiveInt").getAsString()) : new PositiveIntType();
26700      if (json.has("_"+prefix+"PositiveInt"))
26701        parseElementProperties(json.getAsJsonObject("_"+prefix+"PositiveInt"), t);
26702      return t;
26703    }
26704    else if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal")) {
26705      Type t = json.has(prefix+"Decimal") ? parseDecimal(json.get(prefix+"Decimal").getAsBigDecimal()) : new DecimalType();
26706      if (json.has("_"+prefix+"Decimal"))
26707        parseElementProperties(json.getAsJsonObject("_"+prefix+"Decimal"), t);
26708      return t;
26709    }
26710    return null;
26711  }
26712
26713  protected Type parseType(JsonObject json, String type) throws IOException, FHIRFormatError {
26714    if (type.equals("Extension"))
26715      return parseExtension(json);
26716    else if (type.equals("Narrative"))
26717      return parseNarrative(json);
26718    else if (type.equals("Meta"))
26719      return parseMeta(json);
26720    else if (type.equals("Address"))
26721      return parseAddress(json);
26722    else if (type.equals("Contributor"))
26723      return parseContributor(json);
26724    else if (type.equals("Attachment"))
26725      return parseAttachment(json);
26726    else if (type.equals("Count"))
26727      return parseCount(json);
26728    else if (type.equals("DataRequirement"))
26729      return parseDataRequirement(json);
26730    else if (type.equals("Dosage"))
26731      return parseDosage(json);
26732    else if (type.equals("Money"))
26733      return parseMoney(json);
26734    else if (type.equals("HumanName"))
26735      return parseHumanName(json);
26736    else if (type.equals("ContactPoint"))
26737      return parseContactPoint(json);
26738    else if (type.equals("Identifier"))
26739      return parseIdentifier(json);
26740    else if (type.equals("Coding"))
26741      return parseCoding(json);
26742    else if (type.equals("SampledData"))
26743      return parseSampledData(json);
26744    else if (type.equals("Ratio"))
26745      return parseRatio(json);
26746    else if (type.equals("Distance"))
26747      return parseDistance(json);
26748    else if (type.equals("Age"))
26749      return parseAge(json);
26750    else if (type.equals("Reference"))
26751      return parseReference(json);
26752    else if (type.equals("TriggerDefinition"))
26753      return parseTriggerDefinition(json);
26754    else if (type.equals("Quantity"))
26755      return parseQuantity(json);
26756    else if (type.equals("Period"))
26757      return parsePeriod(json);
26758    else if (type.equals("Duration"))
26759      return parseDuration(json);
26760    else if (type.equals("Range"))
26761      return parseRange(json);
26762    else if (type.equals("RelatedArtifact"))
26763      return parseRelatedArtifact(json);
26764    else if (type.equals("Annotation"))
26765      return parseAnnotation(json);
26766    else if (type.equals("ContactDetail"))
26767      return parseContactDetail(json);
26768    else if (type.equals("UsageContext"))
26769      return parseUsageContext(json);
26770    else if (type.equals("Expression"))
26771      return parseExpression(json);
26772    else if (type.equals("Signature"))
26773      return parseSignature(json);
26774    else if (type.equals("Timing"))
26775      return parseTiming(json);
26776    else if (type.equals("CodeableConcept"))
26777      return parseCodeableConcept(json);
26778    else if (type.equals("ParameterDefinition"))
26779      return parseParameterDefinition(json);
26780    throw new FHIRFormatError("Unknown Type "+type);
26781  }
26782
26783  protected boolean hasTypeName(JsonObject json, String prefix) {
26784        if (json.has(prefix+"Extension"))
26785      return true;
26786    if (json.has(prefix+"Narrative"))
26787      return true;
26788    if (json.has(prefix+"Meta"))
26789      return true;
26790    if (json.has(prefix+"Address"))
26791      return true;
26792    if (json.has(prefix+"Contributor"))
26793      return true;
26794    if (json.has(prefix+"Attachment"))
26795      return true;
26796    if (json.has(prefix+"Count"))
26797      return true;
26798    if (json.has(prefix+"DataRequirement"))
26799      return true;
26800    if (json.has(prefix+"Dosage"))
26801      return true;
26802    if (json.has(prefix+"Money"))
26803      return true;
26804    if (json.has(prefix+"HumanName"))
26805      return true;
26806    if (json.has(prefix+"ContactPoint"))
26807      return true;
26808    if (json.has(prefix+"Identifier"))
26809      return true;
26810    if (json.has(prefix+"Coding"))
26811      return true;
26812    if (json.has(prefix+"SampledData"))
26813      return true;
26814    if (json.has(prefix+"Ratio"))
26815      return true;
26816    if (json.has(prefix+"Distance"))
26817      return true;
26818    if (json.has(prefix+"Age"))
26819      return true;
26820    if (json.has(prefix+"Reference"))
26821      return true;
26822    if (json.has(prefix+"TriggerDefinition"))
26823      return true;
26824    if (json.has(prefix+"Quantity"))
26825      return true;
26826    if (json.has(prefix+"Period"))
26827      return true;
26828    if (json.has(prefix+"Duration"))
26829      return true;
26830    if (json.has(prefix+"Range"))
26831      return true;
26832    if (json.has(prefix+"RelatedArtifact"))
26833      return true;
26834    if (json.has(prefix+"Annotation"))
26835      return true;
26836    if (json.has(prefix+"ContactDetail"))
26837      return true;
26838    if (json.has(prefix+"UsageContext"))
26839      return true;
26840    if (json.has(prefix+"Expression"))
26841      return true;
26842    if (json.has(prefix+"Signature"))
26843      return true;
26844    if (json.has(prefix+"Timing"))
26845      return true;
26846    if (json.has(prefix+"CodeableConcept"))
26847      return true;
26848    if (json.has(prefix+"ParameterDefinition"))
26849      return true;
26850    if (json.has(prefix+"Parameters"))
26851      return true;
26852    if (json.has(prefix+"Account"))
26853      return true;
26854    if (json.has(prefix+"ActivityDefinition"))
26855      return true;
26856    if (json.has(prefix+"AdverseEvent"))
26857      return true;
26858    if (json.has(prefix+"AllergyIntolerance"))
26859      return true;
26860    if (json.has(prefix+"Appointment"))
26861      return true;
26862    if (json.has(prefix+"AppointmentResponse"))
26863      return true;
26864    if (json.has(prefix+"AuditEvent"))
26865      return true;
26866    if (json.has(prefix+"Basic"))
26867      return true;
26868    if (json.has(prefix+"Binary"))
26869      return true;
26870    if (json.has(prefix+"BiologicallyDerivedProduct"))
26871      return true;
26872    if (json.has(prefix+"BodyStructure"))
26873      return true;
26874    if (json.has(prefix+"Bundle"))
26875      return true;
26876    if (json.has(prefix+"CapabilityStatement"))
26877      return true;
26878    if (json.has(prefix+"CarePlan"))
26879      return true;
26880    if (json.has(prefix+"CareTeam"))
26881      return true;
26882    if (json.has(prefix+"CatalogEntry"))
26883      return true;
26884    if (json.has(prefix+"ChargeItem"))
26885      return true;
26886    if (json.has(prefix+"ChargeItemDefinition"))
26887      return true;
26888    if (json.has(prefix+"Claim"))
26889      return true;
26890    if (json.has(prefix+"ClaimResponse"))
26891      return true;
26892    if (json.has(prefix+"ClinicalImpression"))
26893      return true;
26894    if (json.has(prefix+"CodeSystem"))
26895      return true;
26896    if (json.has(prefix+"Communication"))
26897      return true;
26898    if (json.has(prefix+"CommunicationRequest"))
26899      return true;
26900    if (json.has(prefix+"CompartmentDefinition"))
26901      return true;
26902    if (json.has(prefix+"Composition"))
26903      return true;
26904    if (json.has(prefix+"ConceptMap"))
26905      return true;
26906    if (json.has(prefix+"Condition"))
26907      return true;
26908    if (json.has(prefix+"Consent"))
26909      return true;
26910    if (json.has(prefix+"Contract"))
26911      return true;
26912    if (json.has(prefix+"Coverage"))
26913      return true;
26914    if (json.has(prefix+"CoverageEligibilityRequest"))
26915      return true;
26916    if (json.has(prefix+"CoverageEligibilityResponse"))
26917      return true;
26918    if (json.has(prefix+"DetectedIssue"))
26919      return true;
26920    if (json.has(prefix+"Device"))
26921      return true;
26922    if (json.has(prefix+"DeviceDefinition"))
26923      return true;
26924    if (json.has(prefix+"DeviceMetric"))
26925      return true;
26926    if (json.has(prefix+"DeviceRequest"))
26927      return true;
26928    if (json.has(prefix+"DeviceUseStatement"))
26929      return true;
26930    if (json.has(prefix+"DiagnosticReport"))
26931      return true;
26932    if (json.has(prefix+"DocumentManifest"))
26933      return true;
26934    if (json.has(prefix+"DocumentReference"))
26935      return true;
26936    if (json.has(prefix+"Encounter"))
26937      return true;
26938    if (json.has(prefix+"Endpoint"))
26939      return true;
26940    if (json.has(prefix+"EnrollmentRequest"))
26941      return true;
26942    if (json.has(prefix+"EnrollmentResponse"))
26943      return true;
26944    if (json.has(prefix+"EpisodeOfCare"))
26945      return true;
26946    if (json.has(prefix+"EventDefinition"))
26947      return true;
26948    if (json.has(prefix+"ExampleScenario"))
26949      return true;
26950    if (json.has(prefix+"ExplanationOfBenefit"))
26951      return true;
26952    if (json.has(prefix+"FamilyMemberHistory"))
26953      return true;
26954    if (json.has(prefix+"Flag"))
26955      return true;
26956    if (json.has(prefix+"Goal"))
26957      return true;
26958    if (json.has(prefix+"GraphDefinition"))
26959      return true;
26960    if (json.has(prefix+"Group"))
26961      return true;
26962    if (json.has(prefix+"GuidanceResponse"))
26963      return true;
26964    if (json.has(prefix+"HealthcareService"))
26965      return true;
26966    if (json.has(prefix+"ImagingStudy"))
26967      return true;
26968    if (json.has(prefix+"Immunization"))
26969      return true;
26970    if (json.has(prefix+"ImmunizationEvaluation"))
26971      return true;
26972    if (json.has(prefix+"ImmunizationRecommendation"))
26973      return true;
26974    if (json.has(prefix+"ImplementationGuide"))
26975      return true;
26976    if (json.has(prefix+"InsurancePlan"))
26977      return true;
26978    if (json.has(prefix+"Invoice"))
26979      return true;
26980    if (json.has(prefix+"ItemInstance"))
26981      return true;
26982    if (json.has(prefix+"Library"))
26983      return true;
26984    if (json.has(prefix+"Linkage"))
26985      return true;
26986    if (json.has(prefix+"List"))
26987      return true;
26988    if (json.has(prefix+"Location"))
26989      return true;
26990    if (json.has(prefix+"Measure"))
26991      return true;
26992    if (json.has(prefix+"MeasureReport"))
26993      return true;
26994    if (json.has(prefix+"Media"))
26995      return true;
26996    if (json.has(prefix+"Medication"))
26997      return true;
26998    if (json.has(prefix+"MedicationAdministration"))
26999      return true;
27000    if (json.has(prefix+"MedicationDispense"))
27001      return true;
27002    if (json.has(prefix+"MedicationKnowledge"))
27003      return true;
27004    if (json.has(prefix+"MedicationRequest"))
27005      return true;
27006    if (json.has(prefix+"MedicationStatement"))
27007      return true;
27008    if (json.has(prefix+"MedicinalProduct"))
27009      return true;
27010    if (json.has(prefix+"MedicinalProductAuthorization"))
27011      return true;
27012    if (json.has(prefix+"MedicinalProductClinicals"))
27013      return true;
27014    if (json.has(prefix+"MedicinalProductContraindication"))
27015      return true;
27016    if (json.has(prefix+"MedicinalProductDeviceSpec"))
27017      return true;
27018    if (json.has(prefix+"MedicinalProductIndication"))
27019      return true;
27020    if (json.has(prefix+"MedicinalProductIngredient"))
27021      return true;
27022    if (json.has(prefix+"MedicinalProductInteraction"))
27023      return true;
27024    if (json.has(prefix+"MedicinalProductManufactured"))
27025      return true;
27026    if (json.has(prefix+"MedicinalProductPackaged"))
27027      return true;
27028    if (json.has(prefix+"MedicinalProductPharmaceutical"))
27029      return true;
27030    if (json.has(prefix+"MedicinalProductUndesirableEffect"))
27031      return true;
27032    if (json.has(prefix+"MessageDefinition"))
27033      return true;
27034    if (json.has(prefix+"MessageHeader"))
27035      return true;
27036    if (json.has(prefix+"NamingSystem"))
27037      return true;
27038    if (json.has(prefix+"NutritionOrder"))
27039      return true;
27040    if (json.has(prefix+"Observation"))
27041      return true;
27042    if (json.has(prefix+"ObservationDefinition"))
27043      return true;
27044    if (json.has(prefix+"OperationDefinition"))
27045      return true;
27046    if (json.has(prefix+"OperationOutcome"))
27047      return true;
27048    if (json.has(prefix+"Organization"))
27049      return true;
27050    if (json.has(prefix+"OrganizationAffiliation"))
27051      return true;
27052    if (json.has(prefix+"Patient"))
27053      return true;
27054    if (json.has(prefix+"PaymentNotice"))
27055      return true;
27056    if (json.has(prefix+"PaymentReconciliation"))
27057      return true;
27058    if (json.has(prefix+"Person"))
27059      return true;
27060    if (json.has(prefix+"PlanDefinition"))
27061      return true;
27062    if (json.has(prefix+"Practitioner"))
27063      return true;
27064    if (json.has(prefix+"PractitionerRole"))
27065      return true;
27066    if (json.has(prefix+"Procedure"))
27067      return true;
27068    if (json.has(prefix+"ProcessRequest"))
27069      return true;
27070    if (json.has(prefix+"ProcessResponse"))
27071      return true;
27072    if (json.has(prefix+"Provenance"))
27073      return true;
27074    if (json.has(prefix+"Questionnaire"))
27075      return true;
27076    if (json.has(prefix+"QuestionnaireResponse"))
27077      return true;
27078    if (json.has(prefix+"RelatedPerson"))
27079      return true;
27080    if (json.has(prefix+"RequestGroup"))
27081      return true;
27082    if (json.has(prefix+"ResearchStudy"))
27083      return true;
27084    if (json.has(prefix+"ResearchSubject"))
27085      return true;
27086    if (json.has(prefix+"RiskAssessment"))
27087      return true;
27088    if (json.has(prefix+"Schedule"))
27089      return true;
27090    if (json.has(prefix+"SearchParameter"))
27091      return true;
27092    if (json.has(prefix+"Sequence"))
27093      return true;
27094    if (json.has(prefix+"ServiceRequest"))
27095      return true;
27096    if (json.has(prefix+"Slot"))
27097      return true;
27098    if (json.has(prefix+"Specimen"))
27099      return true;
27100    if (json.has(prefix+"SpecimenDefinition"))
27101      return true;
27102    if (json.has(prefix+"StructureDefinition"))
27103      return true;
27104    if (json.has(prefix+"StructureMap"))
27105      return true;
27106    if (json.has(prefix+"Subscription"))
27107      return true;
27108    if (json.has(prefix+"Substance"))
27109      return true;
27110    if (json.has(prefix+"SubstancePolymer"))
27111      return true;
27112    if (json.has(prefix+"SubstanceReferenceInformation"))
27113      return true;
27114    if (json.has(prefix+"SubstanceSpecification"))
27115      return true;
27116    if (json.has(prefix+"SupplyDelivery"))
27117      return true;
27118    if (json.has(prefix+"SupplyRequest"))
27119      return true;
27120    if (json.has(prefix+"Task"))
27121      return true;
27122    if (json.has(prefix+"TerminologyCapabilities"))
27123      return true;
27124    if (json.has(prefix+"TestReport"))
27125      return true;
27126    if (json.has(prefix+"TestScript"))
27127      return true;
27128    if (json.has(prefix+"UserSession"))
27129      return true;
27130    if (json.has(prefix+"ValueSet"))
27131      return true;
27132    if (json.has(prefix+"VerificationResult"))
27133      return true;
27134    if (json.has(prefix+"VisionPrescription"))
27135      return true;
27136    if (json.has(prefix+"Date") || json.has("_"+prefix+"Date"))
27137      return true;
27138    if (json.has(prefix+"DateTime") || json.has("_"+prefix+"DateTime"))
27139      return true;
27140    if (json.has(prefix+"Code") || json.has("_"+prefix+"Code"))
27141      return true;
27142    if (json.has(prefix+"String") || json.has("_"+prefix+"String"))
27143      return true;
27144    if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
27145      return true;
27146    if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
27147      return true;
27148    if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
27149      return true;
27150    if (json.has(prefix+"Uri") || json.has("_"+prefix+"Uri"))
27151      return true;
27152    if (json.has(prefix+"Uuid") || json.has("_"+prefix+"Uuid"))
27153      return true;
27154    if (json.has(prefix+"Url") || json.has("_"+prefix+"Url"))
27155      return true;
27156    if (json.has(prefix+"Instant") || json.has("_"+prefix+"Instant"))
27157      return true;
27158    if (json.has(prefix+"Boolean") || json.has("_"+prefix+"Boolean"))
27159      return true;
27160    if (json.has(prefix+"Base64Binary") || json.has("_"+prefix+"Base64Binary"))
27161      return true;
27162    if (json.has(prefix+"UnsignedInt") || json.has("_"+prefix+"UnsignedInt"))
27163      return true;
27164    if (json.has(prefix+"Markdown") || json.has("_"+prefix+"Markdown"))
27165      return true;
27166    if (json.has(prefix+"Time") || json.has("_"+prefix+"Time"))
27167      return true;
27168    if (json.has(prefix+"Id") || json.has("_"+prefix+"Id"))
27169      return true;
27170    if (json.has(prefix+"PositiveInt") || json.has("_"+prefix+"PositiveInt"))
27171      return true;
27172    if (json.has(prefix+"Decimal") || json.has("_"+prefix+"Decimal"))
27173      return true;
27174    return false;
27175  }
27176
27177  protected Type parseAnyType(JsonObject json, String type) throws IOException, FHIRFormatError {
27178    if (type.equals("ElementDefinition"))
27179      return parseElementDefinition(json);
27180    else if (type.equals("DataRequirement"))
27181      return parseDataRequirement(json);
27182    else
27183      return parseType(json, type);
27184  }
27185
27186  protected void composeElement(Element element) throws IOException {
27187    if (element.hasId())
27188      prop("id", element.getId());
27189      if (makeComments(element)) {
27190        openArray("fhir_comments");
27191        for (String s : element.getFormatCommentsPre())
27192          prop(null,  s);
27193        for (String s : element.getFormatCommentsPost())
27194          prop(null,  s);
27195         closeArray();
27196      }
27197    if (element.hasExtension()) {
27198      openArray("extension");
27199      for (Extension e : element.getExtension())
27200        composeExtension(null, e);
27201      closeArray();
27202    }
27203  }
27204
27205  protected void composeBackboneElementInner(BackboneElement element) throws IOException {
27206    composeBackbone(element);
27207  }
27208
27209  protected void composeBackbone(BackboneElement element) throws IOException {
27210    composeElement(element);
27211    if (element.hasModifierExtension()) {
27212      openArray("modifierExtension");
27213      for (Extension e : element.getModifierExtension())
27214        composeExtension(null, e);
27215      closeArray();
27216    }
27217  }
27218
27219  protected void composeBackbone(BackboneType element) throws IOException {
27220    composeElement(element);
27221    if (element.hasModifierExtension()) {
27222      openArray("modifierExtension");
27223      for (Extension e : element.getModifierExtension())
27224        composeExtension(null, e);
27225      closeArray();
27226    }
27227  }
27228
27229  protected <E extends Enum<E>> void composeEnumerationCore(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
27230    if (value != null && value.getValue() != null) {
27231      prop(name, e.toCode(value.getValue()));
27232    } else if (inArray)   
27233      writeNull(name);
27234  }    
27235
27236  protected <E extends Enum<E>> void composeEnumerationExtras(String name, Enumeration<E> value, EnumFactory e, boolean inArray) throws IOException {
27237    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27238      open(inArray ? null : "_"+name);
27239      composeElement(value);
27240      close();
27241    } else if (inArray)   
27242      writeNull(name);
27243  }    
27244
27245  protected void composeDateCore(String name, DateType value, boolean inArray) throws IOException {
27246    if (value != null && value.hasValue()) {
27247        prop(name, value.asStringValue());
27248    }    
27249    else if (inArray) 
27250      writeNull(name); 
27251  }    
27252
27253  protected void composeDateExtras(String name, DateType value, boolean inArray) throws IOException {
27254    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27255      open(inArray ? null : "_"+name);
27256      composeElement(value);
27257      close();
27258    }
27259    else if (inArray) 
27260      writeNull(name); 
27261  }
27262
27263  protected void composeDateTimeCore(String name, DateTimeType value, boolean inArray) throws IOException {
27264    if (value != null && value.hasValue()) {
27265        prop(name, value.asStringValue());
27266    }    
27267    else if (inArray) 
27268      writeNull(name); 
27269  }    
27270
27271  protected void composeDateTimeExtras(String name, DateTimeType value, boolean inArray) throws IOException {
27272    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27273      open(inArray ? null : "_"+name);
27274      composeElement(value);
27275      close();
27276    }
27277    else if (inArray) 
27278      writeNull(name); 
27279  }
27280
27281  protected void composeCodeCore(String name, CodeType value, boolean inArray) throws IOException {
27282    if (value != null && value.hasValue()) {
27283        prop(name, toString(value.getValue()));
27284    }    
27285    else if (inArray) 
27286      writeNull(name); 
27287  }    
27288
27289  protected void composeCodeExtras(String name, CodeType value, boolean inArray) throws IOException {
27290    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27291      open(inArray ? null : "_"+name);
27292      composeElement(value);
27293      close();
27294    }
27295    else if (inArray) 
27296      writeNull(name); 
27297  }
27298
27299  protected void composeStringCore(String name, StringType value, boolean inArray) throws IOException {
27300    if (value != null && value.hasValue()) {
27301        prop(name, toString(value.getValue()));
27302    }    
27303    else if (inArray) 
27304      writeNull(name); 
27305  }    
27306
27307  protected void composeStringExtras(String name, StringType value, boolean inArray) throws IOException {
27308    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27309      open(inArray ? null : "_"+name);
27310      composeElement(value);
27311      close();
27312    }
27313    else if (inArray) 
27314      writeNull(name); 
27315  }
27316
27317  protected void composeIntegerCore(String name, IntegerType value, boolean inArray) throws IOException {
27318    if (value != null && value.hasValue()) {
27319        prop(name, Integer.valueOf(value.getValue()));
27320    }    
27321    else if (inArray) 
27322      writeNull(name); 
27323  }    
27324
27325  protected void composeIntegerExtras(String name, IntegerType value, boolean inArray) throws IOException {
27326    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27327      open(inArray ? null : "_"+name);
27328      composeElement(value);
27329      close();
27330    }
27331    else if (inArray) 
27332      writeNull(name); 
27333  }
27334
27335  protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
27336    if (value != null && value.hasValue()) {
27337        prop(name, toString(value.getValue()));
27338    }    
27339    else if (inArray) 
27340      writeNull(name); 
27341  }    
27342
27343  protected void composeOidExtras(String name, OidType value, boolean inArray) throws IOException {
27344    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27345      open(inArray ? null : "_"+name);
27346      composeElement(value);
27347      close();
27348    }
27349    else if (inArray) 
27350      writeNull(name); 
27351  }
27352
27353  protected void composeCanonicalCore(String name, CanonicalType value, boolean inArray) throws IOException {
27354    if (value != null && value.hasValue()) {
27355        prop(name, toString(value.getValue()));
27356    }    
27357    else if (inArray) 
27358      writeNull(name); 
27359  }    
27360
27361  protected void composeCanonicalExtras(String name, CanonicalType value, boolean inArray) throws IOException {
27362    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27363      open(inArray ? null : "_"+name);
27364      composeElement(value);
27365      close();
27366    }
27367    else if (inArray) 
27368      writeNull(name); 
27369  }
27370
27371  protected void composeUriCore(String name, UriType value, boolean inArray) throws IOException {
27372    if (value != null && value.hasValue()) {
27373        prop(name, toString(value.getValue()));
27374    }    
27375    else if (inArray) 
27376      writeNull(name); 
27377  }    
27378
27379  protected void composeUriExtras(String name, UriType value, boolean inArray) throws IOException {
27380    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27381      open(inArray ? null : "_"+name);
27382      composeElement(value);
27383      close();
27384    }
27385    else if (inArray) 
27386      writeNull(name); 
27387  }
27388
27389  protected void composeUuidCore(String name, UuidType value, boolean inArray) throws IOException {
27390    if (value != null && value.hasValue()) {
27391        prop(name, toString(value.getValue()));
27392    }    
27393    else if (inArray) 
27394      writeNull(name); 
27395  }    
27396
27397  protected void composeUuidExtras(String name, UuidType value, boolean inArray) throws IOException {
27398    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27399      open(inArray ? null : "_"+name);
27400      composeElement(value);
27401      close();
27402    }
27403    else if (inArray) 
27404      writeNull(name); 
27405  }
27406
27407  protected void composeUrlCore(String name, UrlType value, boolean inArray) throws IOException {
27408    if (value != null && value.hasValue()) {
27409        prop(name, toString(value.getValue()));
27410    }    
27411    else if (inArray) 
27412      writeNull(name); 
27413  }    
27414
27415  protected void composeUrlExtras(String name, UrlType value, boolean inArray) throws IOException {
27416    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27417      open(inArray ? null : "_"+name);
27418      composeElement(value);
27419      close();
27420    }
27421    else if (inArray) 
27422      writeNull(name); 
27423  }
27424
27425  protected void composeInstantCore(String name, InstantType value, boolean inArray) throws IOException {
27426    if (value != null && value.hasValue()) {
27427        prop(name, value.asStringValue());
27428    }    
27429    else if (inArray) 
27430      writeNull(name); 
27431  }    
27432
27433  protected void composeInstantExtras(String name, InstantType value, boolean inArray) throws IOException {
27434    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27435      open(inArray ? null : "_"+name);
27436      composeElement(value);
27437      close();
27438    }
27439    else if (inArray) 
27440      writeNull(name); 
27441  }
27442
27443  protected void composeBooleanCore(String name, BooleanType value, boolean inArray) throws IOException {
27444    if (value != null && value.hasValue()) {
27445        prop(name, value.getValue());
27446    }    
27447    else if (inArray) 
27448      writeNull(name); 
27449  }    
27450
27451  protected void composeBooleanExtras(String name, BooleanType value, boolean inArray) throws IOException {
27452    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27453      open(inArray ? null : "_"+name);
27454      composeElement(value);
27455      close();
27456    }
27457    else if (inArray) 
27458      writeNull(name); 
27459  }
27460
27461  protected void composeBase64BinaryCore(String name, Base64BinaryType value, boolean inArray) throws IOException {
27462    if (value != null && value.hasValue()) {
27463        prop(name, toString(value.getValue()));
27464    }    
27465    else if (inArray) 
27466      writeNull(name); 
27467  }    
27468
27469  protected void composeBase64BinaryExtras(String name, Base64BinaryType value, boolean inArray) throws IOException {
27470    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27471      open(inArray ? null : "_"+name);
27472      composeElement(value);
27473      close();
27474    }
27475    else if (inArray) 
27476      writeNull(name); 
27477  }
27478
27479  protected void composeUnsignedIntCore(String name, UnsignedIntType value, boolean inArray) throws IOException {
27480    if (value != null && value.hasValue()) {
27481        prop(name, Integer.valueOf(value.getValue()));
27482    }    
27483    else if (inArray) 
27484      writeNull(name); 
27485  }    
27486
27487  protected void composeUnsignedIntExtras(String name, UnsignedIntType value, boolean inArray) throws IOException {
27488    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27489      open(inArray ? null : "_"+name);
27490      composeElement(value);
27491      close();
27492    }
27493    else if (inArray) 
27494      writeNull(name); 
27495  }
27496
27497  protected void composeMarkdownCore(String name, MarkdownType value, boolean inArray) throws IOException {
27498    if (value != null && value.hasValue()) {
27499        prop(name, toString(value.getValue()));
27500    }    
27501    else if (inArray) 
27502      writeNull(name); 
27503  }    
27504
27505  protected void composeMarkdownExtras(String name, MarkdownType value, boolean inArray) throws IOException {
27506    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27507      open(inArray ? null : "_"+name);
27508      composeElement(value);
27509      close();
27510    }
27511    else if (inArray) 
27512      writeNull(name); 
27513  }
27514
27515  protected void composeTimeCore(String name, TimeType value, boolean inArray) throws IOException {
27516    if (value != null && value.hasValue()) {
27517        prop(name, value.asStringValue());
27518    }    
27519    else if (inArray) 
27520      writeNull(name); 
27521  }    
27522
27523  protected void composeTimeExtras(String name, TimeType value, boolean inArray) throws IOException {
27524    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27525      open(inArray ? null : "_"+name);
27526      composeElement(value);
27527      close();
27528    }
27529    else if (inArray) 
27530      writeNull(name); 
27531  }
27532
27533  protected void composeIdCore(String name, IdType value, boolean inArray) throws IOException {
27534    if (value != null && value.hasValue()) {
27535        prop(name, toString(value.getValue()));
27536    }    
27537    else if (inArray) 
27538      writeNull(name); 
27539  }    
27540
27541  protected void composeIdExtras(String name, IdType value, boolean inArray) throws IOException {
27542    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27543      open(inArray ? null : "_"+name);
27544      composeElement(value);
27545      close();
27546    }
27547    else if (inArray) 
27548      writeNull(name); 
27549  }
27550
27551  protected void composePositiveIntCore(String name, PositiveIntType value, boolean inArray) throws IOException {
27552    if (value != null && value.hasValue()) {
27553        prop(name, Integer.valueOf(value.getValue()));
27554    }    
27555    else if (inArray) 
27556      writeNull(name); 
27557  }    
27558
27559  protected void composePositiveIntExtras(String name, PositiveIntType value, boolean inArray) throws IOException {
27560    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27561      open(inArray ? null : "_"+name);
27562      composeElement(value);
27563      close();
27564    }
27565    else if (inArray) 
27566      writeNull(name); 
27567  }
27568
27569  protected void composeDecimalCore(String name, DecimalType value, boolean inArray) throws IOException {
27570    if (value != null && value.hasValue()) {
27571        prop(name, value.getValue());
27572    }    
27573    else if (inArray) 
27574      writeNull(name); 
27575  }    
27576
27577  protected void composeDecimalExtras(String name, DecimalType value, boolean inArray) throws IOException {
27578    if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
27579      open(inArray ? null : "_"+name);
27580      composeElement(value);
27581      close();
27582    }
27583    else if (inArray) 
27584      writeNull(name); 
27585  }
27586
27587  protected void composeExtension(String name, Extension element) throws IOException {
27588    if (element != null) {
27589      open(name);
27590      composeExtensionInner(element);
27591      close();
27592    }
27593  }
27594
27595  protected void composeExtensionInner(Extension element) throws IOException {
27596      composeElement(element);
27597      if (element.hasUrlElement()) {
27598        composeUriCore("url", element.getUrlElement(), false);
27599        composeUriExtras("url", element.getUrlElement(), false);
27600      }
27601      if (element.hasValue()) {
27602        composeType("value", element.getValue());
27603      }
27604  }
27605
27606  protected void composeNarrative(String name, Narrative element) throws IOException {
27607    if (element != null) {
27608      open(name);
27609      composeNarrativeInner(element);
27610      close();
27611    }
27612  }
27613
27614  protected void composeNarrativeInner(Narrative element) throws IOException {
27615      composeElement(element);
27616      if (element.hasStatusElement()) {
27617        composeEnumerationCore("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
27618        composeEnumerationExtras("status", element.getStatusElement(), new Narrative.NarrativeStatusEnumFactory(), false);
27619      }
27620      if (element.hasDiv()) {
27621        XhtmlNode node = element.getDiv();
27622        if (node.getNsDecl() == null) {
27623          node.attribute("xmlns", XHTML_NS);
27624        }
27625        composeXhtml("div", node);
27626      }
27627  }
27628
27629  protected void composeCount(String name, Count element) throws IOException {
27630    if (element != null) {
27631      open(name);
27632      composeCountInner(element);
27633      close();
27634    }
27635  }
27636
27637  protected void composeCountInner(Count element) throws IOException {
27638      composeQuantityInner(element);
27639  }
27640
27641  protected void composeDosage(String name, Dosage element) throws IOException {
27642    if (element != null) {
27643      open(name);
27644      composeDosageInner(element);
27645      close();
27646    }
27647  }
27648
27649  protected void composeDosageInner(Dosage element) throws IOException {
27650      composeBackbone(element);
27651      if (element.hasSequenceElement()) {
27652        composeIntegerCore("sequence", element.getSequenceElement(), false);
27653        composeIntegerExtras("sequence", element.getSequenceElement(), false);
27654      }
27655      if (element.hasTextElement()) {
27656        composeStringCore("text", element.getTextElement(), false);
27657        composeStringExtras("text", element.getTextElement(), false);
27658      }
27659      if (element.hasAdditionalInstruction()) {
27660        openArray("additionalInstruction");
27661        for (CodeableConcept e : element.getAdditionalInstruction()) 
27662          composeCodeableConcept(null, e);
27663        closeArray();
27664      };
27665      if (element.hasPatientInstructionElement()) {
27666        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
27667        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
27668      }
27669      if (element.hasTiming()) {
27670        composeTiming("timing", element.getTiming());
27671      }
27672      if (element.hasAsNeeded()) {
27673        composeType("asNeeded", element.getAsNeeded());
27674      }
27675      if (element.hasSite()) {
27676        composeCodeableConcept("site", element.getSite());
27677      }
27678      if (element.hasRoute()) {
27679        composeCodeableConcept("route", element.getRoute());
27680      }
27681      if (element.hasMethod()) {
27682        composeCodeableConcept("method", element.getMethod());
27683      }
27684      if (element.hasDoseAndRate()) {
27685        openArray("doseAndRate");
27686        for (Dosage.DosageDoseAndRateComponent e : element.getDoseAndRate()) 
27687          composeDosageDosageDoseAndRateComponent(null, e);
27688        closeArray();
27689      };
27690      if (element.hasMaxDosePerPeriod()) {
27691        composeRatio("maxDosePerPeriod", element.getMaxDosePerPeriod());
27692      }
27693      if (element.hasMaxDosePerAdministration()) {
27694        composeQuantity("maxDosePerAdministration", element.getMaxDosePerAdministration());
27695      }
27696      if (element.hasMaxDosePerLifetime()) {
27697        composeQuantity("maxDosePerLifetime", element.getMaxDosePerLifetime());
27698      }
27699  }
27700
27701  protected void composeDosageDosageDoseAndRateComponent(String name, Dosage.DosageDoseAndRateComponent element) throws IOException {
27702    if (element != null) {
27703      open(name);
27704      composeDosageDosageDoseAndRateComponentInner(element);
27705      close();
27706    }
27707  }
27708
27709  protected void composeDosageDosageDoseAndRateComponentInner(Dosage.DosageDoseAndRateComponent element) throws IOException {
27710      composeElement(element);
27711      if (element.hasType()) {
27712        composeCodeableConcept("type", element.getType());
27713      }
27714      if (element.hasDose()) {
27715        composeType("dose", element.getDose());
27716      }
27717      if (element.hasRate()) {
27718        composeType("rate", element.getRate());
27719      }
27720  }
27721
27722  protected void composeDistance(String name, Distance element) throws IOException {
27723    if (element != null) {
27724      open(name);
27725      composeDistanceInner(element);
27726      close();
27727    }
27728  }
27729
27730  protected void composeDistanceInner(Distance element) throws IOException {
27731      composeQuantityInner(element);
27732  }
27733
27734  protected void composeAge(String name, Age element) throws IOException {
27735    if (element != null) {
27736      open(name);
27737      composeAgeInner(element);
27738      close();
27739    }
27740  }
27741
27742  protected void composeAgeInner(Age element) throws IOException {
27743      composeQuantityInner(element);
27744  }
27745
27746  protected void composeDuration(String name, Duration element) throws IOException {
27747    if (element != null) {
27748      open(name);
27749      composeDurationInner(element);
27750      close();
27751    }
27752  }
27753
27754  protected void composeDurationInner(Duration element) throws IOException {
27755      composeQuantityInner(element);
27756  }
27757
27758  protected void composeTiming(String name, Timing element) throws IOException {
27759    if (element != null) {
27760      open(name);
27761      composeTimingInner(element);
27762      close();
27763    }
27764  }
27765
27766  protected void composeTimingInner(Timing element) throws IOException {
27767      composeBackbone(element);
27768      if (element.hasEvent()) {
27769        openArray("event");
27770        for (DateTimeType e : element.getEvent()) 
27771          composeDateTimeCore(null, e, true);
27772        closeArray();
27773        if (anyHasExtras(element.getEvent())) {
27774          openArray("_event");
27775          for (DateTimeType e : element.getEvent()) 
27776            composeDateTimeExtras(null, e, true);
27777          closeArray();
27778        }
27779      };
27780      if (element.hasRepeat()) {
27781        composeTimingTimingRepeatComponent("repeat", element.getRepeat());
27782      }
27783      if (element.hasCode()) {
27784        composeCodeableConcept("code", element.getCode());
27785      }
27786  }
27787
27788  protected void composeTimingTimingRepeatComponent(String name, Timing.TimingRepeatComponent element) throws IOException {
27789    if (element != null) {
27790      open(name);
27791      composeTimingTimingRepeatComponentInner(element);
27792      close();
27793    }
27794  }
27795
27796  protected void composeTimingTimingRepeatComponentInner(Timing.TimingRepeatComponent element) throws IOException {
27797      composeElement(element);
27798      if (element.hasBounds()) {
27799        composeType("bounds", element.getBounds());
27800      }
27801      if (element.hasCountElement()) {
27802        composePositiveIntCore("count", element.getCountElement(), false);
27803        composePositiveIntExtras("count", element.getCountElement(), false);
27804      }
27805      if (element.hasCountMaxElement()) {
27806        composePositiveIntCore("countMax", element.getCountMaxElement(), false);
27807        composePositiveIntExtras("countMax", element.getCountMaxElement(), false);
27808      }
27809      if (element.hasDurationElement()) {
27810        composeDecimalCore("duration", element.getDurationElement(), false);
27811        composeDecimalExtras("duration", element.getDurationElement(), false);
27812      }
27813      if (element.hasDurationMaxElement()) {
27814        composeDecimalCore("durationMax", element.getDurationMaxElement(), false);
27815        composeDecimalExtras("durationMax", element.getDurationMaxElement(), false);
27816      }
27817      if (element.hasDurationUnitElement()) {
27818        composeEnumerationCore("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
27819        composeEnumerationExtras("durationUnit", element.getDurationUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
27820      }
27821      if (element.hasFrequencyElement()) {
27822        composePositiveIntCore("frequency", element.getFrequencyElement(), false);
27823        composePositiveIntExtras("frequency", element.getFrequencyElement(), false);
27824      }
27825      if (element.hasFrequencyMaxElement()) {
27826        composePositiveIntCore("frequencyMax", element.getFrequencyMaxElement(), false);
27827        composePositiveIntExtras("frequencyMax", element.getFrequencyMaxElement(), false);
27828      }
27829      if (element.hasPeriodElement()) {
27830        composeDecimalCore("period", element.getPeriodElement(), false);
27831        composeDecimalExtras("period", element.getPeriodElement(), false);
27832      }
27833      if (element.hasPeriodMaxElement()) {
27834        composeDecimalCore("periodMax", element.getPeriodMaxElement(), false);
27835        composeDecimalExtras("periodMax", element.getPeriodMaxElement(), false);
27836      }
27837      if (element.hasPeriodUnitElement()) {
27838        composeEnumerationCore("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
27839        composeEnumerationExtras("periodUnit", element.getPeriodUnitElement(), new Timing.UnitsOfTimeEnumFactory(), false);
27840      }
27841      if (element.hasDayOfWeek()) {
27842        openArray("dayOfWeek");
27843        for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
27844          composeEnumerationCore(null, e, new Timing.DayOfWeekEnumFactory(), true);
27845        closeArray();
27846        if (anyHasExtras(element.getDayOfWeek())) {
27847          openArray("_dayOfWeek");
27848          for (Enumeration<Timing.DayOfWeek> e : element.getDayOfWeek()) 
27849            composeEnumerationExtras(null, e, new Timing.DayOfWeekEnumFactory(), true);
27850          closeArray();
27851        }
27852      };
27853      if (element.hasTimeOfDay()) {
27854        openArray("timeOfDay");
27855        for (TimeType e : element.getTimeOfDay()) 
27856          composeTimeCore(null, e, true);
27857        closeArray();
27858        if (anyHasExtras(element.getTimeOfDay())) {
27859          openArray("_timeOfDay");
27860          for (TimeType e : element.getTimeOfDay()) 
27861            composeTimeExtras(null, e, true);
27862          closeArray();
27863        }
27864      };
27865      if (element.hasWhen()) {
27866        openArray("when");
27867        for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
27868          composeEnumerationCore(null, e, new Timing.EventTimingEnumFactory(), true);
27869        closeArray();
27870        if (anyHasExtras(element.getWhen())) {
27871          openArray("_when");
27872          for (Enumeration<Timing.EventTiming> e : element.getWhen()) 
27873            composeEnumerationExtras(null, e, new Timing.EventTimingEnumFactory(), true);
27874          closeArray();
27875        }
27876      };
27877      if (element.hasOffsetElement()) {
27878        composeUnsignedIntCore("offset", element.getOffsetElement(), false);
27879        composeUnsignedIntExtras("offset", element.getOffsetElement(), false);
27880      }
27881  }
27882
27883  protected void composeMeta(String name, Meta element) throws IOException {
27884    if (element != null) {
27885      open(name);
27886      composeMetaInner(element);
27887      close();
27888    }
27889  }
27890
27891  protected void composeMetaInner(Meta element) throws IOException {
27892      composeElement(element);
27893      if (element.hasVersionIdElement()) {
27894        composeIdCore("versionId", element.getVersionIdElement(), false);
27895        composeIdExtras("versionId", element.getVersionIdElement(), false);
27896      }
27897      if (element.hasLastUpdatedElement()) {
27898        composeInstantCore("lastUpdated", element.getLastUpdatedElement(), false);
27899        composeInstantExtras("lastUpdated", element.getLastUpdatedElement(), false);
27900      }
27901      if (element.hasSourceElement()) {
27902        composeUriCore("source", element.getSourceElement(), false);
27903        composeUriExtras("source", element.getSourceElement(), false);
27904      }
27905      if (element.hasProfile()) {
27906        openArray("profile");
27907        for (CanonicalType e : element.getProfile()) 
27908          composeCanonicalCore(null, e, true);
27909        closeArray();
27910        if (anyHasExtras(element.getProfile())) {
27911          openArray("_profile");
27912          for (CanonicalType e : element.getProfile()) 
27913            composeCanonicalExtras(null, e, true);
27914          closeArray();
27915        }
27916      };
27917      if (element.hasSecurity()) {
27918        openArray("security");
27919        for (Coding e : element.getSecurity()) 
27920          composeCoding(null, e);
27921        closeArray();
27922      };
27923      if (element.hasTag()) {
27924        openArray("tag");
27925        for (Coding e : element.getTag()) 
27926          composeCoding(null, e);
27927        closeArray();
27928      };
27929  }
27930
27931  protected void composeAddress(String name, Address element) throws IOException {
27932    if (element != null) {
27933      open(name);
27934      composeAddressInner(element);
27935      close();
27936    }
27937  }
27938
27939  protected void composeAddressInner(Address element) throws IOException {
27940      composeElement(element);
27941      if (element.hasUseElement()) {
27942        composeEnumerationCore("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
27943        composeEnumerationExtras("use", element.getUseElement(), new Address.AddressUseEnumFactory(), false);
27944      }
27945      if (element.hasTypeElement()) {
27946        composeEnumerationCore("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
27947        composeEnumerationExtras("type", element.getTypeElement(), new Address.AddressTypeEnumFactory(), false);
27948      }
27949      if (element.hasTextElement()) {
27950        composeStringCore("text", element.getTextElement(), false);
27951        composeStringExtras("text", element.getTextElement(), false);
27952      }
27953      if (element.hasLine()) {
27954        openArray("line");
27955        for (StringType e : element.getLine()) 
27956          composeStringCore(null, e, true);
27957        closeArray();
27958        if (anyHasExtras(element.getLine())) {
27959          openArray("_line");
27960          for (StringType e : element.getLine()) 
27961            composeStringExtras(null, e, true);
27962          closeArray();
27963        }
27964      };
27965      if (element.hasCityElement()) {
27966        composeStringCore("city", element.getCityElement(), false);
27967        composeStringExtras("city", element.getCityElement(), false);
27968      }
27969      if (element.hasDistrictElement()) {
27970        composeStringCore("district", element.getDistrictElement(), false);
27971        composeStringExtras("district", element.getDistrictElement(), false);
27972      }
27973      if (element.hasStateElement()) {
27974        composeStringCore("state", element.getStateElement(), false);
27975        composeStringExtras("state", element.getStateElement(), false);
27976      }
27977      if (element.hasPostalCodeElement()) {
27978        composeStringCore("postalCode", element.getPostalCodeElement(), false);
27979        composeStringExtras("postalCode", element.getPostalCodeElement(), false);
27980      }
27981      if (element.hasCountryElement()) {
27982        composeStringCore("country", element.getCountryElement(), false);
27983        composeStringExtras("country", element.getCountryElement(), false);
27984      }
27985      if (element.hasPeriod()) {
27986        composePeriod("period", element.getPeriod());
27987      }
27988  }
27989
27990  protected void composeContributor(String name, Contributor element) throws IOException {
27991    if (element != null) {
27992      open(name);
27993      composeContributorInner(element);
27994      close();
27995    }
27996  }
27997
27998  protected void composeContributorInner(Contributor element) throws IOException {
27999      composeElement(element);
28000      if (element.hasTypeElement()) {
28001        composeEnumerationCore("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
28002        composeEnumerationExtras("type", element.getTypeElement(), new Contributor.ContributorTypeEnumFactory(), false);
28003      }
28004      if (element.hasNameElement()) {
28005        composeStringCore("name", element.getNameElement(), false);
28006        composeStringExtras("name", element.getNameElement(), false);
28007      }
28008      if (element.hasContact()) {
28009        openArray("contact");
28010        for (ContactDetail e : element.getContact()) 
28011          composeContactDetail(null, e);
28012        closeArray();
28013      };
28014  }
28015
28016  protected void composeAttachment(String name, Attachment element) throws IOException {
28017    if (element != null) {
28018      open(name);
28019      composeAttachmentInner(element);
28020      close();
28021    }
28022  }
28023
28024  protected void composeAttachmentInner(Attachment element) throws IOException {
28025      composeElement(element);
28026      if (element.hasContentTypeElement()) {
28027        composeCodeCore("contentType", element.getContentTypeElement(), false);
28028        composeCodeExtras("contentType", element.getContentTypeElement(), false);
28029      }
28030      if (element.hasLanguageElement()) {
28031        composeCodeCore("language", element.getLanguageElement(), false);
28032        composeCodeExtras("language", element.getLanguageElement(), false);
28033      }
28034      if (element.hasDataElement()) {
28035        composeBase64BinaryCore("data", element.getDataElement(), false);
28036        composeBase64BinaryExtras("data", element.getDataElement(), false);
28037      }
28038      if (element.hasUrlElement()) {
28039        composeUrlCore("url", element.getUrlElement(), false);
28040        composeUrlExtras("url", element.getUrlElement(), false);
28041      }
28042      if (element.hasSizeElement()) {
28043        composeUnsignedIntCore("size", element.getSizeElement(), false);
28044        composeUnsignedIntExtras("size", element.getSizeElement(), false);
28045      }
28046      if (element.hasHashElement()) {
28047        composeBase64BinaryCore("hash", element.getHashElement(), false);
28048        composeBase64BinaryExtras("hash", element.getHashElement(), false);
28049      }
28050      if (element.hasTitleElement()) {
28051        composeStringCore("title", element.getTitleElement(), false);
28052        composeStringExtras("title", element.getTitleElement(), false);
28053      }
28054      if (element.hasCreationElement()) {
28055        composeDateTimeCore("creation", element.getCreationElement(), false);
28056        composeDateTimeExtras("creation", element.getCreationElement(), false);
28057      }
28058  }
28059
28060  protected void composeDataRequirement(String name, DataRequirement element) throws IOException {
28061    if (element != null) {
28062      open(name);
28063      composeDataRequirementInner(element);
28064      close();
28065    }
28066  }
28067
28068  protected void composeDataRequirementInner(DataRequirement element) throws IOException {
28069      composeElement(element);
28070      if (element.hasTypeElement()) {
28071        composeCodeCore("type", element.getTypeElement(), false);
28072        composeCodeExtras("type", element.getTypeElement(), false);
28073      }
28074      if (element.hasProfile()) {
28075        openArray("profile");
28076        for (CanonicalType e : element.getProfile()) 
28077          composeCanonicalCore(null, e, true);
28078        closeArray();
28079        if (anyHasExtras(element.getProfile())) {
28080          openArray("_profile");
28081          for (CanonicalType e : element.getProfile()) 
28082            composeCanonicalExtras(null, e, true);
28083          closeArray();
28084        }
28085      };
28086      if (element.hasSubject()) {
28087        composeType("subject", element.getSubject());
28088      }
28089      if (element.hasMustSupport()) {
28090        openArray("mustSupport");
28091        for (StringType e : element.getMustSupport()) 
28092          composeStringCore(null, e, true);
28093        closeArray();
28094        if (anyHasExtras(element.getMustSupport())) {
28095          openArray("_mustSupport");
28096          for (StringType e : element.getMustSupport()) 
28097            composeStringExtras(null, e, true);
28098          closeArray();
28099        }
28100      };
28101      if (element.hasCodeFilter()) {
28102        openArray("codeFilter");
28103        for (DataRequirement.DataRequirementCodeFilterComponent e : element.getCodeFilter()) 
28104          composeDataRequirementDataRequirementCodeFilterComponent(null, e);
28105        closeArray();
28106      };
28107      if (element.hasDateFilter()) {
28108        openArray("dateFilter");
28109        for (DataRequirement.DataRequirementDateFilterComponent e : element.getDateFilter()) 
28110          composeDataRequirementDataRequirementDateFilterComponent(null, e);
28111        closeArray();
28112      };
28113      if (element.hasLimitElement()) {
28114        composePositiveIntCore("limit", element.getLimitElement(), false);
28115        composePositiveIntExtras("limit", element.getLimitElement(), false);
28116      }
28117      if (element.hasSort()) {
28118        openArray("sort");
28119        for (DataRequirement.DataRequirementSortComponent e : element.getSort()) 
28120          composeDataRequirementDataRequirementSortComponent(null, e);
28121        closeArray();
28122      };
28123  }
28124
28125  protected void composeDataRequirementDataRequirementCodeFilterComponent(String name, DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
28126    if (element != null) {
28127      open(name);
28128      composeDataRequirementDataRequirementCodeFilterComponentInner(element);
28129      close();
28130    }
28131  }
28132
28133  protected void composeDataRequirementDataRequirementCodeFilterComponentInner(DataRequirement.DataRequirementCodeFilterComponent element) throws IOException {
28134      composeElement(element);
28135      if (element.hasPathElement()) {
28136        composeStringCore("path", element.getPathElement(), false);
28137        composeStringExtras("path", element.getPathElement(), false);
28138      }
28139      if (element.hasSearchParamElement()) {
28140        composeStringCore("searchParam", element.getSearchParamElement(), false);
28141        composeStringExtras("searchParam", element.getSearchParamElement(), false);
28142      }
28143      if (element.hasValueSetElement()) {
28144        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
28145        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
28146      }
28147      if (element.hasCode()) {
28148        openArray("code");
28149        for (Coding e : element.getCode()) 
28150          composeCoding(null, e);
28151        closeArray();
28152      };
28153  }
28154
28155  protected void composeDataRequirementDataRequirementDateFilterComponent(String name, DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
28156    if (element != null) {
28157      open(name);
28158      composeDataRequirementDataRequirementDateFilterComponentInner(element);
28159      close();
28160    }
28161  }
28162
28163  protected void composeDataRequirementDataRequirementDateFilterComponentInner(DataRequirement.DataRequirementDateFilterComponent element) throws IOException {
28164      composeElement(element);
28165      if (element.hasPathElement()) {
28166        composeStringCore("path", element.getPathElement(), false);
28167        composeStringExtras("path", element.getPathElement(), false);
28168      }
28169      if (element.hasSearchParamElement()) {
28170        composeStringCore("searchParam", element.getSearchParamElement(), false);
28171        composeStringExtras("searchParam", element.getSearchParamElement(), false);
28172      }
28173      if (element.hasValue()) {
28174        composeType("value", element.getValue());
28175      }
28176  }
28177
28178  protected void composeDataRequirementDataRequirementSortComponent(String name, DataRequirement.DataRequirementSortComponent element) throws IOException {
28179    if (element != null) {
28180      open(name);
28181      composeDataRequirementDataRequirementSortComponentInner(element);
28182      close();
28183    }
28184  }
28185
28186  protected void composeDataRequirementDataRequirementSortComponentInner(DataRequirement.DataRequirementSortComponent element) throws IOException {
28187      composeElement(element);
28188      if (element.hasPathElement()) {
28189        composeStringCore("path", element.getPathElement(), false);
28190        composeStringExtras("path", element.getPathElement(), false);
28191      }
28192      if (element.hasDirectionElement()) {
28193        composeEnumerationCore("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
28194        composeEnumerationExtras("direction", element.getDirectionElement(), new DataRequirement.SortDirectionEnumFactory(), false);
28195      }
28196  }
28197
28198  protected void composeMoney(String name, Money element) throws IOException {
28199    if (element != null) {
28200      open(name);
28201      composeMoneyInner(element);
28202      close();
28203    }
28204  }
28205
28206  protected void composeMoneyInner(Money element) throws IOException {
28207      composeElement(element);
28208      if (element.hasValueElement()) {
28209        composeDecimalCore("value", element.getValueElement(), false);
28210        composeDecimalExtras("value", element.getValueElement(), false);
28211      }
28212      if (element.hasCurrencyElement()) {
28213        composeCodeCore("currency", element.getCurrencyElement(), false);
28214        composeCodeExtras("currency", element.getCurrencyElement(), false);
28215      }
28216  }
28217
28218  protected void composeHumanName(String name, HumanName element) throws IOException {
28219    if (element != null) {
28220      open(name);
28221      composeHumanNameInner(element);
28222      close();
28223    }
28224  }
28225
28226  protected void composeHumanNameInner(HumanName element) throws IOException {
28227      composeElement(element);
28228      if (element.hasUseElement()) {
28229        composeEnumerationCore("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
28230        composeEnumerationExtras("use", element.getUseElement(), new HumanName.NameUseEnumFactory(), false);
28231      }
28232      if (element.hasTextElement()) {
28233        composeStringCore("text", element.getTextElement(), false);
28234        composeStringExtras("text", element.getTextElement(), false);
28235      }
28236      if (element.hasFamilyElement()) {
28237        composeStringCore("family", element.getFamilyElement(), false);
28238        composeStringExtras("family", element.getFamilyElement(), false);
28239      }
28240      if (element.hasGiven()) {
28241        openArray("given");
28242        for (StringType e : element.getGiven()) 
28243          composeStringCore(null, e, true);
28244        closeArray();
28245        if (anyHasExtras(element.getGiven())) {
28246          openArray("_given");
28247          for (StringType e : element.getGiven()) 
28248            composeStringExtras(null, e, true);
28249          closeArray();
28250        }
28251      };
28252      if (element.hasPrefix()) {
28253        openArray("prefix");
28254        for (StringType e : element.getPrefix()) 
28255          composeStringCore(null, e, true);
28256        closeArray();
28257        if (anyHasExtras(element.getPrefix())) {
28258          openArray("_prefix");
28259          for (StringType e : element.getPrefix()) 
28260            composeStringExtras(null, e, true);
28261          closeArray();
28262        }
28263      };
28264      if (element.hasSuffix()) {
28265        openArray("suffix");
28266        for (StringType e : element.getSuffix()) 
28267          composeStringCore(null, e, true);
28268        closeArray();
28269        if (anyHasExtras(element.getSuffix())) {
28270          openArray("_suffix");
28271          for (StringType e : element.getSuffix()) 
28272            composeStringExtras(null, e, true);
28273          closeArray();
28274        }
28275      };
28276      if (element.hasPeriod()) {
28277        composePeriod("period", element.getPeriod());
28278      }
28279  }
28280
28281  protected void composeContactPoint(String name, ContactPoint element) throws IOException {
28282    if (element != null) {
28283      open(name);
28284      composeContactPointInner(element);
28285      close();
28286    }
28287  }
28288
28289  protected void composeContactPointInner(ContactPoint element) throws IOException {
28290      composeElement(element);
28291      if (element.hasSystemElement()) {
28292        composeEnumerationCore("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
28293        composeEnumerationExtras("system", element.getSystemElement(), new ContactPoint.ContactPointSystemEnumFactory(), false);
28294      }
28295      if (element.hasValueElement()) {
28296        composeStringCore("value", element.getValueElement(), false);
28297        composeStringExtras("value", element.getValueElement(), false);
28298      }
28299      if (element.hasUseElement()) {
28300        composeEnumerationCore("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
28301        composeEnumerationExtras("use", element.getUseElement(), new ContactPoint.ContactPointUseEnumFactory(), false);
28302      }
28303      if (element.hasRankElement()) {
28304        composePositiveIntCore("rank", element.getRankElement(), false);
28305        composePositiveIntExtras("rank", element.getRankElement(), false);
28306      }
28307      if (element.hasPeriod()) {
28308        composePeriod("period", element.getPeriod());
28309      }
28310  }
28311
28312  protected void composeIdentifier(String name, Identifier element) throws IOException {
28313    if (element != null) {
28314      open(name);
28315      composeIdentifierInner(element);
28316      close();
28317    }
28318  }
28319
28320  protected void composeIdentifierInner(Identifier element) throws IOException {
28321      composeElement(element);
28322      if (element.hasUseElement()) {
28323        composeEnumerationCore("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
28324        composeEnumerationExtras("use", element.getUseElement(), new Identifier.IdentifierUseEnumFactory(), false);
28325      }
28326      if (element.hasType()) {
28327        composeCodeableConcept("type", element.getType());
28328      }
28329      if (element.hasSystemElement()) {
28330        composeUriCore("system", element.getSystemElement(), false);
28331        composeUriExtras("system", element.getSystemElement(), false);
28332      }
28333      if (element.hasValueElement()) {
28334        composeStringCore("value", element.getValueElement(), false);
28335        composeStringExtras("value", element.getValueElement(), false);
28336      }
28337      if (element.hasPeriod()) {
28338        composePeriod("period", element.getPeriod());
28339      }
28340      if (element.hasAssigner()) {
28341        composeReference("assigner", element.getAssigner());
28342      }
28343  }
28344
28345  protected void composeCoding(String name, Coding element) throws IOException {
28346    if (element != null) {
28347      open(name);
28348      composeCodingInner(element);
28349      close();
28350    }
28351  }
28352
28353  protected void composeCodingInner(Coding element) throws IOException {
28354      composeElement(element);
28355      if (element.hasSystemElement()) {
28356        composeUriCore("system", element.getSystemElement(), false);
28357        composeUriExtras("system", element.getSystemElement(), false);
28358      }
28359      if (element.hasVersionElement()) {
28360        composeStringCore("version", element.getVersionElement(), false);
28361        composeStringExtras("version", element.getVersionElement(), false);
28362      }
28363      if (element.hasCodeElement()) {
28364        composeCodeCore("code", element.getCodeElement(), false);
28365        composeCodeExtras("code", element.getCodeElement(), false);
28366      }
28367      if (element.hasDisplayElement()) {
28368        composeStringCore("display", element.getDisplayElement(), false);
28369        composeStringExtras("display", element.getDisplayElement(), false);
28370      }
28371      if (element.hasUserSelectedElement()) {
28372        composeBooleanCore("userSelected", element.getUserSelectedElement(), false);
28373        composeBooleanExtras("userSelected", element.getUserSelectedElement(), false);
28374      }
28375  }
28376
28377  protected void composeSampledData(String name, SampledData element) throws IOException {
28378    if (element != null) {
28379      open(name);
28380      composeSampledDataInner(element);
28381      close();
28382    }
28383  }
28384
28385  protected void composeSampledDataInner(SampledData element) throws IOException {
28386      composeElement(element);
28387      if (element.hasOrigin()) {
28388        composeQuantity("origin", element.getOrigin());
28389      }
28390      if (element.hasPeriodElement()) {
28391        composeDecimalCore("period", element.getPeriodElement(), false);
28392        composeDecimalExtras("period", element.getPeriodElement(), false);
28393      }
28394      if (element.hasFactorElement()) {
28395        composeDecimalCore("factor", element.getFactorElement(), false);
28396        composeDecimalExtras("factor", element.getFactorElement(), false);
28397      }
28398      if (element.hasLowerLimitElement()) {
28399        composeDecimalCore("lowerLimit", element.getLowerLimitElement(), false);
28400        composeDecimalExtras("lowerLimit", element.getLowerLimitElement(), false);
28401      }
28402      if (element.hasUpperLimitElement()) {
28403        composeDecimalCore("upperLimit", element.getUpperLimitElement(), false);
28404        composeDecimalExtras("upperLimit", element.getUpperLimitElement(), false);
28405      }
28406      if (element.hasDimensionsElement()) {
28407        composePositiveIntCore("dimensions", element.getDimensionsElement(), false);
28408        composePositiveIntExtras("dimensions", element.getDimensionsElement(), false);
28409      }
28410      if (element.hasDataElement()) {
28411        composeStringCore("data", element.getDataElement(), false);
28412        composeStringExtras("data", element.getDataElement(), false);
28413      }
28414  }
28415
28416  protected void composeRatio(String name, Ratio element) throws IOException {
28417    if (element != null) {
28418      open(name);
28419      composeRatioInner(element);
28420      close();
28421    }
28422  }
28423
28424  protected void composeRatioInner(Ratio element) throws IOException {
28425      composeElement(element);
28426      if (element.hasNumerator()) {
28427        composeQuantity("numerator", element.getNumerator());
28428      }
28429      if (element.hasDenominator()) {
28430        composeQuantity("denominator", element.getDenominator());
28431      }
28432  }
28433
28434  protected void composeReference(String name, Reference element) throws IOException {
28435    if (element != null) {
28436      open(name);
28437      composeReferenceInner(element);
28438      close();
28439    }
28440  }
28441
28442  protected void composeReferenceInner(Reference element) throws IOException {
28443      composeElement(element);
28444      if (element.hasReferenceElement()) {
28445        composeStringCore("reference", element.getReferenceElement(), false);
28446        composeStringExtras("reference", element.getReferenceElement(), false);
28447      }
28448      if (element.hasTypeElement()) {
28449        composeUriCore("type", element.getTypeElement(), false);
28450        composeUriExtras("type", element.getTypeElement(), false);
28451      }
28452      if (element.hasIdentifier()) {
28453        composeIdentifier("identifier", element.getIdentifier());
28454      }
28455      if (element.hasDisplayElement()) {
28456        composeStringCore("display", element.getDisplayElement(), false);
28457        composeStringExtras("display", element.getDisplayElement(), false);
28458      }
28459  }
28460
28461  protected void composeTriggerDefinition(String name, TriggerDefinition element) throws IOException {
28462    if (element != null) {
28463      open(name);
28464      composeTriggerDefinitionInner(element);
28465      close();
28466    }
28467  }
28468
28469  protected void composeTriggerDefinitionInner(TriggerDefinition element) throws IOException {
28470      composeElement(element);
28471      if (element.hasTypeElement()) {
28472        composeEnumerationCore("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
28473        composeEnumerationExtras("type", element.getTypeElement(), new TriggerDefinition.TriggerTypeEnumFactory(), false);
28474      }
28475      if (element.hasNameElement()) {
28476        composeStringCore("name", element.getNameElement(), false);
28477        composeStringExtras("name", element.getNameElement(), false);
28478      }
28479      if (element.hasTiming()) {
28480        composeType("timing", element.getTiming());
28481      }
28482      if (element.hasData()) {
28483        composeDataRequirement("data", element.getData());
28484      }
28485      if (element.hasCondition()) {
28486        composeExpression("condition", element.getCondition());
28487      }
28488  }
28489
28490  protected void composeQuantity(String name, Quantity element) throws IOException {
28491    if (element != null) {
28492      open(name);
28493      composeQuantityInner(element);
28494      close();
28495    }
28496  }
28497
28498  protected void composeQuantityInner(Quantity element) throws IOException {
28499      composeElement(element);
28500      if (element.hasValueElement()) {
28501        composeDecimalCore("value", element.getValueElement(), false);
28502        composeDecimalExtras("value", element.getValueElement(), false);
28503      }
28504      if (element.hasComparatorElement()) {
28505        composeEnumerationCore("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
28506        composeEnumerationExtras("comparator", element.getComparatorElement(), new Quantity.QuantityComparatorEnumFactory(), false);
28507      }
28508      if (element.hasUnitElement()) {
28509        composeStringCore("unit", element.getUnitElement(), false);
28510        composeStringExtras("unit", element.getUnitElement(), false);
28511      }
28512      if (element.hasSystemElement()) {
28513        composeUriCore("system", element.getSystemElement(), false);
28514        composeUriExtras("system", element.getSystemElement(), false);
28515      }
28516      if (element.hasCodeElement()) {
28517        composeCodeCore("code", element.getCodeElement(), false);
28518        composeCodeExtras("code", element.getCodeElement(), false);
28519      }
28520  }
28521
28522  protected void composePeriod(String name, Period element) throws IOException {
28523    if (element != null) {
28524      open(name);
28525      composePeriodInner(element);
28526      close();
28527    }
28528  }
28529
28530  protected void composePeriodInner(Period element) throws IOException {
28531      composeElement(element);
28532      if (element.hasStartElement()) {
28533        composeDateTimeCore("start", element.getStartElement(), false);
28534        composeDateTimeExtras("start", element.getStartElement(), false);
28535      }
28536      if (element.hasEndElement()) {
28537        composeDateTimeCore("end", element.getEndElement(), false);
28538        composeDateTimeExtras("end", element.getEndElement(), false);
28539      }
28540  }
28541
28542  protected void composeRange(String name, Range element) throws IOException {
28543    if (element != null) {
28544      open(name);
28545      composeRangeInner(element);
28546      close();
28547    }
28548  }
28549
28550  protected void composeRangeInner(Range element) throws IOException {
28551      composeElement(element);
28552      if (element.hasLow()) {
28553        composeQuantity("low", element.getLow());
28554      }
28555      if (element.hasHigh()) {
28556        composeQuantity("high", element.getHigh());
28557      }
28558  }
28559
28560  protected void composeRelatedArtifact(String name, RelatedArtifact element) throws IOException {
28561    if (element != null) {
28562      open(name);
28563      composeRelatedArtifactInner(element);
28564      close();
28565    }
28566  }
28567
28568  protected void composeRelatedArtifactInner(RelatedArtifact element) throws IOException {
28569      composeElement(element);
28570      if (element.hasTypeElement()) {
28571        composeEnumerationCore("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
28572        composeEnumerationExtras("type", element.getTypeElement(), new RelatedArtifact.RelatedArtifactTypeEnumFactory(), false);
28573      }
28574      if (element.hasDisplayElement()) {
28575        composeStringCore("display", element.getDisplayElement(), false);
28576        composeStringExtras("display", element.getDisplayElement(), false);
28577      }
28578      if (element.hasCitationElement()) {
28579        composeStringCore("citation", element.getCitationElement(), false);
28580        composeStringExtras("citation", element.getCitationElement(), false);
28581      }
28582      if (element.hasUrlElement()) {
28583        composeUrlCore("url", element.getUrlElement(), false);
28584        composeUrlExtras("url", element.getUrlElement(), false);
28585      }
28586      if (element.hasDocument()) {
28587        composeAttachment("document", element.getDocument());
28588      }
28589      if (element.hasResourceElement()) {
28590        composeCanonicalCore("resource", element.getResourceElement(), false);
28591        composeCanonicalExtras("resource", element.getResourceElement(), false);
28592      }
28593  }
28594
28595  protected void composeAnnotation(String name, Annotation element) throws IOException {
28596    if (element != null) {
28597      open(name);
28598      composeAnnotationInner(element);
28599      close();
28600    }
28601  }
28602
28603  protected void composeAnnotationInner(Annotation element) throws IOException {
28604      composeElement(element);
28605      if (element.hasAuthor()) {
28606        composeType("author", element.getAuthor());
28607      }
28608      if (element.hasTimeElement()) {
28609        composeDateTimeCore("time", element.getTimeElement(), false);
28610        composeDateTimeExtras("time", element.getTimeElement(), false);
28611      }
28612      if (element.hasTextElement()) {
28613        composeMarkdownCore("text", element.getTextElement(), false);
28614        composeMarkdownExtras("text", element.getTextElement(), false);
28615      }
28616  }
28617
28618  protected void composeContactDetail(String name, ContactDetail element) throws IOException {
28619    if (element != null) {
28620      open(name);
28621      composeContactDetailInner(element);
28622      close();
28623    }
28624  }
28625
28626  protected void composeContactDetailInner(ContactDetail element) throws IOException {
28627      composeElement(element);
28628      if (element.hasNameElement()) {
28629        composeStringCore("name", element.getNameElement(), false);
28630        composeStringExtras("name", element.getNameElement(), false);
28631      }
28632      if (element.hasTelecom()) {
28633        openArray("telecom");
28634        for (ContactPoint e : element.getTelecom()) 
28635          composeContactPoint(null, e);
28636        closeArray();
28637      };
28638  }
28639
28640  protected void composeUsageContext(String name, UsageContext element) throws IOException {
28641    if (element != null) {
28642      open(name);
28643      composeUsageContextInner(element);
28644      close();
28645    }
28646  }
28647
28648  protected void composeUsageContextInner(UsageContext element) throws IOException {
28649      composeElement(element);
28650      if (element.hasCode()) {
28651        composeCoding("code", element.getCode());
28652      }
28653      if (element.hasValue()) {
28654        composeType("value", element.getValue());
28655      }
28656  }
28657
28658  protected void composeExpression(String name, Expression element) throws IOException {
28659    if (element != null) {
28660      open(name);
28661      composeExpressionInner(element);
28662      close();
28663    }
28664  }
28665
28666  protected void composeExpressionInner(Expression element) throws IOException {
28667      composeElement(element);
28668      if (element.hasDescriptionElement()) {
28669        composeStringCore("description", element.getDescriptionElement(), false);
28670        composeStringExtras("description", element.getDescriptionElement(), false);
28671      }
28672      if (element.hasNameElement()) {
28673        composeIdCore("name", element.getNameElement(), false);
28674        composeIdExtras("name", element.getNameElement(), false);
28675      }
28676      if (element.hasLanguageElement()) {
28677        composeEnumerationCore("language", element.getLanguageElement(), new Expression.ExpressionLanguageEnumFactory(), false);
28678        composeEnumerationExtras("language", element.getLanguageElement(), new Expression.ExpressionLanguageEnumFactory(), false);
28679      }
28680      if (element.hasExpressionElement()) {
28681        composeStringCore("expression", element.getExpressionElement(), false);
28682        composeStringExtras("expression", element.getExpressionElement(), false);
28683      }
28684      if (element.hasReferenceElement()) {
28685        composeUriCore("reference", element.getReferenceElement(), false);
28686        composeUriExtras("reference", element.getReferenceElement(), false);
28687      }
28688  }
28689
28690  protected void composeSignature(String name, Signature element) throws IOException {
28691    if (element != null) {
28692      open(name);
28693      composeSignatureInner(element);
28694      close();
28695    }
28696  }
28697
28698  protected void composeSignatureInner(Signature element) throws IOException {
28699      composeElement(element);
28700      if (element.hasType()) {
28701        openArray("type");
28702        for (Coding e : element.getType()) 
28703          composeCoding(null, e);
28704        closeArray();
28705      };
28706      if (element.hasWhenElement()) {
28707        composeInstantCore("when", element.getWhenElement(), false);
28708        composeInstantExtras("when", element.getWhenElement(), false);
28709      }
28710      if (element.hasWho()) {
28711        composeReference("who", element.getWho());
28712      }
28713      if (element.hasOnBehalfOf()) {
28714        composeReference("onBehalfOf", element.getOnBehalfOf());
28715      }
28716      if (element.hasTargetFormatElement()) {
28717        composeCodeCore("targetFormat", element.getTargetFormatElement(), false);
28718        composeCodeExtras("targetFormat", element.getTargetFormatElement(), false);
28719      }
28720      if (element.hasSigFormatElement()) {
28721        composeCodeCore("sigFormat", element.getSigFormatElement(), false);
28722        composeCodeExtras("sigFormat", element.getSigFormatElement(), false);
28723      }
28724      if (element.hasDataElement()) {
28725        composeBase64BinaryCore("data", element.getDataElement(), false);
28726        composeBase64BinaryExtras("data", element.getDataElement(), false);
28727      }
28728  }
28729
28730  protected void composeCodeableConcept(String name, CodeableConcept element) throws IOException {
28731    if (element != null) {
28732      open(name);
28733      composeCodeableConceptInner(element);
28734      close();
28735    }
28736  }
28737
28738  protected void composeCodeableConceptInner(CodeableConcept element) throws IOException {
28739      composeElement(element);
28740      if (element.hasCoding()) {
28741        openArray("coding");
28742        for (Coding e : element.getCoding()) 
28743          composeCoding(null, e);
28744        closeArray();
28745      };
28746      if (element.hasTextElement()) {
28747        composeStringCore("text", element.getTextElement(), false);
28748        composeStringExtras("text", element.getTextElement(), false);
28749      }
28750  }
28751
28752  protected void composeParameterDefinition(String name, ParameterDefinition element) throws IOException {
28753    if (element != null) {
28754      open(name);
28755      composeParameterDefinitionInner(element);
28756      close();
28757    }
28758  }
28759
28760  protected void composeParameterDefinitionInner(ParameterDefinition element) throws IOException {
28761      composeElement(element);
28762      if (element.hasNameElement()) {
28763        composeCodeCore("name", element.getNameElement(), false);
28764        composeCodeExtras("name", element.getNameElement(), false);
28765      }
28766      if (element.hasUseElement()) {
28767        composeEnumerationCore("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
28768        composeEnumerationExtras("use", element.getUseElement(), new ParameterDefinition.ParameterUseEnumFactory(), false);
28769      }
28770      if (element.hasMinElement()) {
28771        composeIntegerCore("min", element.getMinElement(), false);
28772        composeIntegerExtras("min", element.getMinElement(), false);
28773      }
28774      if (element.hasMaxElement()) {
28775        composeStringCore("max", element.getMaxElement(), false);
28776        composeStringExtras("max", element.getMaxElement(), false);
28777      }
28778      if (element.hasDocumentationElement()) {
28779        composeStringCore("documentation", element.getDocumentationElement(), false);
28780        composeStringExtras("documentation", element.getDocumentationElement(), false);
28781      }
28782      if (element.hasTypeElement()) {
28783        composeCodeCore("type", element.getTypeElement(), false);
28784        composeCodeExtras("type", element.getTypeElement(), false);
28785      }
28786      if (element.hasProfileElement()) {
28787        composeCanonicalCore("profile", element.getProfileElement(), false);
28788        composeCanonicalExtras("profile", element.getProfileElement(), false);
28789      }
28790  }
28791
28792  protected void composeMarketingStatus(String name, MarketingStatus element) throws IOException {
28793    if (element != null) {
28794      open(name);
28795      composeMarketingStatusInner(element);
28796      close();
28797    }
28798  }
28799
28800  protected void composeMarketingStatusInner(MarketingStatus element) throws IOException {
28801      composeBackbone(element);
28802      if (element.hasCountry()) {
28803        composeCodeableConcept("country", element.getCountry());
28804      }
28805      if (element.hasJurisdiction()) {
28806        composeCodeableConcept("jurisdiction", element.getJurisdiction());
28807      }
28808      if (element.hasStatus()) {
28809        composeCodeableConcept("status", element.getStatus());
28810      }
28811      if (element.hasDateRange()) {
28812        composePeriod("dateRange", element.getDateRange());
28813      }
28814      if (element.hasRestoreDateElement()) {
28815        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
28816        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
28817      }
28818  }
28819
28820  protected void composeSubstanceAmount(String name, SubstanceAmount element) throws IOException {
28821    if (element != null) {
28822      open(name);
28823      composeSubstanceAmountInner(element);
28824      close();
28825    }
28826  }
28827
28828  protected void composeSubstanceAmountInner(SubstanceAmount element) throws IOException {
28829      composeBackbone(element);
28830      if (element.hasAmount()) {
28831        composeType("amount", element.getAmount());
28832      }
28833      if (element.hasAmountType()) {
28834        composeCodeableConcept("amountType", element.getAmountType());
28835      }
28836      if (element.hasAmountTextElement()) {
28837        composeStringCore("amountText", element.getAmountTextElement(), false);
28838        composeStringExtras("amountText", element.getAmountTextElement(), false);
28839      }
28840      if (element.hasReferenceRange()) {
28841        composeSubstanceAmountSubstanceAmountReferenceRangeComponent("referenceRange", element.getReferenceRange());
28842      }
28843  }
28844
28845  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponent(String name, SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
28846    if (element != null) {
28847      open(name);
28848      composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(element);
28849      close();
28850    }
28851  }
28852
28853  protected void composeSubstanceAmountSubstanceAmountReferenceRangeComponentInner(SubstanceAmount.SubstanceAmountReferenceRangeComponent element) throws IOException {
28854      composeElement(element);
28855      if (element.hasLowLimit()) {
28856        composeQuantity("lowLimit", element.getLowLimit());
28857      }
28858      if (element.hasHighLimit()) {
28859        composeQuantity("highLimit", element.getHighLimit());
28860      }
28861  }
28862
28863  protected void composeElementDefinition(String name, ElementDefinition element) throws IOException {
28864    if (element != null) {
28865      open(name);
28866      composeElementDefinitionInner(element);
28867      close();
28868    }
28869  }
28870
28871  protected void composeElementDefinitionInner(ElementDefinition element) throws IOException {
28872      composeBackbone(element);
28873      if (element.hasPathElement()) {
28874        composeStringCore("path", element.getPathElement(), false);
28875        composeStringExtras("path", element.getPathElement(), false);
28876      }
28877      if (element.hasRepresentation()) {
28878        openArray("representation");
28879        for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
28880          composeEnumerationCore(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
28881        closeArray();
28882        if (anyHasExtras(element.getRepresentation())) {
28883          openArray("_representation");
28884          for (Enumeration<ElementDefinition.PropertyRepresentation> e : element.getRepresentation()) 
28885            composeEnumerationExtras(null, e, new ElementDefinition.PropertyRepresentationEnumFactory(), true);
28886          closeArray();
28887        }
28888      };
28889      if (element.hasSliceNameElement()) {
28890        composeStringCore("sliceName", element.getSliceNameElement(), false);
28891        composeStringExtras("sliceName", element.getSliceNameElement(), false);
28892      }
28893      if (element.hasSliceIsConstrainingElement()) {
28894        composeBooleanCore("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
28895        composeBooleanExtras("sliceIsConstraining", element.getSliceIsConstrainingElement(), false);
28896      }
28897      if (element.hasLabelElement()) {
28898        composeStringCore("label", element.getLabelElement(), false);
28899        composeStringExtras("label", element.getLabelElement(), false);
28900      }
28901      if (element.hasCode()) {
28902        openArray("code");
28903        for (Coding e : element.getCode()) 
28904          composeCoding(null, e);
28905        closeArray();
28906      };
28907      if (element.hasSlicing()) {
28908        composeElementDefinitionElementDefinitionSlicingComponent("slicing", element.getSlicing());
28909      }
28910      if (element.hasShortElement()) {
28911        composeStringCore("short", element.getShortElement(), false);
28912        composeStringExtras("short", element.getShortElement(), false);
28913      }
28914      if (element.hasDefinitionElement()) {
28915        composeMarkdownCore("definition", element.getDefinitionElement(), false);
28916        composeMarkdownExtras("definition", element.getDefinitionElement(), false);
28917      }
28918      if (element.hasCommentElement()) {
28919        composeMarkdownCore("comment", element.getCommentElement(), false);
28920        composeMarkdownExtras("comment", element.getCommentElement(), false);
28921      }
28922      if (element.hasRequirementsElement()) {
28923        composeMarkdownCore("requirements", element.getRequirementsElement(), false);
28924        composeMarkdownExtras("requirements", element.getRequirementsElement(), false);
28925      }
28926      if (element.hasAlias()) {
28927        openArray("alias");
28928        for (StringType e : element.getAlias()) 
28929          composeStringCore(null, e, true);
28930        closeArray();
28931        if (anyHasExtras(element.getAlias())) {
28932          openArray("_alias");
28933          for (StringType e : element.getAlias()) 
28934            composeStringExtras(null, e, true);
28935          closeArray();
28936        }
28937      };
28938      if (element.hasMinElement()) {
28939        composeUnsignedIntCore("min", element.getMinElement(), false);
28940        composeUnsignedIntExtras("min", element.getMinElement(), false);
28941      }
28942      if (element.hasMaxElement()) {
28943        composeStringCore("max", element.getMaxElement(), false);
28944        composeStringExtras("max", element.getMaxElement(), false);
28945      }
28946      if (element.hasBase()) {
28947        composeElementDefinitionElementDefinitionBaseComponent("base", element.getBase());
28948      }
28949      if (element.hasContentReferenceElement()) {
28950        composeUriCore("contentReference", element.getContentReferenceElement(), false);
28951        composeUriExtras("contentReference", element.getContentReferenceElement(), false);
28952      }
28953      if (element.hasType()) {
28954        openArray("type");
28955        for (ElementDefinition.TypeRefComponent e : element.getType()) 
28956          composeElementDefinitionTypeRefComponent(null, e);
28957        closeArray();
28958      };
28959      if (element.hasDefaultValue()) {
28960        composeType("defaultValue", element.getDefaultValue());
28961      }
28962      if (element.hasMeaningWhenMissingElement()) {
28963        composeMarkdownCore("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
28964        composeMarkdownExtras("meaningWhenMissing", element.getMeaningWhenMissingElement(), false);
28965      }
28966      if (element.hasOrderMeaningElement()) {
28967        composeStringCore("orderMeaning", element.getOrderMeaningElement(), false);
28968        composeStringExtras("orderMeaning", element.getOrderMeaningElement(), false);
28969      }
28970      if (element.hasFixed()) {
28971        composeType("fixed", element.getFixed());
28972      }
28973      if (element.hasPattern()) {
28974        composeType("pattern", element.getPattern());
28975      }
28976      if (element.hasExample()) {
28977        openArray("example");
28978        for (ElementDefinition.ElementDefinitionExampleComponent e : element.getExample()) 
28979          composeElementDefinitionElementDefinitionExampleComponent(null, e);
28980        closeArray();
28981      };
28982      if (element.hasMinValue()) {
28983        composeType("minValue", element.getMinValue());
28984      }
28985      if (element.hasMaxValue()) {
28986        composeType("maxValue", element.getMaxValue());
28987      }
28988      if (element.hasMaxLengthElement()) {
28989        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
28990        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
28991      }
28992      if (element.hasCondition()) {
28993        openArray("condition");
28994        for (IdType e : element.getCondition()) 
28995          composeIdCore(null, e, true);
28996        closeArray();
28997        if (anyHasExtras(element.getCondition())) {
28998          openArray("_condition");
28999          for (IdType e : element.getCondition()) 
29000            composeIdExtras(null, e, true);
29001          closeArray();
29002        }
29003      };
29004      if (element.hasConstraint()) {
29005        openArray("constraint");
29006        for (ElementDefinition.ElementDefinitionConstraintComponent e : element.getConstraint()) 
29007          composeElementDefinitionElementDefinitionConstraintComponent(null, e);
29008        closeArray();
29009      };
29010      if (element.hasMustSupportElement()) {
29011        composeBooleanCore("mustSupport", element.getMustSupportElement(), false);
29012        composeBooleanExtras("mustSupport", element.getMustSupportElement(), false);
29013      }
29014      if (element.hasIsModifierElement()) {
29015        composeBooleanCore("isModifier", element.getIsModifierElement(), false);
29016        composeBooleanExtras("isModifier", element.getIsModifierElement(), false);
29017      }
29018      if (element.hasIsModifierReasonElement()) {
29019        composeStringCore("isModifierReason", element.getIsModifierReasonElement(), false);
29020        composeStringExtras("isModifierReason", element.getIsModifierReasonElement(), false);
29021      }
29022      if (element.hasIsSummaryElement()) {
29023        composeBooleanCore("isSummary", element.getIsSummaryElement(), false);
29024        composeBooleanExtras("isSummary", element.getIsSummaryElement(), false);
29025      }
29026      if (element.hasBinding()) {
29027        composeElementDefinitionElementDefinitionBindingComponent("binding", element.getBinding());
29028      }
29029      if (element.hasMapping()) {
29030        openArray("mapping");
29031        for (ElementDefinition.ElementDefinitionMappingComponent e : element.getMapping()) 
29032          composeElementDefinitionElementDefinitionMappingComponent(null, e);
29033        closeArray();
29034      };
29035  }
29036
29037  protected void composeElementDefinitionElementDefinitionSlicingComponent(String name, ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
29038    if (element != null) {
29039      open(name);
29040      composeElementDefinitionElementDefinitionSlicingComponentInner(element);
29041      close();
29042    }
29043  }
29044
29045  protected void composeElementDefinitionElementDefinitionSlicingComponentInner(ElementDefinition.ElementDefinitionSlicingComponent element) throws IOException {
29046      composeElement(element);
29047      if (element.hasDiscriminator()) {
29048        openArray("discriminator");
29049        for (ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent e : element.getDiscriminator()) 
29050          composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(null, e);
29051        closeArray();
29052      };
29053      if (element.hasDescriptionElement()) {
29054        composeStringCore("description", element.getDescriptionElement(), false);
29055        composeStringExtras("description", element.getDescriptionElement(), false);
29056      }
29057      if (element.hasOrderedElement()) {
29058        composeBooleanCore("ordered", element.getOrderedElement(), false);
29059        composeBooleanExtras("ordered", element.getOrderedElement(), false);
29060      }
29061      if (element.hasRulesElement()) {
29062        composeEnumerationCore("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
29063        composeEnumerationExtras("rules", element.getRulesElement(), new ElementDefinition.SlicingRulesEnumFactory(), false);
29064      }
29065  }
29066
29067  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponent(String name, ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
29068    if (element != null) {
29069      open(name);
29070      composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(element);
29071      close();
29072    }
29073  }
29074
29075  protected void composeElementDefinitionElementDefinitionSlicingDiscriminatorComponentInner(ElementDefinition.ElementDefinitionSlicingDiscriminatorComponent element) throws IOException {
29076      composeElement(element);
29077      if (element.hasTypeElement()) {
29078        composeEnumerationCore("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
29079        composeEnumerationExtras("type", element.getTypeElement(), new ElementDefinition.DiscriminatorTypeEnumFactory(), false);
29080      }
29081      if (element.hasPathElement()) {
29082        composeStringCore("path", element.getPathElement(), false);
29083        composeStringExtras("path", element.getPathElement(), false);
29084      }
29085  }
29086
29087  protected void composeElementDefinitionElementDefinitionBaseComponent(String name, ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
29088    if (element != null) {
29089      open(name);
29090      composeElementDefinitionElementDefinitionBaseComponentInner(element);
29091      close();
29092    }
29093  }
29094
29095  protected void composeElementDefinitionElementDefinitionBaseComponentInner(ElementDefinition.ElementDefinitionBaseComponent element) throws IOException {
29096      composeElement(element);
29097      if (element.hasPathElement()) {
29098        composeStringCore("path", element.getPathElement(), false);
29099        composeStringExtras("path", element.getPathElement(), false);
29100      }
29101      if (element.hasMinElement()) {
29102        composeUnsignedIntCore("min", element.getMinElement(), false);
29103        composeUnsignedIntExtras("min", element.getMinElement(), false);
29104      }
29105      if (element.hasMaxElement()) {
29106        composeStringCore("max", element.getMaxElement(), false);
29107        composeStringExtras("max", element.getMaxElement(), false);
29108      }
29109  }
29110
29111  protected void composeElementDefinitionTypeRefComponent(String name, ElementDefinition.TypeRefComponent element) throws IOException {
29112    if (element != null) {
29113      open(name);
29114      composeElementDefinitionTypeRefComponentInner(element);
29115      close();
29116    }
29117  }
29118
29119  protected void composeElementDefinitionTypeRefComponentInner(ElementDefinition.TypeRefComponent element) throws IOException {
29120      composeElement(element);
29121      if (element.hasCodeElement()) {
29122        composeUriCore("code", element.getCodeElement(), false);
29123        composeUriExtras("code", element.getCodeElement(), false);
29124      }
29125      if (element.hasProfile()) {
29126        openArray("profile");
29127        for (CanonicalType e : element.getProfile()) 
29128          composeCanonicalCore(null, e, true);
29129        closeArray();
29130        if (anyHasExtras(element.getProfile())) {
29131          openArray("_profile");
29132          for (CanonicalType e : element.getProfile()) 
29133            composeCanonicalExtras(null, e, true);
29134          closeArray();
29135        }
29136      };
29137      if (element.hasTargetProfile()) {
29138        openArray("targetProfile");
29139        for (CanonicalType e : element.getTargetProfile()) 
29140          composeCanonicalCore(null, e, true);
29141        closeArray();
29142        if (anyHasExtras(element.getTargetProfile())) {
29143          openArray("_targetProfile");
29144          for (CanonicalType e : element.getTargetProfile()) 
29145            composeCanonicalExtras(null, e, true);
29146          closeArray();
29147        }
29148      };
29149      if (element.hasAggregation()) {
29150        openArray("aggregation");
29151        for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
29152          composeEnumerationCore(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
29153        closeArray();
29154        if (anyHasExtras(element.getAggregation())) {
29155          openArray("_aggregation");
29156          for (Enumeration<ElementDefinition.AggregationMode> e : element.getAggregation()) 
29157            composeEnumerationExtras(null, e, new ElementDefinition.AggregationModeEnumFactory(), true);
29158          closeArray();
29159        }
29160      };
29161      if (element.hasVersioningElement()) {
29162        composeEnumerationCore("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
29163        composeEnumerationExtras("versioning", element.getVersioningElement(), new ElementDefinition.ReferenceVersionRulesEnumFactory(), false);
29164      }
29165  }
29166
29167  protected void composeElementDefinitionElementDefinitionExampleComponent(String name, ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
29168    if (element != null) {
29169      open(name);
29170      composeElementDefinitionElementDefinitionExampleComponentInner(element);
29171      close();
29172    }
29173  }
29174
29175  protected void composeElementDefinitionElementDefinitionExampleComponentInner(ElementDefinition.ElementDefinitionExampleComponent element) throws IOException {
29176      composeElement(element);
29177      if (element.hasLabelElement()) {
29178        composeStringCore("label", element.getLabelElement(), false);
29179        composeStringExtras("label", element.getLabelElement(), false);
29180      }
29181      if (element.hasValue()) {
29182        composeType("value", element.getValue());
29183      }
29184  }
29185
29186  protected void composeElementDefinitionElementDefinitionConstraintComponent(String name, ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
29187    if (element != null) {
29188      open(name);
29189      composeElementDefinitionElementDefinitionConstraintComponentInner(element);
29190      close();
29191    }
29192  }
29193
29194  protected void composeElementDefinitionElementDefinitionConstraintComponentInner(ElementDefinition.ElementDefinitionConstraintComponent element) throws IOException {
29195      composeElement(element);
29196      if (element.hasKeyElement()) {
29197        composeIdCore("key", element.getKeyElement(), false);
29198        composeIdExtras("key", element.getKeyElement(), false);
29199      }
29200      if (element.hasRequirementsElement()) {
29201        composeStringCore("requirements", element.getRequirementsElement(), false);
29202        composeStringExtras("requirements", element.getRequirementsElement(), false);
29203      }
29204      if (element.hasSeverityElement()) {
29205        composeEnumerationCore("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
29206        composeEnumerationExtras("severity", element.getSeverityElement(), new ElementDefinition.ConstraintSeverityEnumFactory(), false);
29207      }
29208      if (element.hasHumanElement()) {
29209        composeStringCore("human", element.getHumanElement(), false);
29210        composeStringExtras("human", element.getHumanElement(), false);
29211      }
29212      if (element.hasExpressionElement()) {
29213        composeStringCore("expression", element.getExpressionElement(), false);
29214        composeStringExtras("expression", element.getExpressionElement(), false);
29215      }
29216      if (element.hasXpathElement()) {
29217        composeStringCore("xpath", element.getXpathElement(), false);
29218        composeStringExtras("xpath", element.getXpathElement(), false);
29219      }
29220      if (element.hasSourceElement()) {
29221        composeCanonicalCore("source", element.getSourceElement(), false);
29222        composeCanonicalExtras("source", element.getSourceElement(), false);
29223      }
29224  }
29225
29226  protected void composeElementDefinitionElementDefinitionBindingComponent(String name, ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
29227    if (element != null) {
29228      open(name);
29229      composeElementDefinitionElementDefinitionBindingComponentInner(element);
29230      close();
29231    }
29232  }
29233
29234  protected void composeElementDefinitionElementDefinitionBindingComponentInner(ElementDefinition.ElementDefinitionBindingComponent element) throws IOException {
29235      composeElement(element);
29236      if (element.hasStrengthElement()) {
29237        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
29238        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
29239      }
29240      if (element.hasDescriptionElement()) {
29241        composeStringCore("description", element.getDescriptionElement(), false);
29242        composeStringExtras("description", element.getDescriptionElement(), false);
29243      }
29244      if (element.hasValueSetElement()) {
29245        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
29246        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
29247      }
29248  }
29249
29250  protected void composeElementDefinitionElementDefinitionMappingComponent(String name, ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
29251    if (element != null) {
29252      open(name);
29253      composeElementDefinitionElementDefinitionMappingComponentInner(element);
29254      close();
29255    }
29256  }
29257
29258  protected void composeElementDefinitionElementDefinitionMappingComponentInner(ElementDefinition.ElementDefinitionMappingComponent element) throws IOException {
29259      composeElement(element);
29260      if (element.hasIdentityElement()) {
29261        composeIdCore("identity", element.getIdentityElement(), false);
29262        composeIdExtras("identity", element.getIdentityElement(), false);
29263      }
29264      if (element.hasLanguageElement()) {
29265        composeCodeCore("language", element.getLanguageElement(), false);
29266        composeCodeExtras("language", element.getLanguageElement(), false);
29267      }
29268      if (element.hasMapElement()) {
29269        composeStringCore("map", element.getMapElement(), false);
29270        composeStringExtras("map", element.getMapElement(), false);
29271      }
29272      if (element.hasCommentElement()) {
29273        composeStringCore("comment", element.getCommentElement(), false);
29274        composeStringExtras("comment", element.getCommentElement(), false);
29275      }
29276  }
29277
29278  protected void composeSubstanceMoiety(String name, SubstanceMoiety element) throws IOException {
29279    if (element != null) {
29280      open(name);
29281      composeSubstanceMoietyInner(element);
29282      close();
29283    }
29284  }
29285
29286  protected void composeSubstanceMoietyInner(SubstanceMoiety element) throws IOException {
29287      composeBackbone(element);
29288      if (element.hasRole()) {
29289        composeCodeableConcept("role", element.getRole());
29290      }
29291      if (element.hasIdentifier()) {
29292        composeIdentifier("identifier", element.getIdentifier());
29293      }
29294      if (element.hasNameElement()) {
29295        composeStringCore("name", element.getNameElement(), false);
29296        composeStringExtras("name", element.getNameElement(), false);
29297      }
29298      if (element.hasStereochemistry()) {
29299        composeCodeableConcept("stereochemistry", element.getStereochemistry());
29300      }
29301      if (element.hasOpticalActivity()) {
29302        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
29303      }
29304      if (element.hasMolecularFormulaElement()) {
29305        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
29306        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
29307      }
29308      if (element.hasAmount()) {
29309        composeSubstanceAmount("amount", element.getAmount());
29310      }
29311  }
29312
29313  protected void composeProductShelfLife(String name, ProductShelfLife element) throws IOException {
29314    if (element != null) {
29315      open(name);
29316      composeProductShelfLifeInner(element);
29317      close();
29318    }
29319  }
29320
29321  protected void composeProductShelfLifeInner(ProductShelfLife element) throws IOException {
29322      composeBackbone(element);
29323      if (element.hasIdentifier()) {
29324        composeIdentifier("identifier", element.getIdentifier());
29325      }
29326      if (element.hasType()) {
29327        composeCodeableConcept("type", element.getType());
29328      }
29329      if (element.hasPeriod()) {
29330        composeQuantity("period", element.getPeriod());
29331      }
29332      if (element.hasSpecialPrecautionsForStorage()) {
29333        openArray("specialPrecautionsForStorage");
29334        for (CodeableConcept e : element.getSpecialPrecautionsForStorage()) 
29335          composeCodeableConcept(null, e);
29336        closeArray();
29337      };
29338  }
29339
29340  protected void composeProdCharacteristic(String name, ProdCharacteristic element) throws IOException {
29341    if (element != null) {
29342      open(name);
29343      composeProdCharacteristicInner(element);
29344      close();
29345    }
29346  }
29347
29348  protected void composeProdCharacteristicInner(ProdCharacteristic element) throws IOException {
29349      composeBackbone(element);
29350      if (element.hasHeight()) {
29351        composeQuantity("height", element.getHeight());
29352      }
29353      if (element.hasWidth()) {
29354        composeQuantity("width", element.getWidth());
29355      }
29356      if (element.hasDepth()) {
29357        composeQuantity("depth", element.getDepth());
29358      }
29359      if (element.hasWeight()) {
29360        composeQuantity("weight", element.getWeight());
29361      }
29362      if (element.hasNominalVolume()) {
29363        composeQuantity("nominalVolume", element.getNominalVolume());
29364      }
29365      if (element.hasExternalDiameter()) {
29366        composeQuantity("externalDiameter", element.getExternalDiameter());
29367      }
29368      if (element.hasShapeElement()) {
29369        composeStringCore("shape", element.getShapeElement(), false);
29370        composeStringExtras("shape", element.getShapeElement(), false);
29371      }
29372      if (element.hasColor()) {
29373        openArray("color");
29374        for (StringType e : element.getColor()) 
29375          composeStringCore(null, e, true);
29376        closeArray();
29377        if (anyHasExtras(element.getColor())) {
29378          openArray("_color");
29379          for (StringType e : element.getColor()) 
29380            composeStringExtras(null, e, true);
29381          closeArray();
29382        }
29383      };
29384      if (element.hasImprint()) {
29385        openArray("imprint");
29386        for (StringType e : element.getImprint()) 
29387          composeStringCore(null, e, true);
29388        closeArray();
29389        if (anyHasExtras(element.getImprint())) {
29390          openArray("_imprint");
29391          for (StringType e : element.getImprint()) 
29392            composeStringExtras(null, e, true);
29393          closeArray();
29394        }
29395      };
29396      if (element.hasImage()) {
29397        openArray("image");
29398        for (Attachment e : element.getImage()) 
29399          composeAttachment(null, e);
29400        closeArray();
29401      };
29402      if (element.hasScoring()) {
29403        composeCodeableConcept("scoring", element.getScoring());
29404      }
29405  }
29406
29407  protected void composeDomainResourceElements(DomainResource element) throws IOException {
29408      composeResourceElements(element);
29409      if (element.hasText()) {
29410        composeNarrative("text", element.getText());
29411      }
29412      if (element.hasContained()) {
29413        openArray("contained");
29414        for (Resource e : element.getContained()) {
29415          open(null);
29416          composeResource(e);
29417          close();
29418        }
29419        closeArray();
29420      };
29421      if (element.hasExtension()) {
29422        openArray("extension");
29423        for (Extension e : element.getExtension()) 
29424          composeExtension(null, e);
29425        closeArray();
29426      };
29427      if (element.hasModifierExtension()) {
29428        openArray("modifierExtension");
29429        for (Extension e : element.getModifierExtension()) 
29430          composeExtension(null, e);
29431        closeArray();
29432      };
29433  }
29434
29435  protected void composeParameters(String name, Parameters element) throws IOException {
29436    if (element != null) {
29437      prop("resourceType", name);
29438      composeParametersInner(element);
29439    }
29440  }
29441
29442  protected void composeParametersInner(Parameters element) throws IOException {
29443      composeResourceElements(element);
29444      if (element.hasParameter()) {
29445        openArray("parameter");
29446        for (Parameters.ParametersParameterComponent e : element.getParameter()) 
29447          composeParametersParametersParameterComponent(null, e);
29448        closeArray();
29449      };
29450  }
29451
29452  protected void composeParametersParametersParameterComponent(String name, Parameters.ParametersParameterComponent element) throws IOException {
29453    if (element != null) {
29454      open(name);
29455      composeParametersParametersParameterComponentInner(element);
29456      close();
29457    }
29458  }
29459
29460  protected void composeParametersParametersParameterComponentInner(Parameters.ParametersParameterComponent element) throws IOException {
29461      composeBackbone(element);
29462      if (element.hasNameElement()) {
29463        composeStringCore("name", element.getNameElement(), false);
29464        composeStringExtras("name", element.getNameElement(), false);
29465      }
29466      if (element.hasValue()) {
29467        composeType("value", element.getValue());
29468      }
29469        if (element.hasResource()) {
29470          open("resource");
29471          composeResource(element.getResource());
29472          close();
29473        }
29474      if (element.hasPart()) {
29475        openArray("part");
29476        for (Parameters.ParametersParameterComponent e : element.getPart()) 
29477          composeParametersParametersParameterComponent(null, e);
29478        closeArray();
29479      };
29480  }
29481
29482  protected void composeResourceElements(Resource element) throws IOException {
29483      if (element.hasIdElement()) {
29484        composeIdCore("id", element.getIdElement(), false);
29485        composeIdExtras("id", element.getIdElement(), false);
29486      }
29487      if (element.hasMeta()) {
29488        composeMeta("meta", element.getMeta());
29489      }
29490      if (element.hasImplicitRulesElement()) {
29491        composeUriCore("implicitRules", element.getImplicitRulesElement(), false);
29492        composeUriExtras("implicitRules", element.getImplicitRulesElement(), false);
29493      }
29494      if (element.hasLanguageElement()) {
29495        composeCodeCore("language", element.getLanguageElement(), false);
29496        composeCodeExtras("language", element.getLanguageElement(), false);
29497      }
29498  }
29499
29500  protected void composeAccount(String name, Account element) throws IOException {
29501    if (element != null) {
29502      prop("resourceType", name);
29503      composeAccountInner(element);
29504    }
29505  }
29506
29507  protected void composeAccountInner(Account element) throws IOException {
29508      composeDomainResourceElements(element);
29509      if (element.hasIdentifier()) {
29510        openArray("identifier");
29511        for (Identifier e : element.getIdentifier()) 
29512          composeIdentifier(null, e);
29513        closeArray();
29514      };
29515      if (element.hasStatusElement()) {
29516        composeEnumerationCore("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
29517        composeEnumerationExtras("status", element.getStatusElement(), new Account.AccountStatusEnumFactory(), false);
29518      }
29519      if (element.hasType()) {
29520        composeCodeableConcept("type", element.getType());
29521      }
29522      if (element.hasNameElement()) {
29523        composeStringCore("name", element.getNameElement(), false);
29524        composeStringExtras("name", element.getNameElement(), false);
29525      }
29526      if (element.hasSubject()) {
29527        openArray("subject");
29528        for (Reference e : element.getSubject()) 
29529          composeReference(null, e);
29530        closeArray();
29531      };
29532      if (element.hasServicePeriod()) {
29533        composePeriod("servicePeriod", element.getServicePeriod());
29534      }
29535      if (element.hasCoverage()) {
29536        openArray("coverage");
29537        for (Account.CoverageComponent e : element.getCoverage()) 
29538          composeAccountCoverageComponent(null, e);
29539        closeArray();
29540      };
29541      if (element.hasOwner()) {
29542        composeReference("owner", element.getOwner());
29543      }
29544      if (element.hasDescriptionElement()) {
29545        composeStringCore("description", element.getDescriptionElement(), false);
29546        composeStringExtras("description", element.getDescriptionElement(), false);
29547      }
29548      if (element.hasGuarantor()) {
29549        openArray("guarantor");
29550        for (Account.GuarantorComponent e : element.getGuarantor()) 
29551          composeAccountGuarantorComponent(null, e);
29552        closeArray();
29553      };
29554      if (element.hasPartOf()) {
29555        composeReference("partOf", element.getPartOf());
29556      }
29557  }
29558
29559  protected void composeAccountCoverageComponent(String name, Account.CoverageComponent element) throws IOException {
29560    if (element != null) {
29561      open(name);
29562      composeAccountCoverageComponentInner(element);
29563      close();
29564    }
29565  }
29566
29567  protected void composeAccountCoverageComponentInner(Account.CoverageComponent element) throws IOException {
29568      composeBackbone(element);
29569      if (element.hasCoverage()) {
29570        composeReference("coverage", element.getCoverage());
29571      }
29572      if (element.hasPriorityElement()) {
29573        composePositiveIntCore("priority", element.getPriorityElement(), false);
29574        composePositiveIntExtras("priority", element.getPriorityElement(), false);
29575      }
29576  }
29577
29578  protected void composeAccountGuarantorComponent(String name, Account.GuarantorComponent element) throws IOException {
29579    if (element != null) {
29580      open(name);
29581      composeAccountGuarantorComponentInner(element);
29582      close();
29583    }
29584  }
29585
29586  protected void composeAccountGuarantorComponentInner(Account.GuarantorComponent element) throws IOException {
29587      composeBackbone(element);
29588      if (element.hasParty()) {
29589        composeReference("party", element.getParty());
29590      }
29591      if (element.hasOnHoldElement()) {
29592        composeBooleanCore("onHold", element.getOnHoldElement(), false);
29593        composeBooleanExtras("onHold", element.getOnHoldElement(), false);
29594      }
29595      if (element.hasPeriod()) {
29596        composePeriod("period", element.getPeriod());
29597      }
29598  }
29599
29600  protected void composeActivityDefinition(String name, ActivityDefinition element) throws IOException {
29601    if (element != null) {
29602      prop("resourceType", name);
29603      composeActivityDefinitionInner(element);
29604    }
29605  }
29606
29607  protected void composeActivityDefinitionInner(ActivityDefinition element) throws IOException {
29608      composeDomainResourceElements(element);
29609      if (element.hasUrlElement()) {
29610        composeUriCore("url", element.getUrlElement(), false);
29611        composeUriExtras("url", element.getUrlElement(), false);
29612      }
29613      if (element.hasIdentifier()) {
29614        openArray("identifier");
29615        for (Identifier e : element.getIdentifier()) 
29616          composeIdentifier(null, e);
29617        closeArray();
29618      };
29619      if (element.hasVersionElement()) {
29620        composeStringCore("version", element.getVersionElement(), false);
29621        composeStringExtras("version", element.getVersionElement(), false);
29622      }
29623      if (element.hasNameElement()) {
29624        composeStringCore("name", element.getNameElement(), false);
29625        composeStringExtras("name", element.getNameElement(), false);
29626      }
29627      if (element.hasTitleElement()) {
29628        composeStringCore("title", element.getTitleElement(), false);
29629        composeStringExtras("title", element.getTitleElement(), false);
29630      }
29631      if (element.hasSubtitleElement()) {
29632        composeStringCore("subtitle", element.getSubtitleElement(), false);
29633        composeStringExtras("subtitle", element.getSubtitleElement(), false);
29634      }
29635      if (element.hasStatusElement()) {
29636        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
29637        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
29638      }
29639      if (element.hasExperimentalElement()) {
29640        composeBooleanCore("experimental", element.getExperimentalElement(), false);
29641        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
29642      }
29643      if (element.hasSubject()) {
29644        composeType("subject", element.getSubject());
29645      }
29646      if (element.hasDateElement()) {
29647        composeDateTimeCore("date", element.getDateElement(), false);
29648        composeDateTimeExtras("date", element.getDateElement(), false);
29649      }
29650      if (element.hasPublisherElement()) {
29651        composeStringCore("publisher", element.getPublisherElement(), false);
29652        composeStringExtras("publisher", element.getPublisherElement(), false);
29653      }
29654      if (element.hasContact()) {
29655        openArray("contact");
29656        for (ContactDetail e : element.getContact()) 
29657          composeContactDetail(null, e);
29658        closeArray();
29659      };
29660      if (element.hasDescriptionElement()) {
29661        composeMarkdownCore("description", element.getDescriptionElement(), false);
29662        composeMarkdownExtras("description", element.getDescriptionElement(), false);
29663      }
29664      if (element.hasUseContext()) {
29665        openArray("useContext");
29666        for (UsageContext e : element.getUseContext()) 
29667          composeUsageContext(null, e);
29668        closeArray();
29669      };
29670      if (element.hasJurisdiction()) {
29671        openArray("jurisdiction");
29672        for (CodeableConcept e : element.getJurisdiction()) 
29673          composeCodeableConcept(null, e);
29674        closeArray();
29675      };
29676      if (element.hasPurposeElement()) {
29677        composeMarkdownCore("purpose", element.getPurposeElement(), false);
29678        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
29679      }
29680      if (element.hasUsageElement()) {
29681        composeStringCore("usage", element.getUsageElement(), false);
29682        composeStringExtras("usage", element.getUsageElement(), false);
29683      }
29684      if (element.hasCopyrightElement()) {
29685        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
29686        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
29687      }
29688      if (element.hasApprovalDateElement()) {
29689        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
29690        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
29691      }
29692      if (element.hasLastReviewDateElement()) {
29693        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
29694        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
29695      }
29696      if (element.hasEffectivePeriod()) {
29697        composePeriod("effectivePeriod", element.getEffectivePeriod());
29698      }
29699      if (element.hasTopic()) {
29700        openArray("topic");
29701        for (CodeableConcept e : element.getTopic()) 
29702          composeCodeableConcept(null, e);
29703        closeArray();
29704      };
29705      if (element.hasAuthor()) {
29706        openArray("author");
29707        for (ContactDetail e : element.getAuthor()) 
29708          composeContactDetail(null, e);
29709        closeArray();
29710      };
29711      if (element.hasEditor()) {
29712        openArray("editor");
29713        for (ContactDetail e : element.getEditor()) 
29714          composeContactDetail(null, e);
29715        closeArray();
29716      };
29717      if (element.hasReviewer()) {
29718        openArray("reviewer");
29719        for (ContactDetail e : element.getReviewer()) 
29720          composeContactDetail(null, e);
29721        closeArray();
29722      };
29723      if (element.hasEndorser()) {
29724        openArray("endorser");
29725        for (ContactDetail e : element.getEndorser()) 
29726          composeContactDetail(null, e);
29727        closeArray();
29728      };
29729      if (element.hasRelatedArtifact()) {
29730        openArray("relatedArtifact");
29731        for (RelatedArtifact e : element.getRelatedArtifact()) 
29732          composeRelatedArtifact(null, e);
29733        closeArray();
29734      };
29735      if (element.hasLibrary()) {
29736        openArray("library");
29737        for (CanonicalType e : element.getLibrary()) 
29738          composeCanonicalCore(null, e, true);
29739        closeArray();
29740        if (anyHasExtras(element.getLibrary())) {
29741          openArray("_library");
29742          for (CanonicalType e : element.getLibrary()) 
29743            composeCanonicalExtras(null, e, true);
29744          closeArray();
29745        }
29746      };
29747      if (element.hasKindElement()) {
29748        composeEnumerationCore("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
29749        composeEnumerationExtras("kind", element.getKindElement(), new ActivityDefinition.ActivityDefinitionKindEnumFactory(), false);
29750      }
29751      if (element.hasProfileElement()) {
29752        composeCanonicalCore("profile", element.getProfileElement(), false);
29753        composeCanonicalExtras("profile", element.getProfileElement(), false);
29754      }
29755      if (element.hasCode()) {
29756        composeCodeableConcept("code", element.getCode());
29757      }
29758      if (element.hasIntentElement()) {
29759        composeEnumerationCore("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
29760        composeEnumerationExtras("intent", element.getIntentElement(), new ActivityDefinition.RequestIntentEnumFactory(), false);
29761      }
29762      if (element.hasPriorityElement()) {
29763        composeEnumerationCore("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
29764        composeEnumerationExtras("priority", element.getPriorityElement(), new ActivityDefinition.RequestPriorityEnumFactory(), false);
29765      }
29766      if (element.hasDoNotPerformElement()) {
29767        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
29768        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
29769      }
29770      if (element.hasTiming()) {
29771        composeType("timing", element.getTiming());
29772      }
29773      if (element.hasLocation()) {
29774        composeReference("location", element.getLocation());
29775      }
29776      if (element.hasParticipant()) {
29777        openArray("participant");
29778        for (ActivityDefinition.ActivityDefinitionParticipantComponent e : element.getParticipant()) 
29779          composeActivityDefinitionActivityDefinitionParticipantComponent(null, e);
29780        closeArray();
29781      };
29782      if (element.hasProduct()) {
29783        composeType("product", element.getProduct());
29784      }
29785      if (element.hasQuantity()) {
29786        composeQuantity("quantity", element.getQuantity());
29787      }
29788      if (element.hasDosage()) {
29789        openArray("dosage");
29790        for (Dosage e : element.getDosage()) 
29791          composeDosage(null, e);
29792        closeArray();
29793      };
29794      if (element.hasBodySite()) {
29795        openArray("bodySite");
29796        for (CodeableConcept e : element.getBodySite()) 
29797          composeCodeableConcept(null, e);
29798        closeArray();
29799      };
29800      if (element.hasSpecimenRequirement()) {
29801        openArray("specimenRequirement");
29802        for (Reference e : element.getSpecimenRequirement()) 
29803          composeReference(null, e);
29804        closeArray();
29805      };
29806      if (element.hasObservationRequirement()) {
29807        openArray("observationRequirement");
29808        for (Reference e : element.getObservationRequirement()) 
29809          composeReference(null, e);
29810        closeArray();
29811      };
29812      if (element.hasObservationResultRequirement()) {
29813        openArray("observationResultRequirement");
29814        for (Reference e : element.getObservationResultRequirement()) 
29815          composeReference(null, e);
29816        closeArray();
29817      };
29818      if (element.hasTransformElement()) {
29819        composeCanonicalCore("transform", element.getTransformElement(), false);
29820        composeCanonicalExtras("transform", element.getTransformElement(), false);
29821      }
29822      if (element.hasDynamicValue()) {
29823        openArray("dynamicValue");
29824        for (ActivityDefinition.ActivityDefinitionDynamicValueComponent e : element.getDynamicValue()) 
29825          composeActivityDefinitionActivityDefinitionDynamicValueComponent(null, e);
29826        closeArray();
29827      };
29828  }
29829
29830  protected void composeActivityDefinitionActivityDefinitionParticipantComponent(String name, ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
29831    if (element != null) {
29832      open(name);
29833      composeActivityDefinitionActivityDefinitionParticipantComponentInner(element);
29834      close();
29835    }
29836  }
29837
29838  protected void composeActivityDefinitionActivityDefinitionParticipantComponentInner(ActivityDefinition.ActivityDefinitionParticipantComponent element) throws IOException {
29839      composeBackbone(element);
29840      if (element.hasTypeElement()) {
29841        composeEnumerationCore("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
29842        composeEnumerationExtras("type", element.getTypeElement(), new ActivityDefinition.ActivityParticipantTypeEnumFactory(), false);
29843      }
29844      if (element.hasRole()) {
29845        composeCodeableConcept("role", element.getRole());
29846      }
29847  }
29848
29849  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponent(String name, ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
29850    if (element != null) {
29851      open(name);
29852      composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(element);
29853      close();
29854    }
29855  }
29856
29857  protected void composeActivityDefinitionActivityDefinitionDynamicValueComponentInner(ActivityDefinition.ActivityDefinitionDynamicValueComponent element) throws IOException {
29858      composeBackbone(element);
29859      if (element.hasPathElement()) {
29860        composeStringCore("path", element.getPathElement(), false);
29861        composeStringExtras("path", element.getPathElement(), false);
29862      }
29863      if (element.hasExpression()) {
29864        composeExpression("expression", element.getExpression());
29865      }
29866  }
29867
29868  protected void composeAdverseEvent(String name, AdverseEvent element) throws IOException {
29869    if (element != null) {
29870      prop("resourceType", name);
29871      composeAdverseEventInner(element);
29872    }
29873  }
29874
29875  protected void composeAdverseEventInner(AdverseEvent element) throws IOException {
29876      composeDomainResourceElements(element);
29877      if (element.hasIdentifier()) {
29878        composeIdentifier("identifier", element.getIdentifier());
29879      }
29880      if (element.hasActualityElement()) {
29881        composeEnumerationCore("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
29882        composeEnumerationExtras("actuality", element.getActualityElement(), new AdverseEvent.AdverseEventActualityEnumFactory(), false);
29883      }
29884      if (element.hasCategory()) {
29885        openArray("category");
29886        for (CodeableConcept e : element.getCategory()) 
29887          composeCodeableConcept(null, e);
29888        closeArray();
29889      };
29890      if (element.hasEvent()) {
29891        composeCodeableConcept("event", element.getEvent());
29892      }
29893      if (element.hasSubject()) {
29894        composeReference("subject", element.getSubject());
29895      }
29896      if (element.hasContext()) {
29897        composeReference("context", element.getContext());
29898      }
29899      if (element.hasDateElement()) {
29900        composeDateTimeCore("date", element.getDateElement(), false);
29901        composeDateTimeExtras("date", element.getDateElement(), false);
29902      }
29903      if (element.hasDetectedElement()) {
29904        composeDateTimeCore("detected", element.getDetectedElement(), false);
29905        composeDateTimeExtras("detected", element.getDetectedElement(), false);
29906      }
29907      if (element.hasRecordedDateElement()) {
29908        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
29909        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
29910      }
29911      if (element.hasResultingCondition()) {
29912        openArray("resultingCondition");
29913        for (Reference e : element.getResultingCondition()) 
29914          composeReference(null, e);
29915        closeArray();
29916      };
29917      if (element.hasLocation()) {
29918        composeReference("location", element.getLocation());
29919      }
29920      if (element.hasSeriousness()) {
29921        composeCodeableConcept("seriousness", element.getSeriousness());
29922      }
29923      if (element.hasSeverity()) {
29924        composeCodeableConcept("severity", element.getSeverity());
29925      }
29926      if (element.hasOutcome()) {
29927        composeCodeableConcept("outcome", element.getOutcome());
29928      }
29929      if (element.hasRecorder()) {
29930        composeReference("recorder", element.getRecorder());
29931      }
29932      if (element.hasContributor()) {
29933        openArray("contributor");
29934        for (Reference e : element.getContributor()) 
29935          composeReference(null, e);
29936        closeArray();
29937      };
29938      if (element.hasSuspectEntity()) {
29939        openArray("suspectEntity");
29940        for (AdverseEvent.AdverseEventSuspectEntityComponent e : element.getSuspectEntity()) 
29941          composeAdverseEventAdverseEventSuspectEntityComponent(null, e);
29942        closeArray();
29943      };
29944      if (element.hasSubjectMedicalHistory()) {
29945        openArray("subjectMedicalHistory");
29946        for (Reference e : element.getSubjectMedicalHistory()) 
29947          composeReference(null, e);
29948        closeArray();
29949      };
29950      if (element.hasReferenceDocument()) {
29951        openArray("referenceDocument");
29952        for (Reference e : element.getReferenceDocument()) 
29953          composeReference(null, e);
29954        closeArray();
29955      };
29956      if (element.hasStudy()) {
29957        openArray("study");
29958        for (Reference e : element.getStudy()) 
29959          composeReference(null, e);
29960        closeArray();
29961      };
29962  }
29963
29964  protected void composeAdverseEventAdverseEventSuspectEntityComponent(String name, AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
29965    if (element != null) {
29966      open(name);
29967      composeAdverseEventAdverseEventSuspectEntityComponentInner(element);
29968      close();
29969    }
29970  }
29971
29972  protected void composeAdverseEventAdverseEventSuspectEntityComponentInner(AdverseEvent.AdverseEventSuspectEntityComponent element) throws IOException {
29973      composeBackbone(element);
29974      if (element.hasInstance()) {
29975        composeReference("instance", element.getInstance());
29976      }
29977      if (element.hasCausality()) {
29978        openArray("causality");
29979        for (AdverseEvent.AdverseEventSuspectEntityCausalityComponent e : element.getCausality()) 
29980          composeAdverseEventAdverseEventSuspectEntityCausalityComponent(null, e);
29981        closeArray();
29982      };
29983  }
29984
29985  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponent(String name, AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
29986    if (element != null) {
29987      open(name);
29988      composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(element);
29989      close();
29990    }
29991  }
29992
29993  protected void composeAdverseEventAdverseEventSuspectEntityCausalityComponentInner(AdverseEvent.AdverseEventSuspectEntityCausalityComponent element) throws IOException {
29994      composeBackbone(element);
29995      if (element.hasAssessment()) {
29996        composeCodeableConcept("assessment", element.getAssessment());
29997      }
29998      if (element.hasProductRelatednessElement()) {
29999        composeStringCore("productRelatedness", element.getProductRelatednessElement(), false);
30000        composeStringExtras("productRelatedness", element.getProductRelatednessElement(), false);
30001      }
30002      if (element.hasAuthor()) {
30003        composeReference("author", element.getAuthor());
30004      }
30005      if (element.hasMethod()) {
30006        composeCodeableConcept("method", element.getMethod());
30007      }
30008  }
30009
30010  protected void composeAllergyIntolerance(String name, AllergyIntolerance element) throws IOException {
30011    if (element != null) {
30012      prop("resourceType", name);
30013      composeAllergyIntoleranceInner(element);
30014    }
30015  }
30016
30017  protected void composeAllergyIntoleranceInner(AllergyIntolerance element) throws IOException {
30018      composeDomainResourceElements(element);
30019      if (element.hasIdentifier()) {
30020        openArray("identifier");
30021        for (Identifier e : element.getIdentifier()) 
30022          composeIdentifier(null, e);
30023        closeArray();
30024      };
30025      if (element.hasClinicalStatusElement()) {
30026        composeEnumerationCore("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory(), false);
30027        composeEnumerationExtras("clinicalStatus", element.getClinicalStatusElement(), new AllergyIntolerance.AllergyIntoleranceClinicalStatusEnumFactory(), false);
30028      }
30029      if (element.hasVerificationStatusElement()) {
30030        composeEnumerationCore("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory(), false);
30031        composeEnumerationExtras("verificationStatus", element.getVerificationStatusElement(), new AllergyIntolerance.AllergyIntoleranceVerificationStatusEnumFactory(), false);
30032      }
30033      if (element.hasTypeElement()) {
30034        composeEnumerationCore("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
30035        composeEnumerationExtras("type", element.getTypeElement(), new AllergyIntolerance.AllergyIntoleranceTypeEnumFactory(), false);
30036      }
30037      if (element.hasCategory()) {
30038        openArray("category");
30039        for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
30040          composeEnumerationCore(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
30041        closeArray();
30042        if (anyHasExtras(element.getCategory())) {
30043          openArray("_category");
30044          for (Enumeration<AllergyIntolerance.AllergyIntoleranceCategory> e : element.getCategory()) 
30045            composeEnumerationExtras(null, e, new AllergyIntolerance.AllergyIntoleranceCategoryEnumFactory(), true);
30046          closeArray();
30047        }
30048      };
30049      if (element.hasCriticalityElement()) {
30050        composeEnumerationCore("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
30051        composeEnumerationExtras("criticality", element.getCriticalityElement(), new AllergyIntolerance.AllergyIntoleranceCriticalityEnumFactory(), false);
30052      }
30053      if (element.hasCode()) {
30054        composeCodeableConcept("code", element.getCode());
30055      }
30056      if (element.hasPatient()) {
30057        composeReference("patient", element.getPatient());
30058      }
30059      if (element.hasEncounter()) {
30060        composeReference("encounter", element.getEncounter());
30061      }
30062      if (element.hasOnset()) {
30063        composeType("onset", element.getOnset());
30064      }
30065      if (element.hasRecordedDateElement()) {
30066        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
30067        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
30068      }
30069      if (element.hasRecorder()) {
30070        composeReference("recorder", element.getRecorder());
30071      }
30072      if (element.hasAsserter()) {
30073        composeReference("asserter", element.getAsserter());
30074      }
30075      if (element.hasLastOccurrenceElement()) {
30076        composeDateTimeCore("lastOccurrence", element.getLastOccurrenceElement(), false);
30077        composeDateTimeExtras("lastOccurrence", element.getLastOccurrenceElement(), false);
30078      }
30079      if (element.hasNote()) {
30080        openArray("note");
30081        for (Annotation e : element.getNote()) 
30082          composeAnnotation(null, e);
30083        closeArray();
30084      };
30085      if (element.hasReaction()) {
30086        openArray("reaction");
30087        for (AllergyIntolerance.AllergyIntoleranceReactionComponent e : element.getReaction()) 
30088          composeAllergyIntoleranceAllergyIntoleranceReactionComponent(null, e);
30089        closeArray();
30090      };
30091  }
30092
30093  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponent(String name, AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
30094    if (element != null) {
30095      open(name);
30096      composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(element);
30097      close();
30098    }
30099  }
30100
30101  protected void composeAllergyIntoleranceAllergyIntoleranceReactionComponentInner(AllergyIntolerance.AllergyIntoleranceReactionComponent element) throws IOException {
30102      composeBackbone(element);
30103      if (element.hasSubstance()) {
30104        composeCodeableConcept("substance", element.getSubstance());
30105      }
30106      if (element.hasManifestation()) {
30107        openArray("manifestation");
30108        for (CodeableConcept e : element.getManifestation()) 
30109          composeCodeableConcept(null, e);
30110        closeArray();
30111      };
30112      if (element.hasDescriptionElement()) {
30113        composeStringCore("description", element.getDescriptionElement(), false);
30114        composeStringExtras("description", element.getDescriptionElement(), false);
30115      }
30116      if (element.hasOnsetElement()) {
30117        composeDateTimeCore("onset", element.getOnsetElement(), false);
30118        composeDateTimeExtras("onset", element.getOnsetElement(), false);
30119      }
30120      if (element.hasSeverityElement()) {
30121        composeEnumerationCore("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
30122        composeEnumerationExtras("severity", element.getSeverityElement(), new AllergyIntolerance.AllergyIntoleranceSeverityEnumFactory(), false);
30123      }
30124      if (element.hasExposureRoute()) {
30125        composeCodeableConcept("exposureRoute", element.getExposureRoute());
30126      }
30127      if (element.hasNote()) {
30128        openArray("note");
30129        for (Annotation e : element.getNote()) 
30130          composeAnnotation(null, e);
30131        closeArray();
30132      };
30133  }
30134
30135  protected void composeAppointment(String name, Appointment element) throws IOException {
30136    if (element != null) {
30137      prop("resourceType", name);
30138      composeAppointmentInner(element);
30139    }
30140  }
30141
30142  protected void composeAppointmentInner(Appointment element) throws IOException {
30143      composeDomainResourceElements(element);
30144      if (element.hasIdentifier()) {
30145        openArray("identifier");
30146        for (Identifier e : element.getIdentifier()) 
30147          composeIdentifier(null, e);
30148        closeArray();
30149      };
30150      if (element.hasStatusElement()) {
30151        composeEnumerationCore("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
30152        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.AppointmentStatusEnumFactory(), false);
30153      }
30154      if (element.hasServiceCategory()) {
30155        openArray("serviceCategory");
30156        for (CodeableConcept e : element.getServiceCategory()) 
30157          composeCodeableConcept(null, e);
30158        closeArray();
30159      };
30160      if (element.hasServiceType()) {
30161        openArray("serviceType");
30162        for (CodeableConcept e : element.getServiceType()) 
30163          composeCodeableConcept(null, e);
30164        closeArray();
30165      };
30166      if (element.hasSpecialty()) {
30167        openArray("specialty");
30168        for (CodeableConcept e : element.getSpecialty()) 
30169          composeCodeableConcept(null, e);
30170        closeArray();
30171      };
30172      if (element.hasAppointmentType()) {
30173        composeCodeableConcept("appointmentType", element.getAppointmentType());
30174      }
30175      if (element.hasReason()) {
30176        openArray("reason");
30177        for (CodeableConcept e : element.getReason()) 
30178          composeCodeableConcept(null, e);
30179        closeArray();
30180      };
30181      if (element.hasIndication()) {
30182        openArray("indication");
30183        for (Reference e : element.getIndication()) 
30184          composeReference(null, e);
30185        closeArray();
30186      };
30187      if (element.hasPriorityElement()) {
30188        composeUnsignedIntCore("priority", element.getPriorityElement(), false);
30189        composeUnsignedIntExtras("priority", element.getPriorityElement(), false);
30190      }
30191      if (element.hasDescriptionElement()) {
30192        composeStringCore("description", element.getDescriptionElement(), false);
30193        composeStringExtras("description", element.getDescriptionElement(), false);
30194      }
30195      if (element.hasSupportingInformation()) {
30196        openArray("supportingInformation");
30197        for (Reference e : element.getSupportingInformation()) 
30198          composeReference(null, e);
30199        closeArray();
30200      };
30201      if (element.hasStartElement()) {
30202        composeInstantCore("start", element.getStartElement(), false);
30203        composeInstantExtras("start", element.getStartElement(), false);
30204      }
30205      if (element.hasEndElement()) {
30206        composeInstantCore("end", element.getEndElement(), false);
30207        composeInstantExtras("end", element.getEndElement(), false);
30208      }
30209      if (element.hasMinutesDurationElement()) {
30210        composePositiveIntCore("minutesDuration", element.getMinutesDurationElement(), false);
30211        composePositiveIntExtras("minutesDuration", element.getMinutesDurationElement(), false);
30212      }
30213      if (element.hasSlot()) {
30214        openArray("slot");
30215        for (Reference e : element.getSlot()) 
30216          composeReference(null, e);
30217        closeArray();
30218      };
30219      if (element.hasCreatedElement()) {
30220        composeDateTimeCore("created", element.getCreatedElement(), false);
30221        composeDateTimeExtras("created", element.getCreatedElement(), false);
30222      }
30223      if (element.hasCommentElement()) {
30224        composeStringCore("comment", element.getCommentElement(), false);
30225        composeStringExtras("comment", element.getCommentElement(), false);
30226      }
30227      if (element.hasPatientInstructionElement()) {
30228        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
30229        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
30230      }
30231      if (element.hasBasedOn()) {
30232        openArray("basedOn");
30233        for (Reference e : element.getBasedOn()) 
30234          composeReference(null, e);
30235        closeArray();
30236      };
30237      if (element.hasParticipant()) {
30238        openArray("participant");
30239        for (Appointment.AppointmentParticipantComponent e : element.getParticipant()) 
30240          composeAppointmentAppointmentParticipantComponent(null, e);
30241        closeArray();
30242      };
30243      if (element.hasRequestedPeriod()) {
30244        openArray("requestedPeriod");
30245        for (Period e : element.getRequestedPeriod()) 
30246          composePeriod(null, e);
30247        closeArray();
30248      };
30249  }
30250
30251  protected void composeAppointmentAppointmentParticipantComponent(String name, Appointment.AppointmentParticipantComponent element) throws IOException {
30252    if (element != null) {
30253      open(name);
30254      composeAppointmentAppointmentParticipantComponentInner(element);
30255      close();
30256    }
30257  }
30258
30259  protected void composeAppointmentAppointmentParticipantComponentInner(Appointment.AppointmentParticipantComponent element) throws IOException {
30260      composeBackbone(element);
30261      if (element.hasType()) {
30262        openArray("type");
30263        for (CodeableConcept e : element.getType()) 
30264          composeCodeableConcept(null, e);
30265        closeArray();
30266      };
30267      if (element.hasActor()) {
30268        composeReference("actor", element.getActor());
30269      }
30270      if (element.hasRequiredElement()) {
30271        composeEnumerationCore("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
30272        composeEnumerationExtras("required", element.getRequiredElement(), new Appointment.ParticipantRequiredEnumFactory(), false);
30273      }
30274      if (element.hasStatusElement()) {
30275        composeEnumerationCore("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
30276        composeEnumerationExtras("status", element.getStatusElement(), new Appointment.ParticipationStatusEnumFactory(), false);
30277      }
30278      if (element.hasPeriod()) {
30279        composePeriod("period", element.getPeriod());
30280      }
30281  }
30282
30283  protected void composeAppointmentResponse(String name, AppointmentResponse element) throws IOException {
30284    if (element != null) {
30285      prop("resourceType", name);
30286      composeAppointmentResponseInner(element);
30287    }
30288  }
30289
30290  protected void composeAppointmentResponseInner(AppointmentResponse element) throws IOException {
30291      composeDomainResourceElements(element);
30292      if (element.hasIdentifier()) {
30293        openArray("identifier");
30294        for (Identifier e : element.getIdentifier()) 
30295          composeIdentifier(null, e);
30296        closeArray();
30297      };
30298      if (element.hasAppointment()) {
30299        composeReference("appointment", element.getAppointment());
30300      }
30301      if (element.hasStartElement()) {
30302        composeInstantCore("start", element.getStartElement(), false);
30303        composeInstantExtras("start", element.getStartElement(), false);
30304      }
30305      if (element.hasEndElement()) {
30306        composeInstantCore("end", element.getEndElement(), false);
30307        composeInstantExtras("end", element.getEndElement(), false);
30308      }
30309      if (element.hasParticipantType()) {
30310        openArray("participantType");
30311        for (CodeableConcept e : element.getParticipantType()) 
30312          composeCodeableConcept(null, e);
30313        closeArray();
30314      };
30315      if (element.hasActor()) {
30316        composeReference("actor", element.getActor());
30317      }
30318      if (element.hasParticipantStatusElement()) {
30319        composeEnumerationCore("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
30320        composeEnumerationExtras("participantStatus", element.getParticipantStatusElement(), new AppointmentResponse.ParticipantStatusEnumFactory(), false);
30321      }
30322      if (element.hasCommentElement()) {
30323        composeStringCore("comment", element.getCommentElement(), false);
30324        composeStringExtras("comment", element.getCommentElement(), false);
30325      }
30326  }
30327
30328  protected void composeAuditEvent(String name, AuditEvent element) throws IOException {
30329    if (element != null) {
30330      prop("resourceType", name);
30331      composeAuditEventInner(element);
30332    }
30333  }
30334
30335  protected void composeAuditEventInner(AuditEvent element) throws IOException {
30336      composeDomainResourceElements(element);
30337      if (element.hasType()) {
30338        composeCoding("type", element.getType());
30339      }
30340      if (element.hasSubtype()) {
30341        openArray("subtype");
30342        for (Coding e : element.getSubtype()) 
30343          composeCoding(null, e);
30344        closeArray();
30345      };
30346      if (element.hasActionElement()) {
30347        composeEnumerationCore("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
30348        composeEnumerationExtras("action", element.getActionElement(), new AuditEvent.AuditEventActionEnumFactory(), false);
30349      }
30350      if (element.hasPeriod()) {
30351        composePeriod("period", element.getPeriod());
30352      }
30353      if (element.hasRecordedElement()) {
30354        composeInstantCore("recorded", element.getRecordedElement(), false);
30355        composeInstantExtras("recorded", element.getRecordedElement(), false);
30356      }
30357      if (element.hasOutcomeElement()) {
30358        composeEnumerationCore("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
30359        composeEnumerationExtras("outcome", element.getOutcomeElement(), new AuditEvent.AuditEventOutcomeEnumFactory(), false);
30360      }
30361      if (element.hasOutcomeDescElement()) {
30362        composeStringCore("outcomeDesc", element.getOutcomeDescElement(), false);
30363        composeStringExtras("outcomeDesc", element.getOutcomeDescElement(), false);
30364      }
30365      if (element.hasPurposeOfEvent()) {
30366        openArray("purposeOfEvent");
30367        for (CodeableConcept e : element.getPurposeOfEvent()) 
30368          composeCodeableConcept(null, e);
30369        closeArray();
30370      };
30371      if (element.hasAgent()) {
30372        openArray("agent");
30373        for (AuditEvent.AuditEventAgentComponent e : element.getAgent()) 
30374          composeAuditEventAuditEventAgentComponent(null, e);
30375        closeArray();
30376      };
30377      if (element.hasSource()) {
30378        composeAuditEventAuditEventSourceComponent("source", element.getSource());
30379      }
30380      if (element.hasEntity()) {
30381        openArray("entity");
30382        for (AuditEvent.AuditEventEntityComponent e : element.getEntity()) 
30383          composeAuditEventAuditEventEntityComponent(null, e);
30384        closeArray();
30385      };
30386  }
30387
30388  protected void composeAuditEventAuditEventAgentComponent(String name, AuditEvent.AuditEventAgentComponent element) throws IOException {
30389    if (element != null) {
30390      open(name);
30391      composeAuditEventAuditEventAgentComponentInner(element);
30392      close();
30393    }
30394  }
30395
30396  protected void composeAuditEventAuditEventAgentComponentInner(AuditEvent.AuditEventAgentComponent element) throws IOException {
30397      composeBackbone(element);
30398      if (element.hasType()) {
30399        composeCodeableConcept("type", element.getType());
30400      }
30401      if (element.hasRole()) {
30402        openArray("role");
30403        for (CodeableConcept e : element.getRole()) 
30404          composeCodeableConcept(null, e);
30405        closeArray();
30406      };
30407      if (element.hasWho()) {
30408        composeReference("who", element.getWho());
30409      }
30410      if (element.hasAltIdElement()) {
30411        composeStringCore("altId", element.getAltIdElement(), false);
30412        composeStringExtras("altId", element.getAltIdElement(), false);
30413      }
30414      if (element.hasNameElement()) {
30415        composeStringCore("name", element.getNameElement(), false);
30416        composeStringExtras("name", element.getNameElement(), false);
30417      }
30418      if (element.hasRequestorElement()) {
30419        composeBooleanCore("requestor", element.getRequestorElement(), false);
30420        composeBooleanExtras("requestor", element.getRequestorElement(), false);
30421      }
30422      if (element.hasLocation()) {
30423        composeReference("location", element.getLocation());
30424      }
30425      if (element.hasPolicy()) {
30426        openArray("policy");
30427        for (UriType e : element.getPolicy()) 
30428          composeUriCore(null, e, true);
30429        closeArray();
30430        if (anyHasExtras(element.getPolicy())) {
30431          openArray("_policy");
30432          for (UriType e : element.getPolicy()) 
30433            composeUriExtras(null, e, true);
30434          closeArray();
30435        }
30436      };
30437      if (element.hasMedia()) {
30438        composeCoding("media", element.getMedia());
30439      }
30440      if (element.hasNetwork()) {
30441        composeAuditEventAuditEventAgentNetworkComponent("network", element.getNetwork());
30442      }
30443      if (element.hasPurposeOfUse()) {
30444        openArray("purposeOfUse");
30445        for (CodeableConcept e : element.getPurposeOfUse()) 
30446          composeCodeableConcept(null, e);
30447        closeArray();
30448      };
30449  }
30450
30451  protected void composeAuditEventAuditEventAgentNetworkComponent(String name, AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
30452    if (element != null) {
30453      open(name);
30454      composeAuditEventAuditEventAgentNetworkComponentInner(element);
30455      close();
30456    }
30457  }
30458
30459  protected void composeAuditEventAuditEventAgentNetworkComponentInner(AuditEvent.AuditEventAgentNetworkComponent element) throws IOException {
30460      composeBackbone(element);
30461      if (element.hasAddressElement()) {
30462        composeStringCore("address", element.getAddressElement(), false);
30463        composeStringExtras("address", element.getAddressElement(), false);
30464      }
30465      if (element.hasTypeElement()) {
30466        composeEnumerationCore("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
30467        composeEnumerationExtras("type", element.getTypeElement(), new AuditEvent.AuditEventAgentNetworkTypeEnumFactory(), false);
30468      }
30469  }
30470
30471  protected void composeAuditEventAuditEventSourceComponent(String name, AuditEvent.AuditEventSourceComponent element) throws IOException {
30472    if (element != null) {
30473      open(name);
30474      composeAuditEventAuditEventSourceComponentInner(element);
30475      close();
30476    }
30477  }
30478
30479  protected void composeAuditEventAuditEventSourceComponentInner(AuditEvent.AuditEventSourceComponent element) throws IOException {
30480      composeBackbone(element);
30481      if (element.hasSiteElement()) {
30482        composeStringCore("site", element.getSiteElement(), false);
30483        composeStringExtras("site", element.getSiteElement(), false);
30484      }
30485      if (element.hasObserver()) {
30486        composeReference("observer", element.getObserver());
30487      }
30488      if (element.hasType()) {
30489        openArray("type");
30490        for (Coding e : element.getType()) 
30491          composeCoding(null, e);
30492        closeArray();
30493      };
30494  }
30495
30496  protected void composeAuditEventAuditEventEntityComponent(String name, AuditEvent.AuditEventEntityComponent element) throws IOException {
30497    if (element != null) {
30498      open(name);
30499      composeAuditEventAuditEventEntityComponentInner(element);
30500      close();
30501    }
30502  }
30503
30504  protected void composeAuditEventAuditEventEntityComponentInner(AuditEvent.AuditEventEntityComponent element) throws IOException {
30505      composeBackbone(element);
30506      if (element.hasWhat()) {
30507        composeReference("what", element.getWhat());
30508      }
30509      if (element.hasType()) {
30510        composeCoding("type", element.getType());
30511      }
30512      if (element.hasRole()) {
30513        composeCoding("role", element.getRole());
30514      }
30515      if (element.hasLifecycle()) {
30516        composeCoding("lifecycle", element.getLifecycle());
30517      }
30518      if (element.hasSecurityLabel()) {
30519        openArray("securityLabel");
30520        for (Coding e : element.getSecurityLabel()) 
30521          composeCoding(null, e);
30522        closeArray();
30523      };
30524      if (element.hasNameElement()) {
30525        composeStringCore("name", element.getNameElement(), false);
30526        composeStringExtras("name", element.getNameElement(), false);
30527      }
30528      if (element.hasDescriptionElement()) {
30529        composeStringCore("description", element.getDescriptionElement(), false);
30530        composeStringExtras("description", element.getDescriptionElement(), false);
30531      }
30532      if (element.hasQueryElement()) {
30533        composeBase64BinaryCore("query", element.getQueryElement(), false);
30534        composeBase64BinaryExtras("query", element.getQueryElement(), false);
30535      }
30536      if (element.hasDetail()) {
30537        openArray("detail");
30538        for (AuditEvent.AuditEventEntityDetailComponent e : element.getDetail()) 
30539          composeAuditEventAuditEventEntityDetailComponent(null, e);
30540        closeArray();
30541      };
30542  }
30543
30544  protected void composeAuditEventAuditEventEntityDetailComponent(String name, AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
30545    if (element != null) {
30546      open(name);
30547      composeAuditEventAuditEventEntityDetailComponentInner(element);
30548      close();
30549    }
30550  }
30551
30552  protected void composeAuditEventAuditEventEntityDetailComponentInner(AuditEvent.AuditEventEntityDetailComponent element) throws IOException {
30553      composeBackbone(element);
30554      if (element.hasTypeElement()) {
30555        composeStringCore("type", element.getTypeElement(), false);
30556        composeStringExtras("type", element.getTypeElement(), false);
30557      }
30558      if (element.hasValue()) {
30559        composeType("value", element.getValue());
30560      }
30561  }
30562
30563  protected void composeBasic(String name, Basic element) throws IOException {
30564    if (element != null) {
30565      prop("resourceType", name);
30566      composeBasicInner(element);
30567    }
30568  }
30569
30570  protected void composeBasicInner(Basic element) throws IOException {
30571      composeDomainResourceElements(element);
30572      if (element.hasIdentifier()) {
30573        openArray("identifier");
30574        for (Identifier e : element.getIdentifier()) 
30575          composeIdentifier(null, e);
30576        closeArray();
30577      };
30578      if (element.hasCode()) {
30579        composeCodeableConcept("code", element.getCode());
30580      }
30581      if (element.hasSubject()) {
30582        composeReference("subject", element.getSubject());
30583      }
30584      if (element.hasCreatedElement()) {
30585        composeDateCore("created", element.getCreatedElement(), false);
30586        composeDateExtras("created", element.getCreatedElement(), false);
30587      }
30588      if (element.hasAuthor()) {
30589        composeReference("author", element.getAuthor());
30590      }
30591  }
30592
30593  protected void composeBinary(String name, Binary element) throws IOException {
30594    if (element != null) {
30595      prop("resourceType", name);
30596      composeBinaryInner(element);
30597    }
30598  }
30599
30600  protected void composeBinaryInner(Binary element) throws IOException {
30601      composeResourceElements(element);
30602      if (element.hasContentTypeElement()) {
30603        composeCodeCore("contentType", element.getContentTypeElement(), false);
30604        composeCodeExtras("contentType", element.getContentTypeElement(), false);
30605      }
30606      if (element.hasSecurityContext()) {
30607        composeReference("securityContext", element.getSecurityContext());
30608      }
30609      if (element.hasDataElement()) {
30610        composeBase64BinaryCore("data", element.getDataElement(), false);
30611        composeBase64BinaryExtras("data", element.getDataElement(), false);
30612      }
30613  }
30614
30615  protected void composeBiologicallyDerivedProduct(String name, BiologicallyDerivedProduct element) throws IOException {
30616    if (element != null) {
30617      prop("resourceType", name);
30618      composeBiologicallyDerivedProductInner(element);
30619    }
30620  }
30621
30622  protected void composeBiologicallyDerivedProductInner(BiologicallyDerivedProduct element) throws IOException {
30623      composeDomainResourceElements(element);
30624      if (element.hasIdentifier()) {
30625        openArray("identifier");
30626        for (Identifier e : element.getIdentifier()) 
30627          composeIdentifier(null, e);
30628        closeArray();
30629      };
30630      if (element.hasProductCategoryElement()) {
30631        composeEnumerationCore("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
30632        composeEnumerationExtras("productCategory", element.getProductCategoryElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductCategoryEnumFactory(), false);
30633      }
30634      if (element.hasProductCode()) {
30635        composeCodeableConcept("productCode", element.getProductCode());
30636      }
30637      if (element.hasStatusElement()) {
30638        composeEnumerationCore("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
30639        composeEnumerationExtras("status", element.getStatusElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStatusEnumFactory(), false);
30640      }
30641      if (element.hasRequest()) {
30642        openArray("request");
30643        for (Reference e : element.getRequest()) 
30644          composeReference(null, e);
30645        closeArray();
30646      };
30647      if (element.hasQuantityElement()) {
30648        composeIntegerCore("quantity", element.getQuantityElement(), false);
30649        composeIntegerExtras("quantity", element.getQuantityElement(), false);
30650      }
30651      if (element.hasParent()) {
30652        composeReference("parent", element.getParent());
30653      }
30654      if (element.hasCollection()) {
30655        composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent("collection", element.getCollection());
30656      }
30657      if (element.hasProcessing()) {
30658        openArray("processing");
30659        for (BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent e : element.getProcessing()) 
30660          composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(null, e);
30661        closeArray();
30662      };
30663      if (element.hasManipulation()) {
30664        composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent("manipulation", element.getManipulation());
30665      }
30666      if (element.hasStorage()) {
30667        openArray("storage");
30668        for (BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent e : element.getStorage()) 
30669          composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(null, e);
30670        closeArray();
30671      };
30672  }
30673
30674  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
30675    if (element != null) {
30676      open(name);
30677      composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(element);
30678      close();
30679    }
30680  }
30681
30682  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductCollectionComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductCollectionComponent element) throws IOException {
30683      composeBackbone(element);
30684      if (element.hasCollector()) {
30685        composeReference("collector", element.getCollector());
30686      }
30687      if (element.hasSource()) {
30688        composeReference("source", element.getSource());
30689      }
30690      if (element.hasCollected()) {
30691        composeType("collected", element.getCollected());
30692      }
30693  }
30694
30695  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
30696    if (element != null) {
30697      open(name);
30698      composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(element);
30699      close();
30700    }
30701  }
30702
30703  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductProcessingComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductProcessingComponent element) throws IOException {
30704      composeBackbone(element);
30705      if (element.hasDescriptionElement()) {
30706        composeStringCore("description", element.getDescriptionElement(), false);
30707        composeStringExtras("description", element.getDescriptionElement(), false);
30708      }
30709      if (element.hasProcedure()) {
30710        composeCodeableConcept("procedure", element.getProcedure());
30711      }
30712      if (element.hasAdditive()) {
30713        composeReference("additive", element.getAdditive());
30714      }
30715      if (element.hasTime()) {
30716        composeType("time", element.getTime());
30717      }
30718  }
30719
30720  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
30721    if (element != null) {
30722      open(name);
30723      composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(element);
30724      close();
30725    }
30726  }
30727
30728  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductManipulationComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductManipulationComponent element) throws IOException {
30729      composeBackbone(element);
30730      if (element.hasDescriptionElement()) {
30731        composeStringCore("description", element.getDescriptionElement(), false);
30732        composeStringExtras("description", element.getDescriptionElement(), false);
30733      }
30734      if (element.hasTime()) {
30735        composeType("time", element.getTime());
30736      }
30737  }
30738
30739  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponent(String name, BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
30740    if (element != null) {
30741      open(name);
30742      composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(element);
30743      close();
30744    }
30745  }
30746
30747  protected void composeBiologicallyDerivedProductBiologicallyDerivedProductStorageComponentInner(BiologicallyDerivedProduct.BiologicallyDerivedProductStorageComponent element) throws IOException {
30748      composeBackbone(element);
30749      if (element.hasDescriptionElement()) {
30750        composeStringCore("description", element.getDescriptionElement(), false);
30751        composeStringExtras("description", element.getDescriptionElement(), false);
30752      }
30753      if (element.hasTemperatureElement()) {
30754        composeDecimalCore("temperature", element.getTemperatureElement(), false);
30755        composeDecimalExtras("temperature", element.getTemperatureElement(), false);
30756      }
30757      if (element.hasScaleElement()) {
30758        composeEnumerationCore("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
30759        composeEnumerationExtras("scale", element.getScaleElement(), new BiologicallyDerivedProduct.BiologicallyDerivedProductStorageScaleEnumFactory(), false);
30760      }
30761      if (element.hasDuration()) {
30762        composePeriod("duration", element.getDuration());
30763      }
30764  }
30765
30766  protected void composeBodyStructure(String name, BodyStructure element) throws IOException {
30767    if (element != null) {
30768      prop("resourceType", name);
30769      composeBodyStructureInner(element);
30770    }
30771  }
30772
30773  protected void composeBodyStructureInner(BodyStructure element) throws IOException {
30774      composeDomainResourceElements(element);
30775      if (element.hasIdentifier()) {
30776        openArray("identifier");
30777        for (Identifier e : element.getIdentifier()) 
30778          composeIdentifier(null, e);
30779        closeArray();
30780      };
30781      if (element.hasActiveElement()) {
30782        composeBooleanCore("active", element.getActiveElement(), false);
30783        composeBooleanExtras("active", element.getActiveElement(), false);
30784      }
30785      if (element.hasMorphology()) {
30786        composeCodeableConcept("morphology", element.getMorphology());
30787      }
30788      if (element.hasLocation()) {
30789        composeCodeableConcept("location", element.getLocation());
30790      }
30791      if (element.hasLocationQualifier()) {
30792        openArray("locationQualifier");
30793        for (CodeableConcept e : element.getLocationQualifier()) 
30794          composeCodeableConcept(null, e);
30795        closeArray();
30796      };
30797      if (element.hasDescriptionElement()) {
30798        composeStringCore("description", element.getDescriptionElement(), false);
30799        composeStringExtras("description", element.getDescriptionElement(), false);
30800      }
30801      if (element.hasImage()) {
30802        openArray("image");
30803        for (Attachment e : element.getImage()) 
30804          composeAttachment(null, e);
30805        closeArray();
30806      };
30807      if (element.hasPatient()) {
30808        composeReference("patient", element.getPatient());
30809      }
30810  }
30811
30812  protected void composeBundle(String name, Bundle element) throws IOException {
30813    if (element != null) {
30814      prop("resourceType", name);
30815      composeBundleInner(element);
30816    }
30817  }
30818
30819  protected void composeBundleInner(Bundle element) throws IOException {
30820      composeResourceElements(element);
30821      if (element.hasIdentifier()) {
30822        composeIdentifier("identifier", element.getIdentifier());
30823      }
30824      if (element.hasTypeElement()) {
30825        composeEnumerationCore("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
30826        composeEnumerationExtras("type", element.getTypeElement(), new Bundle.BundleTypeEnumFactory(), false);
30827      }
30828      if (element.hasTimestampElement()) {
30829        composeInstantCore("timestamp", element.getTimestampElement(), false);
30830        composeInstantExtras("timestamp", element.getTimestampElement(), false);
30831      }
30832      if (element.hasTotalElement()) {
30833        composeUnsignedIntCore("total", element.getTotalElement(), false);
30834        composeUnsignedIntExtras("total", element.getTotalElement(), false);
30835      }
30836      if (element.hasLink()) {
30837        openArray("link");
30838        for (Bundle.BundleLinkComponent e : element.getLink()) 
30839          composeBundleBundleLinkComponent(null, e);
30840        closeArray();
30841      };
30842      if (element.hasEntry()) {
30843        openArray("entry");
30844        for (Bundle.BundleEntryComponent e : element.getEntry()) 
30845          composeBundleBundleEntryComponent(null, e);
30846        closeArray();
30847      };
30848      if (element.hasSignature()) {
30849        composeSignature("signature", element.getSignature());
30850      }
30851  }
30852
30853  protected void composeBundleBundleLinkComponent(String name, Bundle.BundleLinkComponent element) throws IOException {
30854    if (element != null) {
30855      open(name);
30856      composeBundleBundleLinkComponentInner(element);
30857      close();
30858    }
30859  }
30860
30861  protected void composeBundleBundleLinkComponentInner(Bundle.BundleLinkComponent element) throws IOException {
30862      composeBackbone(element);
30863      if (element.hasRelationElement()) {
30864        composeStringCore("relation", element.getRelationElement(), false);
30865        composeStringExtras("relation", element.getRelationElement(), false);
30866      }
30867      if (element.hasUrlElement()) {
30868        composeUriCore("url", element.getUrlElement(), false);
30869        composeUriExtras("url", element.getUrlElement(), false);
30870      }
30871  }
30872
30873  protected void composeBundleBundleEntryComponent(String name, Bundle.BundleEntryComponent element) throws IOException {
30874    if (element != null) {
30875      open(name);
30876      composeBundleBundleEntryComponentInner(element);
30877      close();
30878    }
30879  }
30880
30881  protected void composeBundleBundleEntryComponentInner(Bundle.BundleEntryComponent element) throws IOException {
30882      composeBackbone(element);
30883      if (element.hasLink()) {
30884        openArray("link");
30885        for (Bundle.BundleLinkComponent e : element.getLink()) 
30886          composeBundleBundleLinkComponent(null, e);
30887        closeArray();
30888      };
30889      if (element.hasFullUrlElement()) {
30890        composeUriCore("fullUrl", element.getFullUrlElement(), false);
30891        composeUriExtras("fullUrl", element.getFullUrlElement(), false);
30892      }
30893        if (element.hasResource()) {
30894          open("resource");
30895          composeResource(element.getResource());
30896          close();
30897        }
30898      if (element.hasSearch()) {
30899        composeBundleBundleEntrySearchComponent("search", element.getSearch());
30900      }
30901      if (element.hasRequest()) {
30902        composeBundleBundleEntryRequestComponent("request", element.getRequest());
30903      }
30904      if (element.hasResponse()) {
30905        composeBundleBundleEntryResponseComponent("response", element.getResponse());
30906      }
30907  }
30908
30909  protected void composeBundleBundleEntrySearchComponent(String name, Bundle.BundleEntrySearchComponent element) throws IOException {
30910    if (element != null) {
30911      open(name);
30912      composeBundleBundleEntrySearchComponentInner(element);
30913      close();
30914    }
30915  }
30916
30917  protected void composeBundleBundleEntrySearchComponentInner(Bundle.BundleEntrySearchComponent element) throws IOException {
30918      composeBackbone(element);
30919      if (element.hasModeElement()) {
30920        composeEnumerationCore("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
30921        composeEnumerationExtras("mode", element.getModeElement(), new Bundle.SearchEntryModeEnumFactory(), false);
30922      }
30923      if (element.hasScoreElement()) {
30924        composeDecimalCore("score", element.getScoreElement(), false);
30925        composeDecimalExtras("score", element.getScoreElement(), false);
30926      }
30927  }
30928
30929  protected void composeBundleBundleEntryRequestComponent(String name, Bundle.BundleEntryRequestComponent element) throws IOException {
30930    if (element != null) {
30931      open(name);
30932      composeBundleBundleEntryRequestComponentInner(element);
30933      close();
30934    }
30935  }
30936
30937  protected void composeBundleBundleEntryRequestComponentInner(Bundle.BundleEntryRequestComponent element) throws IOException {
30938      composeBackbone(element);
30939      if (element.hasMethodElement()) {
30940        composeEnumerationCore("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
30941        composeEnumerationExtras("method", element.getMethodElement(), new Bundle.HTTPVerbEnumFactory(), false);
30942      }
30943      if (element.hasUrlElement()) {
30944        composeUriCore("url", element.getUrlElement(), false);
30945        composeUriExtras("url", element.getUrlElement(), false);
30946      }
30947      if (element.hasIfNoneMatchElement()) {
30948        composeStringCore("ifNoneMatch", element.getIfNoneMatchElement(), false);
30949        composeStringExtras("ifNoneMatch", element.getIfNoneMatchElement(), false);
30950      }
30951      if (element.hasIfModifiedSinceElement()) {
30952        composeInstantCore("ifModifiedSince", element.getIfModifiedSinceElement(), false);
30953        composeInstantExtras("ifModifiedSince", element.getIfModifiedSinceElement(), false);
30954      }
30955      if (element.hasIfMatchElement()) {
30956        composeStringCore("ifMatch", element.getIfMatchElement(), false);
30957        composeStringExtras("ifMatch", element.getIfMatchElement(), false);
30958      }
30959      if (element.hasIfNoneExistElement()) {
30960        composeStringCore("ifNoneExist", element.getIfNoneExistElement(), false);
30961        composeStringExtras("ifNoneExist", element.getIfNoneExistElement(), false);
30962      }
30963  }
30964
30965  protected void composeBundleBundleEntryResponseComponent(String name, Bundle.BundleEntryResponseComponent element) throws IOException {
30966    if (element != null) {
30967      open(name);
30968      composeBundleBundleEntryResponseComponentInner(element);
30969      close();
30970    }
30971  }
30972
30973  protected void composeBundleBundleEntryResponseComponentInner(Bundle.BundleEntryResponseComponent element) throws IOException {
30974      composeBackbone(element);
30975      if (element.hasStatusElement()) {
30976        composeStringCore("status", element.getStatusElement(), false);
30977        composeStringExtras("status", element.getStatusElement(), false);
30978      }
30979      if (element.hasLocationElement()) {
30980        composeUriCore("location", element.getLocationElement(), false);
30981        composeUriExtras("location", element.getLocationElement(), false);
30982      }
30983      if (element.hasEtagElement()) {
30984        composeStringCore("etag", element.getEtagElement(), false);
30985        composeStringExtras("etag", element.getEtagElement(), false);
30986      }
30987      if (element.hasLastModifiedElement()) {
30988        composeInstantCore("lastModified", element.getLastModifiedElement(), false);
30989        composeInstantExtras("lastModified", element.getLastModifiedElement(), false);
30990      }
30991        if (element.hasOutcome()) {
30992          open("outcome");
30993          composeResource(element.getOutcome());
30994          close();
30995        }
30996  }
30997
30998  protected void composeCapabilityStatement(String name, CapabilityStatement element) throws IOException {
30999    if (element != null) {
31000      prop("resourceType", name);
31001      composeCapabilityStatementInner(element);
31002    }
31003  }
31004
31005  protected void composeCapabilityStatementInner(CapabilityStatement element) throws IOException {
31006      composeDomainResourceElements(element);
31007      if (element.hasUrlElement()) {
31008        composeUriCore("url", element.getUrlElement(), false);
31009        composeUriExtras("url", element.getUrlElement(), false);
31010      }
31011      if (element.hasVersionElement()) {
31012        composeStringCore("version", element.getVersionElement(), false);
31013        composeStringExtras("version", element.getVersionElement(), false);
31014      }
31015      if (element.hasNameElement()) {
31016        composeStringCore("name", element.getNameElement(), false);
31017        composeStringExtras("name", element.getNameElement(), false);
31018      }
31019      if (element.hasTitleElement()) {
31020        composeStringCore("title", element.getTitleElement(), false);
31021        composeStringExtras("title", element.getTitleElement(), false);
31022      }
31023      if (element.hasStatusElement()) {
31024        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31025        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
31026      }
31027      if (element.hasExperimentalElement()) {
31028        composeBooleanCore("experimental", element.getExperimentalElement(), false);
31029        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
31030      }
31031      if (element.hasDateElement()) {
31032        composeDateTimeCore("date", element.getDateElement(), false);
31033        composeDateTimeExtras("date", element.getDateElement(), false);
31034      }
31035      if (element.hasPublisherElement()) {
31036        composeStringCore("publisher", element.getPublisherElement(), false);
31037        composeStringExtras("publisher", element.getPublisherElement(), false);
31038      }
31039      if (element.hasContact()) {
31040        openArray("contact");
31041        for (ContactDetail e : element.getContact()) 
31042          composeContactDetail(null, e);
31043        closeArray();
31044      };
31045      if (element.hasDescriptionElement()) {
31046        composeMarkdownCore("description", element.getDescriptionElement(), false);
31047        composeMarkdownExtras("description", element.getDescriptionElement(), false);
31048      }
31049      if (element.hasUseContext()) {
31050        openArray("useContext");
31051        for (UsageContext e : element.getUseContext()) 
31052          composeUsageContext(null, e);
31053        closeArray();
31054      };
31055      if (element.hasJurisdiction()) {
31056        openArray("jurisdiction");
31057        for (CodeableConcept e : element.getJurisdiction()) 
31058          composeCodeableConcept(null, e);
31059        closeArray();
31060      };
31061      if (element.hasPurposeElement()) {
31062        composeMarkdownCore("purpose", element.getPurposeElement(), false);
31063        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
31064      }
31065      if (element.hasCopyrightElement()) {
31066        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
31067        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
31068      }
31069      if (element.hasKindElement()) {
31070        composeEnumerationCore("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
31071        composeEnumerationExtras("kind", element.getKindElement(), new CapabilityStatement.CapabilityStatementKindEnumFactory(), false);
31072      }
31073      if (element.hasInstantiates()) {
31074        openArray("instantiates");
31075        for (CanonicalType e : element.getInstantiates()) 
31076          composeCanonicalCore(null, e, true);
31077        closeArray();
31078        if (anyHasExtras(element.getInstantiates())) {
31079          openArray("_instantiates");
31080          for (CanonicalType e : element.getInstantiates()) 
31081            composeCanonicalExtras(null, e, true);
31082          closeArray();
31083        }
31084      };
31085      if (element.hasImports()) {
31086        openArray("imports");
31087        for (CanonicalType e : element.getImports()) 
31088          composeCanonicalCore(null, e, true);
31089        closeArray();
31090        if (anyHasExtras(element.getImports())) {
31091          openArray("_imports");
31092          for (CanonicalType e : element.getImports()) 
31093            composeCanonicalExtras(null, e, true);
31094          closeArray();
31095        }
31096      };
31097      if (element.hasSoftware()) {
31098        composeCapabilityStatementCapabilityStatementSoftwareComponent("software", element.getSoftware());
31099      }
31100      if (element.hasImplementation()) {
31101        composeCapabilityStatementCapabilityStatementImplementationComponent("implementation", element.getImplementation());
31102      }
31103      if (element.hasFhirVersionElement()) {
31104        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
31105        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
31106      }
31107      if (element.hasFormat()) {
31108        openArray("format");
31109        for (CodeType e : element.getFormat()) 
31110          composeCodeCore(null, e, true);
31111        closeArray();
31112        if (anyHasExtras(element.getFormat())) {
31113          openArray("_format");
31114          for (CodeType e : element.getFormat()) 
31115            composeCodeExtras(null, e, true);
31116          closeArray();
31117        }
31118      };
31119      if (element.hasPatchFormat()) {
31120        openArray("patchFormat");
31121        for (CodeType e : element.getPatchFormat()) 
31122          composeCodeCore(null, e, true);
31123        closeArray();
31124        if (anyHasExtras(element.getPatchFormat())) {
31125          openArray("_patchFormat");
31126          for (CodeType e : element.getPatchFormat()) 
31127            composeCodeExtras(null, e, true);
31128          closeArray();
31129        }
31130      };
31131      if (element.hasImplementationGuide()) {
31132        openArray("implementationGuide");
31133        for (CanonicalType e : element.getImplementationGuide()) 
31134          composeCanonicalCore(null, e, true);
31135        closeArray();
31136        if (anyHasExtras(element.getImplementationGuide())) {
31137          openArray("_implementationGuide");
31138          for (CanonicalType e : element.getImplementationGuide()) 
31139            composeCanonicalExtras(null, e, true);
31140          closeArray();
31141        }
31142      };
31143      if (element.hasRest()) {
31144        openArray("rest");
31145        for (CapabilityStatement.CapabilityStatementRestComponent e : element.getRest()) 
31146          composeCapabilityStatementCapabilityStatementRestComponent(null, e);
31147        closeArray();
31148      };
31149      if (element.hasMessaging()) {
31150        openArray("messaging");
31151        for (CapabilityStatement.CapabilityStatementMessagingComponent e : element.getMessaging()) 
31152          composeCapabilityStatementCapabilityStatementMessagingComponent(null, e);
31153        closeArray();
31154      };
31155      if (element.hasDocument()) {
31156        openArray("document");
31157        for (CapabilityStatement.CapabilityStatementDocumentComponent e : element.getDocument()) 
31158          composeCapabilityStatementCapabilityStatementDocumentComponent(null, e);
31159        closeArray();
31160      };
31161  }
31162
31163  protected void composeCapabilityStatementCapabilityStatementSoftwareComponent(String name, CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
31164    if (element != null) {
31165      open(name);
31166      composeCapabilityStatementCapabilityStatementSoftwareComponentInner(element);
31167      close();
31168    }
31169  }
31170
31171  protected void composeCapabilityStatementCapabilityStatementSoftwareComponentInner(CapabilityStatement.CapabilityStatementSoftwareComponent element) throws IOException {
31172      composeBackbone(element);
31173      if (element.hasNameElement()) {
31174        composeStringCore("name", element.getNameElement(), false);
31175        composeStringExtras("name", element.getNameElement(), false);
31176      }
31177      if (element.hasVersionElement()) {
31178        composeStringCore("version", element.getVersionElement(), false);
31179        composeStringExtras("version", element.getVersionElement(), false);
31180      }
31181      if (element.hasReleaseDateElement()) {
31182        composeDateTimeCore("releaseDate", element.getReleaseDateElement(), false);
31183        composeDateTimeExtras("releaseDate", element.getReleaseDateElement(), false);
31184      }
31185  }
31186
31187  protected void composeCapabilityStatementCapabilityStatementImplementationComponent(String name, CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
31188    if (element != null) {
31189      open(name);
31190      composeCapabilityStatementCapabilityStatementImplementationComponentInner(element);
31191      close();
31192    }
31193  }
31194
31195  protected void composeCapabilityStatementCapabilityStatementImplementationComponentInner(CapabilityStatement.CapabilityStatementImplementationComponent element) throws IOException {
31196      composeBackbone(element);
31197      if (element.hasDescriptionElement()) {
31198        composeStringCore("description", element.getDescriptionElement(), false);
31199        composeStringExtras("description", element.getDescriptionElement(), false);
31200      }
31201      if (element.hasUrlElement()) {
31202        composeUrlCore("url", element.getUrlElement(), false);
31203        composeUrlExtras("url", element.getUrlElement(), false);
31204      }
31205      if (element.hasCustodian()) {
31206        composeReference("custodian", element.getCustodian());
31207      }
31208  }
31209
31210  protected void composeCapabilityStatementCapabilityStatementRestComponent(String name, CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
31211    if (element != null) {
31212      open(name);
31213      composeCapabilityStatementCapabilityStatementRestComponentInner(element);
31214      close();
31215    }
31216  }
31217
31218  protected void composeCapabilityStatementCapabilityStatementRestComponentInner(CapabilityStatement.CapabilityStatementRestComponent element) throws IOException {
31219      composeBackbone(element);
31220      if (element.hasModeElement()) {
31221        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
31222        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.RestfulCapabilityModeEnumFactory(), false);
31223      }
31224      if (element.hasDocumentationElement()) {
31225        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
31226        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
31227      }
31228      if (element.hasSecurity()) {
31229        composeCapabilityStatementCapabilityStatementRestSecurityComponent("security", element.getSecurity());
31230      }
31231      if (element.hasResource()) {
31232        openArray("resource");
31233        for (CapabilityStatement.CapabilityStatementRestResourceComponent e : element.getResource()) 
31234          composeCapabilityStatementCapabilityStatementRestResourceComponent(null, e);
31235        closeArray();
31236      };
31237      if (element.hasInteraction()) {
31238        openArray("interaction");
31239        for (CapabilityStatement.SystemInteractionComponent e : element.getInteraction()) 
31240          composeCapabilityStatementSystemInteractionComponent(null, e);
31241        closeArray();
31242      };
31243      if (element.hasSearchParam()) {
31244        openArray("searchParam");
31245        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
31246          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
31247        closeArray();
31248      };
31249      if (element.hasOperation()) {
31250        openArray("operation");
31251        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
31252          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
31253        closeArray();
31254      };
31255      if (element.hasCompartment()) {
31256        openArray("compartment");
31257        for (CanonicalType e : element.getCompartment()) 
31258          composeCanonicalCore(null, e, true);
31259        closeArray();
31260        if (anyHasExtras(element.getCompartment())) {
31261          openArray("_compartment");
31262          for (CanonicalType e : element.getCompartment()) 
31263            composeCanonicalExtras(null, e, true);
31264          closeArray();
31265        }
31266      };
31267  }
31268
31269  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponent(String name, CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
31270    if (element != null) {
31271      open(name);
31272      composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(element);
31273      close();
31274    }
31275  }
31276
31277  protected void composeCapabilityStatementCapabilityStatementRestSecurityComponentInner(CapabilityStatement.CapabilityStatementRestSecurityComponent element) throws IOException {
31278      composeBackbone(element);
31279      if (element.hasCorsElement()) {
31280        composeBooleanCore("cors", element.getCorsElement(), false);
31281        composeBooleanExtras("cors", element.getCorsElement(), false);
31282      }
31283      if (element.hasService()) {
31284        openArray("service");
31285        for (CodeableConcept e : element.getService()) 
31286          composeCodeableConcept(null, e);
31287        closeArray();
31288      };
31289      if (element.hasDescriptionElement()) {
31290        composeMarkdownCore("description", element.getDescriptionElement(), false);
31291        composeMarkdownExtras("description", element.getDescriptionElement(), false);
31292      }
31293  }
31294
31295  protected void composeCapabilityStatementCapabilityStatementRestResourceComponent(String name, CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
31296    if (element != null) {
31297      open(name);
31298      composeCapabilityStatementCapabilityStatementRestResourceComponentInner(element);
31299      close();
31300    }
31301  }
31302
31303  protected void composeCapabilityStatementCapabilityStatementRestResourceComponentInner(CapabilityStatement.CapabilityStatementRestResourceComponent element) throws IOException {
31304      composeBackbone(element);
31305      if (element.hasTypeElement()) {
31306        composeCodeCore("type", element.getTypeElement(), false);
31307        composeCodeExtras("type", element.getTypeElement(), false);
31308      }
31309      if (element.hasProfileElement()) {
31310        composeCanonicalCore("profile", element.getProfileElement(), false);
31311        composeCanonicalExtras("profile", element.getProfileElement(), false);
31312      }
31313      if (element.hasSupportedProfile()) {
31314        openArray("supportedProfile");
31315        for (CanonicalType e : element.getSupportedProfile()) 
31316          composeCanonicalCore(null, e, true);
31317        closeArray();
31318        if (anyHasExtras(element.getSupportedProfile())) {
31319          openArray("_supportedProfile");
31320          for (CanonicalType e : element.getSupportedProfile()) 
31321            composeCanonicalExtras(null, e, true);
31322          closeArray();
31323        }
31324      };
31325      if (element.hasDocumentationElement()) {
31326        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
31327        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
31328      }
31329      if (element.hasInteraction()) {
31330        openArray("interaction");
31331        for (CapabilityStatement.ResourceInteractionComponent e : element.getInteraction()) 
31332          composeCapabilityStatementResourceInteractionComponent(null, e);
31333        closeArray();
31334      };
31335      if (element.hasVersioningElement()) {
31336        composeEnumerationCore("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
31337        composeEnumerationExtras("versioning", element.getVersioningElement(), new CapabilityStatement.ResourceVersionPolicyEnumFactory(), false);
31338      }
31339      if (element.hasReadHistoryElement()) {
31340        composeBooleanCore("readHistory", element.getReadHistoryElement(), false);
31341        composeBooleanExtras("readHistory", element.getReadHistoryElement(), false);
31342      }
31343      if (element.hasUpdateCreateElement()) {
31344        composeBooleanCore("updateCreate", element.getUpdateCreateElement(), false);
31345        composeBooleanExtras("updateCreate", element.getUpdateCreateElement(), false);
31346      }
31347      if (element.hasConditionalCreateElement()) {
31348        composeBooleanCore("conditionalCreate", element.getConditionalCreateElement(), false);
31349        composeBooleanExtras("conditionalCreate", element.getConditionalCreateElement(), false);
31350      }
31351      if (element.hasConditionalReadElement()) {
31352        composeEnumerationCore("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
31353        composeEnumerationExtras("conditionalRead", element.getConditionalReadElement(), new CapabilityStatement.ConditionalReadStatusEnumFactory(), false);
31354      }
31355      if (element.hasConditionalUpdateElement()) {
31356        composeBooleanCore("conditionalUpdate", element.getConditionalUpdateElement(), false);
31357        composeBooleanExtras("conditionalUpdate", element.getConditionalUpdateElement(), false);
31358      }
31359      if (element.hasConditionalDeleteElement()) {
31360        composeEnumerationCore("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
31361        composeEnumerationExtras("conditionalDelete", element.getConditionalDeleteElement(), new CapabilityStatement.ConditionalDeleteStatusEnumFactory(), false);
31362      }
31363      if (element.hasReferencePolicy()) {
31364        openArray("referencePolicy");
31365        for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
31366          composeEnumerationCore(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
31367        closeArray();
31368        if (anyHasExtras(element.getReferencePolicy())) {
31369          openArray("_referencePolicy");
31370          for (Enumeration<CapabilityStatement.ReferenceHandlingPolicy> e : element.getReferencePolicy()) 
31371            composeEnumerationExtras(null, e, new CapabilityStatement.ReferenceHandlingPolicyEnumFactory(), true);
31372          closeArray();
31373        }
31374      };
31375      if (element.hasSearchInclude()) {
31376        openArray("searchInclude");
31377        for (StringType e : element.getSearchInclude()) 
31378          composeStringCore(null, e, true);
31379        closeArray();
31380        if (anyHasExtras(element.getSearchInclude())) {
31381          openArray("_searchInclude");
31382          for (StringType e : element.getSearchInclude()) 
31383            composeStringExtras(null, e, true);
31384          closeArray();
31385        }
31386      };
31387      if (element.hasSearchRevInclude()) {
31388        openArray("searchRevInclude");
31389        for (StringType e : element.getSearchRevInclude()) 
31390          composeStringCore(null, e, true);
31391        closeArray();
31392        if (anyHasExtras(element.getSearchRevInclude())) {
31393          openArray("_searchRevInclude");
31394          for (StringType e : element.getSearchRevInclude()) 
31395            composeStringExtras(null, e, true);
31396          closeArray();
31397        }
31398      };
31399      if (element.hasSearchParam()) {
31400        openArray("searchParam");
31401        for (CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent e : element.getSearchParam()) 
31402          composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(null, e);
31403        closeArray();
31404      };
31405      if (element.hasOperation()) {
31406        openArray("operation");
31407        for (CapabilityStatement.CapabilityStatementRestResourceOperationComponent e : element.getOperation()) 
31408          composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(null, e);
31409        closeArray();
31410      };
31411  }
31412
31413  protected void composeCapabilityStatementResourceInteractionComponent(String name, CapabilityStatement.ResourceInteractionComponent element) throws IOException {
31414    if (element != null) {
31415      open(name);
31416      composeCapabilityStatementResourceInteractionComponentInner(element);
31417      close();
31418    }
31419  }
31420
31421  protected void composeCapabilityStatementResourceInteractionComponentInner(CapabilityStatement.ResourceInteractionComponent element) throws IOException {
31422      composeBackbone(element);
31423      if (element.hasCodeElement()) {
31424        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
31425        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.TypeRestfulInteractionEnumFactory(), false);
31426      }
31427      if (element.hasDocumentationElement()) {
31428        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
31429        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
31430      }
31431  }
31432
31433  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponent(String name, CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
31434    if (element != null) {
31435      open(name);
31436      composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(element);
31437      close();
31438    }
31439  }
31440
31441  protected void composeCapabilityStatementCapabilityStatementRestResourceSearchParamComponentInner(CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent element) throws IOException {
31442      composeBackbone(element);
31443      if (element.hasNameElement()) {
31444        composeStringCore("name", element.getNameElement(), false);
31445        composeStringExtras("name", element.getNameElement(), false);
31446      }
31447      if (element.hasDefinitionElement()) {
31448        composeCanonicalCore("definition", element.getDefinitionElement(), false);
31449        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
31450      }
31451      if (element.hasTypeElement()) {
31452        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
31453        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
31454      }
31455      if (element.hasDocumentationElement()) {
31456        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
31457        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
31458      }
31459  }
31460
31461  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponent(String name, CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
31462    if (element != null) {
31463      open(name);
31464      composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(element);
31465      close();
31466    }
31467  }
31468
31469  protected void composeCapabilityStatementCapabilityStatementRestResourceOperationComponentInner(CapabilityStatement.CapabilityStatementRestResourceOperationComponent element) throws IOException {
31470      composeBackbone(element);
31471      if (element.hasNameElement()) {
31472        composeStringCore("name", element.getNameElement(), false);
31473        composeStringExtras("name", element.getNameElement(), false);
31474      }
31475      if (element.hasDefinitionElement()) {
31476        composeCanonicalCore("definition", element.getDefinitionElement(), false);
31477        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
31478      }
31479      if (element.hasDocumentationElement()) {
31480        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
31481        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
31482      }
31483  }
31484
31485  protected void composeCapabilityStatementSystemInteractionComponent(String name, CapabilityStatement.SystemInteractionComponent element) throws IOException {
31486    if (element != null) {
31487      open(name);
31488      composeCapabilityStatementSystemInteractionComponentInner(element);
31489      close();
31490    }
31491  }
31492
31493  protected void composeCapabilityStatementSystemInteractionComponentInner(CapabilityStatement.SystemInteractionComponent element) throws IOException {
31494      composeBackbone(element);
31495      if (element.hasCodeElement()) {
31496        composeEnumerationCore("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
31497        composeEnumerationExtras("code", element.getCodeElement(), new CapabilityStatement.SystemRestfulInteractionEnumFactory(), false);
31498      }
31499      if (element.hasDocumentationElement()) {
31500        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
31501        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
31502      }
31503  }
31504
31505  protected void composeCapabilityStatementCapabilityStatementMessagingComponent(String name, CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
31506    if (element != null) {
31507      open(name);
31508      composeCapabilityStatementCapabilityStatementMessagingComponentInner(element);
31509      close();
31510    }
31511  }
31512
31513  protected void composeCapabilityStatementCapabilityStatementMessagingComponentInner(CapabilityStatement.CapabilityStatementMessagingComponent element) throws IOException {
31514      composeBackbone(element);
31515      if (element.hasEndpoint()) {
31516        openArray("endpoint");
31517        for (CapabilityStatement.CapabilityStatementMessagingEndpointComponent e : element.getEndpoint()) 
31518          composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(null, e);
31519        closeArray();
31520      };
31521      if (element.hasReliableCacheElement()) {
31522        composeUnsignedIntCore("reliableCache", element.getReliableCacheElement(), false);
31523        composeUnsignedIntExtras("reliableCache", element.getReliableCacheElement(), false);
31524      }
31525      if (element.hasDocumentationElement()) {
31526        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
31527        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
31528      }
31529      if (element.hasSupportedMessage()) {
31530        openArray("supportedMessage");
31531        for (CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent e : element.getSupportedMessage()) 
31532          composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(null, e);
31533        closeArray();
31534      };
31535  }
31536
31537  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponent(String name, CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
31538    if (element != null) {
31539      open(name);
31540      composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(element);
31541      close();
31542    }
31543  }
31544
31545  protected void composeCapabilityStatementCapabilityStatementMessagingEndpointComponentInner(CapabilityStatement.CapabilityStatementMessagingEndpointComponent element) throws IOException {
31546      composeBackbone(element);
31547      if (element.hasProtocol()) {
31548        composeCoding("protocol", element.getProtocol());
31549      }
31550      if (element.hasAddressElement()) {
31551        composeUrlCore("address", element.getAddressElement(), false);
31552        composeUrlExtras("address", element.getAddressElement(), false);
31553      }
31554  }
31555
31556  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponent(String name, CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
31557    if (element != null) {
31558      open(name);
31559      composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(element);
31560      close();
31561    }
31562  }
31563
31564  protected void composeCapabilityStatementCapabilityStatementMessagingSupportedMessageComponentInner(CapabilityStatement.CapabilityStatementMessagingSupportedMessageComponent element) throws IOException {
31565      composeBackbone(element);
31566      if (element.hasModeElement()) {
31567        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
31568        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.EventCapabilityModeEnumFactory(), false);
31569      }
31570      if (element.hasDefinitionElement()) {
31571        composeCanonicalCore("definition", element.getDefinitionElement(), false);
31572        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
31573      }
31574  }
31575
31576  protected void composeCapabilityStatementCapabilityStatementDocumentComponent(String name, CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
31577    if (element != null) {
31578      open(name);
31579      composeCapabilityStatementCapabilityStatementDocumentComponentInner(element);
31580      close();
31581    }
31582  }
31583
31584  protected void composeCapabilityStatementCapabilityStatementDocumentComponentInner(CapabilityStatement.CapabilityStatementDocumentComponent element) throws IOException {
31585      composeBackbone(element);
31586      if (element.hasModeElement()) {
31587        composeEnumerationCore("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
31588        composeEnumerationExtras("mode", element.getModeElement(), new CapabilityStatement.DocumentModeEnumFactory(), false);
31589      }
31590      if (element.hasDocumentationElement()) {
31591        composeMarkdownCore("documentation", element.getDocumentationElement(), false);
31592        composeMarkdownExtras("documentation", element.getDocumentationElement(), false);
31593      }
31594      if (element.hasProfileElement()) {
31595        composeCanonicalCore("profile", element.getProfileElement(), false);
31596        composeCanonicalExtras("profile", element.getProfileElement(), false);
31597      }
31598  }
31599
31600  protected void composeCarePlan(String name, CarePlan element) throws IOException {
31601    if (element != null) {
31602      prop("resourceType", name);
31603      composeCarePlanInner(element);
31604    }
31605  }
31606
31607  protected void composeCarePlanInner(CarePlan element) throws IOException {
31608      composeDomainResourceElements(element);
31609      if (element.hasIdentifier()) {
31610        openArray("identifier");
31611        for (Identifier e : element.getIdentifier()) 
31612          composeIdentifier(null, e);
31613        closeArray();
31614      };
31615      if (element.hasInstantiatesCanonical()) {
31616        openArray("instantiatesCanonical");
31617        for (CanonicalType e : element.getInstantiatesCanonical()) 
31618          composeCanonicalCore(null, e, true);
31619        closeArray();
31620        if (anyHasExtras(element.getInstantiatesCanonical())) {
31621          openArray("_instantiatesCanonical");
31622          for (CanonicalType e : element.getInstantiatesCanonical()) 
31623            composeCanonicalExtras(null, e, true);
31624          closeArray();
31625        }
31626      };
31627      if (element.hasInstantiatesUri()) {
31628        openArray("instantiatesUri");
31629        for (UriType e : element.getInstantiatesUri()) 
31630          composeUriCore(null, e, true);
31631        closeArray();
31632        if (anyHasExtras(element.getInstantiatesUri())) {
31633          openArray("_instantiatesUri");
31634          for (UriType e : element.getInstantiatesUri()) 
31635            composeUriExtras(null, e, true);
31636          closeArray();
31637        }
31638      };
31639      if (element.hasBasedOn()) {
31640        openArray("basedOn");
31641        for (Reference e : element.getBasedOn()) 
31642          composeReference(null, e);
31643        closeArray();
31644      };
31645      if (element.hasReplaces()) {
31646        openArray("replaces");
31647        for (Reference e : element.getReplaces()) 
31648          composeReference(null, e);
31649        closeArray();
31650      };
31651      if (element.hasPartOf()) {
31652        openArray("partOf");
31653        for (Reference e : element.getPartOf()) 
31654          composeReference(null, e);
31655        closeArray();
31656      };
31657      if (element.hasStatusElement()) {
31658        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
31659        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanStatusEnumFactory(), false);
31660      }
31661      if (element.hasIntentElement()) {
31662        composeEnumerationCore("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
31663        composeEnumerationExtras("intent", element.getIntentElement(), new CarePlan.CarePlanIntentEnumFactory(), false);
31664      }
31665      if (element.hasCategory()) {
31666        openArray("category");
31667        for (CodeableConcept e : element.getCategory()) 
31668          composeCodeableConcept(null, e);
31669        closeArray();
31670      };
31671      if (element.hasTitleElement()) {
31672        composeStringCore("title", element.getTitleElement(), false);
31673        composeStringExtras("title", element.getTitleElement(), false);
31674      }
31675      if (element.hasDescriptionElement()) {
31676        composeStringCore("description", element.getDescriptionElement(), false);
31677        composeStringExtras("description", element.getDescriptionElement(), false);
31678      }
31679      if (element.hasSubject()) {
31680        composeReference("subject", element.getSubject());
31681      }
31682      if (element.hasContext()) {
31683        composeReference("context", element.getContext());
31684      }
31685      if (element.hasPeriod()) {
31686        composePeriod("period", element.getPeriod());
31687      }
31688      if (element.hasCreatedElement()) {
31689        composeDateTimeCore("created", element.getCreatedElement(), false);
31690        composeDateTimeExtras("created", element.getCreatedElement(), false);
31691      }
31692      if (element.hasAuthor()) {
31693        composeReference("author", element.getAuthor());
31694      }
31695      if (element.hasContributor()) {
31696        openArray("contributor");
31697        for (Reference e : element.getContributor()) 
31698          composeReference(null, e);
31699        closeArray();
31700      };
31701      if (element.hasCareTeam()) {
31702        openArray("careTeam");
31703        for (Reference e : element.getCareTeam()) 
31704          composeReference(null, e);
31705        closeArray();
31706      };
31707      if (element.hasAddresses()) {
31708        openArray("addresses");
31709        for (Reference e : element.getAddresses()) 
31710          composeReference(null, e);
31711        closeArray();
31712      };
31713      if (element.hasSupportingInfo()) {
31714        openArray("supportingInfo");
31715        for (Reference e : element.getSupportingInfo()) 
31716          composeReference(null, e);
31717        closeArray();
31718      };
31719      if (element.hasGoal()) {
31720        openArray("goal");
31721        for (Reference e : element.getGoal()) 
31722          composeReference(null, e);
31723        closeArray();
31724      };
31725      if (element.hasActivity()) {
31726        openArray("activity");
31727        for (CarePlan.CarePlanActivityComponent e : element.getActivity()) 
31728          composeCarePlanCarePlanActivityComponent(null, e);
31729        closeArray();
31730      };
31731      if (element.hasNote()) {
31732        openArray("note");
31733        for (Annotation e : element.getNote()) 
31734          composeAnnotation(null, e);
31735        closeArray();
31736      };
31737  }
31738
31739  protected void composeCarePlanCarePlanActivityComponent(String name, CarePlan.CarePlanActivityComponent element) throws IOException {
31740    if (element != null) {
31741      open(name);
31742      composeCarePlanCarePlanActivityComponentInner(element);
31743      close();
31744    }
31745  }
31746
31747  protected void composeCarePlanCarePlanActivityComponentInner(CarePlan.CarePlanActivityComponent element) throws IOException {
31748      composeBackbone(element);
31749      if (element.hasOutcomeCodeableConcept()) {
31750        openArray("outcomeCodeableConcept");
31751        for (CodeableConcept e : element.getOutcomeCodeableConcept()) 
31752          composeCodeableConcept(null, e);
31753        closeArray();
31754      };
31755      if (element.hasOutcomeReference()) {
31756        openArray("outcomeReference");
31757        for (Reference e : element.getOutcomeReference()) 
31758          composeReference(null, e);
31759        closeArray();
31760      };
31761      if (element.hasProgress()) {
31762        openArray("progress");
31763        for (Annotation e : element.getProgress()) 
31764          composeAnnotation(null, e);
31765        closeArray();
31766      };
31767      if (element.hasReference()) {
31768        composeReference("reference", element.getReference());
31769      }
31770      if (element.hasDetail()) {
31771        composeCarePlanCarePlanActivityDetailComponent("detail", element.getDetail());
31772      }
31773  }
31774
31775  protected void composeCarePlanCarePlanActivityDetailComponent(String name, CarePlan.CarePlanActivityDetailComponent element) throws IOException {
31776    if (element != null) {
31777      open(name);
31778      composeCarePlanCarePlanActivityDetailComponentInner(element);
31779      close();
31780    }
31781  }
31782
31783  protected void composeCarePlanCarePlanActivityDetailComponentInner(CarePlan.CarePlanActivityDetailComponent element) throws IOException {
31784      composeBackbone(element);
31785      if (element.hasKindElement()) {
31786        composeEnumerationCore("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
31787        composeEnumerationExtras("kind", element.getKindElement(), new CarePlan.CarePlanActivityKindEnumFactory(), false);
31788      }
31789      if (element.hasInstantiatesCanonical()) {
31790        openArray("instantiatesCanonical");
31791        for (CanonicalType e : element.getInstantiatesCanonical()) 
31792          composeCanonicalCore(null, e, true);
31793        closeArray();
31794        if (anyHasExtras(element.getInstantiatesCanonical())) {
31795          openArray("_instantiatesCanonical");
31796          for (CanonicalType e : element.getInstantiatesCanonical()) 
31797            composeCanonicalExtras(null, e, true);
31798          closeArray();
31799        }
31800      };
31801      if (element.hasInstantiatesUri()) {
31802        openArray("instantiatesUri");
31803        for (UriType e : element.getInstantiatesUri()) 
31804          composeUriCore(null, e, true);
31805        closeArray();
31806        if (anyHasExtras(element.getInstantiatesUri())) {
31807          openArray("_instantiatesUri");
31808          for (UriType e : element.getInstantiatesUri()) 
31809            composeUriExtras(null, e, true);
31810          closeArray();
31811        }
31812      };
31813      if (element.hasCode()) {
31814        composeCodeableConcept("code", element.getCode());
31815      }
31816      if (element.hasReasonCode()) {
31817        openArray("reasonCode");
31818        for (CodeableConcept e : element.getReasonCode()) 
31819          composeCodeableConcept(null, e);
31820        closeArray();
31821      };
31822      if (element.hasReasonReference()) {
31823        openArray("reasonReference");
31824        for (Reference e : element.getReasonReference()) 
31825          composeReference(null, e);
31826        closeArray();
31827      };
31828      if (element.hasGoal()) {
31829        openArray("goal");
31830        for (Reference e : element.getGoal()) 
31831          composeReference(null, e);
31832        closeArray();
31833      };
31834      if (element.hasStatusElement()) {
31835        composeEnumerationCore("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
31836        composeEnumerationExtras("status", element.getStatusElement(), new CarePlan.CarePlanActivityStatusEnumFactory(), false);
31837      }
31838      if (element.hasStatusReason()) {
31839        composeCodeableConcept("statusReason", element.getStatusReason());
31840      }
31841      if (element.hasDoNotPerformElement()) {
31842        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
31843        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
31844      }
31845      if (element.hasScheduled()) {
31846        composeType("scheduled", element.getScheduled());
31847      }
31848      if (element.hasLocation()) {
31849        composeReference("location", element.getLocation());
31850      }
31851      if (element.hasPerformer()) {
31852        openArray("performer");
31853        for (Reference e : element.getPerformer()) 
31854          composeReference(null, e);
31855        closeArray();
31856      };
31857      if (element.hasProduct()) {
31858        composeType("product", element.getProduct());
31859      }
31860      if (element.hasDailyAmount()) {
31861        composeQuantity("dailyAmount", element.getDailyAmount());
31862      }
31863      if (element.hasQuantity()) {
31864        composeQuantity("quantity", element.getQuantity());
31865      }
31866      if (element.hasDescriptionElement()) {
31867        composeStringCore("description", element.getDescriptionElement(), false);
31868        composeStringExtras("description", element.getDescriptionElement(), false);
31869      }
31870  }
31871
31872  protected void composeCareTeam(String name, CareTeam element) throws IOException {
31873    if (element != null) {
31874      prop("resourceType", name);
31875      composeCareTeamInner(element);
31876    }
31877  }
31878
31879  protected void composeCareTeamInner(CareTeam element) throws IOException {
31880      composeDomainResourceElements(element);
31881      if (element.hasIdentifier()) {
31882        openArray("identifier");
31883        for (Identifier e : element.getIdentifier()) 
31884          composeIdentifier(null, e);
31885        closeArray();
31886      };
31887      if (element.hasStatusElement()) {
31888        composeEnumerationCore("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
31889        composeEnumerationExtras("status", element.getStatusElement(), new CareTeam.CareTeamStatusEnumFactory(), false);
31890      }
31891      if (element.hasCategory()) {
31892        openArray("category");
31893        for (CodeableConcept e : element.getCategory()) 
31894          composeCodeableConcept(null, e);
31895        closeArray();
31896      };
31897      if (element.hasNameElement()) {
31898        composeStringCore("name", element.getNameElement(), false);
31899        composeStringExtras("name", element.getNameElement(), false);
31900      }
31901      if (element.hasSubject()) {
31902        composeReference("subject", element.getSubject());
31903      }
31904      if (element.hasContext()) {
31905        composeReference("context", element.getContext());
31906      }
31907      if (element.hasPeriod()) {
31908        composePeriod("period", element.getPeriod());
31909      }
31910      if (element.hasParticipant()) {
31911        openArray("participant");
31912        for (CareTeam.CareTeamParticipantComponent e : element.getParticipant()) 
31913          composeCareTeamCareTeamParticipantComponent(null, e);
31914        closeArray();
31915      };
31916      if (element.hasReasonCode()) {
31917        openArray("reasonCode");
31918        for (CodeableConcept e : element.getReasonCode()) 
31919          composeCodeableConcept(null, e);
31920        closeArray();
31921      };
31922      if (element.hasReasonReference()) {
31923        openArray("reasonReference");
31924        for (Reference e : element.getReasonReference()) 
31925          composeReference(null, e);
31926        closeArray();
31927      };
31928      if (element.hasManagingOrganization()) {
31929        openArray("managingOrganization");
31930        for (Reference e : element.getManagingOrganization()) 
31931          composeReference(null, e);
31932        closeArray();
31933      };
31934      if (element.hasTelecom()) {
31935        openArray("telecom");
31936        for (ContactPoint e : element.getTelecom()) 
31937          composeContactPoint(null, e);
31938        closeArray();
31939      };
31940      if (element.hasNote()) {
31941        openArray("note");
31942        for (Annotation e : element.getNote()) 
31943          composeAnnotation(null, e);
31944        closeArray();
31945      };
31946  }
31947
31948  protected void composeCareTeamCareTeamParticipantComponent(String name, CareTeam.CareTeamParticipantComponent element) throws IOException {
31949    if (element != null) {
31950      open(name);
31951      composeCareTeamCareTeamParticipantComponentInner(element);
31952      close();
31953    }
31954  }
31955
31956  protected void composeCareTeamCareTeamParticipantComponentInner(CareTeam.CareTeamParticipantComponent element) throws IOException {
31957      composeBackbone(element);
31958      if (element.hasRole()) {
31959        openArray("role");
31960        for (CodeableConcept e : element.getRole()) 
31961          composeCodeableConcept(null, e);
31962        closeArray();
31963      };
31964      if (element.hasMember()) {
31965        composeReference("member", element.getMember());
31966      }
31967      if (element.hasOnBehalfOf()) {
31968        composeReference("onBehalfOf", element.getOnBehalfOf());
31969      }
31970      if (element.hasPeriod()) {
31971        composePeriod("period", element.getPeriod());
31972      }
31973  }
31974
31975  protected void composeCatalogEntry(String name, CatalogEntry element) throws IOException {
31976    if (element != null) {
31977      prop("resourceType", name);
31978      composeCatalogEntryInner(element);
31979    }
31980  }
31981
31982  protected void composeCatalogEntryInner(CatalogEntry element) throws IOException {
31983      composeDomainResourceElements(element);
31984      if (element.hasIdentifier()) {
31985        openArray("identifier");
31986        for (Identifier e : element.getIdentifier()) 
31987          composeIdentifier(null, e);
31988        closeArray();
31989      };
31990      if (element.hasType()) {
31991        composeCodeableConcept("type", element.getType());
31992      }
31993      if (element.hasOrderableElement()) {
31994        composeBooleanCore("orderable", element.getOrderableElement(), false);
31995        composeBooleanExtras("orderable", element.getOrderableElement(), false);
31996      }
31997      if (element.hasReferencedItem()) {
31998        composeReference("referencedItem", element.getReferencedItem());
31999      }
32000      if (element.hasAdditionalIdentifier()) {
32001        openArray("additionalIdentifier");
32002        for (Identifier e : element.getAdditionalIdentifier()) 
32003          composeIdentifier(null, e);
32004        closeArray();
32005      };
32006      if (element.hasClassification()) {
32007        openArray("classification");
32008        for (CodeableConcept e : element.getClassification()) 
32009          composeCodeableConcept(null, e);
32010        closeArray();
32011      };
32012      if (element.hasStatusElement()) {
32013        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32014        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32015      }
32016      if (element.hasValidityPeriod()) {
32017        composePeriod("validityPeriod", element.getValidityPeriod());
32018      }
32019      if (element.hasValidToElement()) {
32020        composeDateTimeCore("validTo", element.getValidToElement(), false);
32021        composeDateTimeExtras("validTo", element.getValidToElement(), false);
32022      }
32023      if (element.hasLastUpdatedElement()) {
32024        composeDateTimeCore("lastUpdated", element.getLastUpdatedElement(), false);
32025        composeDateTimeExtras("lastUpdated", element.getLastUpdatedElement(), false);
32026      }
32027      if (element.hasAdditionalCharacteristic()) {
32028        openArray("additionalCharacteristic");
32029        for (CodeableConcept e : element.getAdditionalCharacteristic()) 
32030          composeCodeableConcept(null, e);
32031        closeArray();
32032      };
32033      if (element.hasAdditionalClassification()) {
32034        openArray("additionalClassification");
32035        for (CodeableConcept e : element.getAdditionalClassification()) 
32036          composeCodeableConcept(null, e);
32037        closeArray();
32038      };
32039      if (element.hasRelatedEntry()) {
32040        openArray("relatedEntry");
32041        for (CatalogEntry.CatalogEntryRelatedEntryComponent e : element.getRelatedEntry()) 
32042          composeCatalogEntryCatalogEntryRelatedEntryComponent(null, e);
32043        closeArray();
32044      };
32045  }
32046
32047  protected void composeCatalogEntryCatalogEntryRelatedEntryComponent(String name, CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
32048    if (element != null) {
32049      open(name);
32050      composeCatalogEntryCatalogEntryRelatedEntryComponentInner(element);
32051      close();
32052    }
32053  }
32054
32055  protected void composeCatalogEntryCatalogEntryRelatedEntryComponentInner(CatalogEntry.CatalogEntryRelatedEntryComponent element) throws IOException {
32056      composeBackbone(element);
32057      if (element.hasRelationtypeElement()) {
32058        composeEnumerationCore("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
32059        composeEnumerationExtras("relationtype", element.getRelationtypeElement(), new CatalogEntry.CatalogEntryRelationTypeEnumFactory(), false);
32060      }
32061      if (element.hasItem()) {
32062        composeReference("item", element.getItem());
32063      }
32064  }
32065
32066  protected void composeChargeItem(String name, ChargeItem element) throws IOException {
32067    if (element != null) {
32068      prop("resourceType", name);
32069      composeChargeItemInner(element);
32070    }
32071  }
32072
32073  protected void composeChargeItemInner(ChargeItem element) throws IOException {
32074      composeDomainResourceElements(element);
32075      if (element.hasIdentifier()) {
32076        openArray("identifier");
32077        for (Identifier e : element.getIdentifier()) 
32078          composeIdentifier(null, e);
32079        closeArray();
32080      };
32081      if (element.hasDefinition()) {
32082        openArray("definition");
32083        for (UriType e : element.getDefinition()) 
32084          composeUriCore(null, e, true);
32085        closeArray();
32086        if (anyHasExtras(element.getDefinition())) {
32087          openArray("_definition");
32088          for (UriType e : element.getDefinition()) 
32089            composeUriExtras(null, e, true);
32090          closeArray();
32091        }
32092      };
32093      if (element.hasStatusElement()) {
32094        composeEnumerationCore("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
32095        composeEnumerationExtras("status", element.getStatusElement(), new ChargeItem.ChargeItemStatusEnumFactory(), false);
32096      }
32097      if (element.hasPartOf()) {
32098        openArray("partOf");
32099        for (Reference e : element.getPartOf()) 
32100          composeReference(null, e);
32101        closeArray();
32102      };
32103      if (element.hasCode()) {
32104        composeCodeableConcept("code", element.getCode());
32105      }
32106      if (element.hasSubject()) {
32107        composeReference("subject", element.getSubject());
32108      }
32109      if (element.hasContext()) {
32110        composeReference("context", element.getContext());
32111      }
32112      if (element.hasOccurrence()) {
32113        composeType("occurrence", element.getOccurrence());
32114      }
32115      if (element.hasPerformer()) {
32116        openArray("performer");
32117        for (ChargeItem.ChargeItemPerformerComponent e : element.getPerformer()) 
32118          composeChargeItemChargeItemPerformerComponent(null, e);
32119        closeArray();
32120      };
32121      if (element.hasPerformingOrganization()) {
32122        composeReference("performingOrganization", element.getPerformingOrganization());
32123      }
32124      if (element.hasRequestingOrganization()) {
32125        composeReference("requestingOrganization", element.getRequestingOrganization());
32126      }
32127      if (element.hasCostCenter()) {
32128        composeReference("costCenter", element.getCostCenter());
32129      }
32130      if (element.hasQuantity()) {
32131        composeQuantity("quantity", element.getQuantity());
32132      }
32133      if (element.hasBodysite()) {
32134        openArray("bodysite");
32135        for (CodeableConcept e : element.getBodysite()) 
32136          composeCodeableConcept(null, e);
32137        closeArray();
32138      };
32139      if (element.hasFactorOverrideElement()) {
32140        composeDecimalCore("factorOverride", element.getFactorOverrideElement(), false);
32141        composeDecimalExtras("factorOverride", element.getFactorOverrideElement(), false);
32142      }
32143      if (element.hasPriceOverride()) {
32144        composeMoney("priceOverride", element.getPriceOverride());
32145      }
32146      if (element.hasOverrideReasonElement()) {
32147        composeStringCore("overrideReason", element.getOverrideReasonElement(), false);
32148        composeStringExtras("overrideReason", element.getOverrideReasonElement(), false);
32149      }
32150      if (element.hasEnterer()) {
32151        composeReference("enterer", element.getEnterer());
32152      }
32153      if (element.hasEnteredDateElement()) {
32154        composeDateTimeCore("enteredDate", element.getEnteredDateElement(), false);
32155        composeDateTimeExtras("enteredDate", element.getEnteredDateElement(), false);
32156      }
32157      if (element.hasReason()) {
32158        openArray("reason");
32159        for (CodeableConcept e : element.getReason()) 
32160          composeCodeableConcept(null, e);
32161        closeArray();
32162      };
32163      if (element.hasService()) {
32164        openArray("service");
32165        for (Reference e : element.getService()) 
32166          composeReference(null, e);
32167        closeArray();
32168      };
32169      if (element.hasProduct()) {
32170        composeType("product", element.getProduct());
32171      }
32172      if (element.hasAccount()) {
32173        openArray("account");
32174        for (Reference e : element.getAccount()) 
32175          composeReference(null, e);
32176        closeArray();
32177      };
32178      if (element.hasNote()) {
32179        openArray("note");
32180        for (Annotation e : element.getNote()) 
32181          composeAnnotation(null, e);
32182        closeArray();
32183      };
32184      if (element.hasSupportingInformation()) {
32185        openArray("supportingInformation");
32186        for (Reference e : element.getSupportingInformation()) 
32187          composeReference(null, e);
32188        closeArray();
32189      };
32190  }
32191
32192  protected void composeChargeItemChargeItemPerformerComponent(String name, ChargeItem.ChargeItemPerformerComponent element) throws IOException {
32193    if (element != null) {
32194      open(name);
32195      composeChargeItemChargeItemPerformerComponentInner(element);
32196      close();
32197    }
32198  }
32199
32200  protected void composeChargeItemChargeItemPerformerComponentInner(ChargeItem.ChargeItemPerformerComponent element) throws IOException {
32201      composeBackbone(element);
32202      if (element.hasFunction()) {
32203        composeCodeableConcept("function", element.getFunction());
32204      }
32205      if (element.hasActor()) {
32206        composeReference("actor", element.getActor());
32207      }
32208  }
32209
32210  protected void composeChargeItemDefinition(String name, ChargeItemDefinition element) throws IOException {
32211    if (element != null) {
32212      prop("resourceType", name);
32213      composeChargeItemDefinitionInner(element);
32214    }
32215  }
32216
32217  protected void composeChargeItemDefinitionInner(ChargeItemDefinition element) throws IOException {
32218      composeDomainResourceElements(element);
32219      if (element.hasUrlElement()) {
32220        composeUriCore("url", element.getUrlElement(), false);
32221        composeUriExtras("url", element.getUrlElement(), false);
32222      }
32223      if (element.hasIdentifier()) {
32224        openArray("identifier");
32225        for (Identifier e : element.getIdentifier()) 
32226          composeIdentifier(null, e);
32227        closeArray();
32228      };
32229      if (element.hasVersionElement()) {
32230        composeStringCore("version", element.getVersionElement(), false);
32231        composeStringExtras("version", element.getVersionElement(), false);
32232      }
32233      if (element.hasTitleElement()) {
32234        composeStringCore("title", element.getTitleElement(), false);
32235        composeStringExtras("title", element.getTitleElement(), false);
32236      }
32237      if (element.hasDerivedFromUri()) {
32238        openArray("derivedFromUri");
32239        for (UriType e : element.getDerivedFromUri()) 
32240          composeUriCore(null, e, true);
32241        closeArray();
32242        if (anyHasExtras(element.getDerivedFromUri())) {
32243          openArray("_derivedFromUri");
32244          for (UriType e : element.getDerivedFromUri()) 
32245            composeUriExtras(null, e, true);
32246          closeArray();
32247        }
32248      };
32249      if (element.hasPartOf()) {
32250        openArray("partOf");
32251        for (CanonicalType e : element.getPartOf()) 
32252          composeCanonicalCore(null, e, true);
32253        closeArray();
32254        if (anyHasExtras(element.getPartOf())) {
32255          openArray("_partOf");
32256          for (CanonicalType e : element.getPartOf()) 
32257            composeCanonicalExtras(null, e, true);
32258          closeArray();
32259        }
32260      };
32261      if (element.hasReplaces()) {
32262        openArray("replaces");
32263        for (CanonicalType e : element.getReplaces()) 
32264          composeCanonicalCore(null, e, true);
32265        closeArray();
32266        if (anyHasExtras(element.getReplaces())) {
32267          openArray("_replaces");
32268          for (CanonicalType e : element.getReplaces()) 
32269            composeCanonicalExtras(null, e, true);
32270          closeArray();
32271        }
32272      };
32273      if (element.hasStatusElement()) {
32274        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32275        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
32276      }
32277      if (element.hasExperimentalElement()) {
32278        composeBooleanCore("experimental", element.getExperimentalElement(), false);
32279        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
32280      }
32281      if (element.hasDateElement()) {
32282        composeDateTimeCore("date", element.getDateElement(), false);
32283        composeDateTimeExtras("date", element.getDateElement(), false);
32284      }
32285      if (element.hasPublisherElement()) {
32286        composeStringCore("publisher", element.getPublisherElement(), false);
32287        composeStringExtras("publisher", element.getPublisherElement(), false);
32288      }
32289      if (element.hasContact()) {
32290        openArray("contact");
32291        for (ContactDetail e : element.getContact()) 
32292          composeContactDetail(null, e);
32293        closeArray();
32294      };
32295      if (element.hasDescriptionElement()) {
32296        composeMarkdownCore("description", element.getDescriptionElement(), false);
32297        composeMarkdownExtras("description", element.getDescriptionElement(), false);
32298      }
32299      if (element.hasUseContext()) {
32300        openArray("useContext");
32301        for (UsageContext e : element.getUseContext()) 
32302          composeUsageContext(null, e);
32303        closeArray();
32304      };
32305      if (element.hasJurisdiction()) {
32306        openArray("jurisdiction");
32307        for (CodeableConcept e : element.getJurisdiction()) 
32308          composeCodeableConcept(null, e);
32309        closeArray();
32310      };
32311      if (element.hasCopyrightElement()) {
32312        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
32313        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
32314      }
32315      if (element.hasApprovalDateElement()) {
32316        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
32317        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
32318      }
32319      if (element.hasLastReviewDateElement()) {
32320        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
32321        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
32322      }
32323      if (element.hasEffectivePeriod()) {
32324        composePeriod("effectivePeriod", element.getEffectivePeriod());
32325      }
32326      if (element.hasCode()) {
32327        composeCodeableConcept("code", element.getCode());
32328      }
32329      if (element.hasInstance()) {
32330        openArray("instance");
32331        for (Reference e : element.getInstance()) 
32332          composeReference(null, e);
32333        closeArray();
32334      };
32335      if (element.hasApplicability()) {
32336        openArray("applicability");
32337        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
32338          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
32339        closeArray();
32340      };
32341      if (element.hasPropertyGroup()) {
32342        openArray("propertyGroup");
32343        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent e : element.getPropertyGroup()) 
32344          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(null, e);
32345        closeArray();
32346      };
32347  }
32348
32349  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(String name, ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
32350    if (element != null) {
32351      open(name);
32352      composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(element);
32353      close();
32354    }
32355  }
32356
32357  protected void composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponentInner(ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent element) throws IOException {
32358      composeBackbone(element);
32359      if (element.hasDescriptionElement()) {
32360        composeStringCore("description", element.getDescriptionElement(), false);
32361        composeStringExtras("description", element.getDescriptionElement(), false);
32362      }
32363      if (element.hasLanguageElement()) {
32364        composeStringCore("language", element.getLanguageElement(), false);
32365        composeStringExtras("language", element.getLanguageElement(), false);
32366      }
32367      if (element.hasExpressionElement()) {
32368        composeStringCore("expression", element.getExpressionElement(), false);
32369        composeStringExtras("expression", element.getExpressionElement(), false);
32370      }
32371  }
32372
32373  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
32374    if (element != null) {
32375      open(name);
32376      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(element);
32377      close();
32378    }
32379  }
32380
32381  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupComponent element) throws IOException {
32382      composeBackbone(element);
32383      if (element.hasApplicability()) {
32384        openArray("applicability");
32385        for (ChargeItemDefinition.ChargeItemDefinitionApplicabilityComponent e : element.getApplicability()) 
32386          composeChargeItemDefinitionChargeItemDefinitionApplicabilityComponent(null, e);
32387        closeArray();
32388      };
32389      if (element.hasPriceComponent()) {
32390        openArray("priceComponent");
32391        for (ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent e : element.getPriceComponent()) 
32392          composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(null, e);
32393        closeArray();
32394      };
32395  }
32396
32397  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponent(String name, ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
32398    if (element != null) {
32399      open(name);
32400      composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(element);
32401      close();
32402    }
32403  }
32404
32405  protected void composeChargeItemDefinitionChargeItemDefinitionPropertyGroupPriceComponentComponentInner(ChargeItemDefinition.ChargeItemDefinitionPropertyGroupPriceComponentComponent element) throws IOException {
32406      composeBackbone(element);
32407      if (element.hasTypeElement()) {
32408        composeEnumerationCore("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
32409        composeEnumerationExtras("type", element.getTypeElement(), new ChargeItemDefinition.ChargeItemDefinitionPriceComponentTypeEnumFactory(), false);
32410      }
32411      if (element.hasCode()) {
32412        composeCodeableConcept("code", element.getCode());
32413      }
32414      if (element.hasFactorElement()) {
32415        composeDecimalCore("factor", element.getFactorElement(), false);
32416        composeDecimalExtras("factor", element.getFactorElement(), false);
32417      }
32418      if (element.hasAmount()) {
32419        composeMoney("amount", element.getAmount());
32420      }
32421  }
32422
32423  protected void composeClaim(String name, Claim element) throws IOException {
32424    if (element != null) {
32425      prop("resourceType", name);
32426      composeClaimInner(element);
32427    }
32428  }
32429
32430  protected void composeClaimInner(Claim element) throws IOException {
32431      composeDomainResourceElements(element);
32432      if (element.hasIdentifier()) {
32433        openArray("identifier");
32434        for (Identifier e : element.getIdentifier()) 
32435          composeIdentifier(null, e);
32436        closeArray();
32437      };
32438      if (element.hasStatusElement()) {
32439        composeEnumerationCore("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
32440        composeEnumerationExtras("status", element.getStatusElement(), new Claim.ClaimStatusEnumFactory(), false);
32441      }
32442      if (element.hasType()) {
32443        composeCodeableConcept("type", element.getType());
32444      }
32445      if (element.hasSubType()) {
32446        composeCodeableConcept("subType", element.getSubType());
32447      }
32448      if (element.hasUseElement()) {
32449        composeEnumerationCore("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
32450        composeEnumerationExtras("use", element.getUseElement(), new Claim.UseEnumFactory(), false);
32451      }
32452      if (element.hasPatient()) {
32453        composeReference("patient", element.getPatient());
32454      }
32455      if (element.hasBillablePeriod()) {
32456        composePeriod("billablePeriod", element.getBillablePeriod());
32457      }
32458      if (element.hasCreatedElement()) {
32459        composeDateTimeCore("created", element.getCreatedElement(), false);
32460        composeDateTimeExtras("created", element.getCreatedElement(), false);
32461      }
32462      if (element.hasEnterer()) {
32463        composeReference("enterer", element.getEnterer());
32464      }
32465      if (element.hasInsurer()) {
32466        composeReference("insurer", element.getInsurer());
32467      }
32468      if (element.hasProvider()) {
32469        composeReference("provider", element.getProvider());
32470      }
32471      if (element.hasPriority()) {
32472        composeCodeableConcept("priority", element.getPriority());
32473      }
32474      if (element.hasFundsReserve()) {
32475        composeCodeableConcept("fundsReserve", element.getFundsReserve());
32476      }
32477      if (element.hasRelated()) {
32478        openArray("related");
32479        for (Claim.RelatedClaimComponent e : element.getRelated()) 
32480          composeClaimRelatedClaimComponent(null, e);
32481        closeArray();
32482      };
32483      if (element.hasPrescription()) {
32484        composeReference("prescription", element.getPrescription());
32485      }
32486      if (element.hasOriginalPrescription()) {
32487        composeReference("originalPrescription", element.getOriginalPrescription());
32488      }
32489      if (element.hasPayee()) {
32490        composeClaimPayeeComponent("payee", element.getPayee());
32491      }
32492      if (element.hasReferral()) {
32493        composeReference("referral", element.getReferral());
32494      }
32495      if (element.hasFacility()) {
32496        composeReference("facility", element.getFacility());
32497      }
32498      if (element.hasCareTeam()) {
32499        openArray("careTeam");
32500        for (Claim.CareTeamComponent e : element.getCareTeam()) 
32501          composeClaimCareTeamComponent(null, e);
32502        closeArray();
32503      };
32504      if (element.hasInformation()) {
32505        openArray("information");
32506        for (Claim.SpecialConditionComponent e : element.getInformation()) 
32507          composeClaimSpecialConditionComponent(null, e);
32508        closeArray();
32509      };
32510      if (element.hasDiagnosis()) {
32511        openArray("diagnosis");
32512        for (Claim.DiagnosisComponent e : element.getDiagnosis()) 
32513          composeClaimDiagnosisComponent(null, e);
32514        closeArray();
32515      };
32516      if (element.hasProcedure()) {
32517        openArray("procedure");
32518        for (Claim.ProcedureComponent e : element.getProcedure()) 
32519          composeClaimProcedureComponent(null, e);
32520        closeArray();
32521      };
32522      if (element.hasInsurance()) {
32523        openArray("insurance");
32524        for (Claim.InsuranceComponent e : element.getInsurance()) 
32525          composeClaimInsuranceComponent(null, e);
32526        closeArray();
32527      };
32528      if (element.hasAccident()) {
32529        composeClaimAccidentComponent("accident", element.getAccident());
32530      }
32531      if (element.hasItem()) {
32532        openArray("item");
32533        for (Claim.ItemComponent e : element.getItem()) 
32534          composeClaimItemComponent(null, e);
32535        closeArray();
32536      };
32537      if (element.hasTotal()) {
32538        composeMoney("total", element.getTotal());
32539      }
32540  }
32541
32542  protected void composeClaimRelatedClaimComponent(String name, Claim.RelatedClaimComponent element) throws IOException {
32543    if (element != null) {
32544      open(name);
32545      composeClaimRelatedClaimComponentInner(element);
32546      close();
32547    }
32548  }
32549
32550  protected void composeClaimRelatedClaimComponentInner(Claim.RelatedClaimComponent element) throws IOException {
32551      composeBackbone(element);
32552      if (element.hasClaim()) {
32553        composeReference("claim", element.getClaim());
32554      }
32555      if (element.hasRelationship()) {
32556        composeCodeableConcept("relationship", element.getRelationship());
32557      }
32558      if (element.hasReference()) {
32559        composeIdentifier("reference", element.getReference());
32560      }
32561  }
32562
32563  protected void composeClaimPayeeComponent(String name, Claim.PayeeComponent element) throws IOException {
32564    if (element != null) {
32565      open(name);
32566      composeClaimPayeeComponentInner(element);
32567      close();
32568    }
32569  }
32570
32571  protected void composeClaimPayeeComponentInner(Claim.PayeeComponent element) throws IOException {
32572      composeBackbone(element);
32573      if (element.hasType()) {
32574        composeCodeableConcept("type", element.getType());
32575      }
32576      if (element.hasResource()) {
32577        composeCoding("resource", element.getResource());
32578      }
32579      if (element.hasParty()) {
32580        composeReference("party", element.getParty());
32581      }
32582  }
32583
32584  protected void composeClaimCareTeamComponent(String name, Claim.CareTeamComponent element) throws IOException {
32585    if (element != null) {
32586      open(name);
32587      composeClaimCareTeamComponentInner(element);
32588      close();
32589    }
32590  }
32591
32592  protected void composeClaimCareTeamComponentInner(Claim.CareTeamComponent element) throws IOException {
32593      composeBackbone(element);
32594      if (element.hasSequenceElement()) {
32595        composePositiveIntCore("sequence", element.getSequenceElement(), false);
32596        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
32597      }
32598      if (element.hasProvider()) {
32599        composeReference("provider", element.getProvider());
32600      }
32601      if (element.hasResponsibleElement()) {
32602        composeBooleanCore("responsible", element.getResponsibleElement(), false);
32603        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
32604      }
32605      if (element.hasRole()) {
32606        composeCodeableConcept("role", element.getRole());
32607      }
32608      if (element.hasQualification()) {
32609        composeCodeableConcept("qualification", element.getQualification());
32610      }
32611  }
32612
32613  protected void composeClaimSpecialConditionComponent(String name, Claim.SpecialConditionComponent element) throws IOException {
32614    if (element != null) {
32615      open(name);
32616      composeClaimSpecialConditionComponentInner(element);
32617      close();
32618    }
32619  }
32620
32621  protected void composeClaimSpecialConditionComponentInner(Claim.SpecialConditionComponent element) throws IOException {
32622      composeBackbone(element);
32623      if (element.hasSequenceElement()) {
32624        composePositiveIntCore("sequence", element.getSequenceElement(), false);
32625        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
32626      }
32627      if (element.hasCategory()) {
32628        composeCodeableConcept("category", element.getCategory());
32629      }
32630      if (element.hasCode()) {
32631        composeCodeableConcept("code", element.getCode());
32632      }
32633      if (element.hasTiming()) {
32634        composeType("timing", element.getTiming());
32635      }
32636      if (element.hasValue()) {
32637        composeType("value", element.getValue());
32638      }
32639      if (element.hasReason()) {
32640        composeCodeableConcept("reason", element.getReason());
32641      }
32642  }
32643
32644  protected void composeClaimDiagnosisComponent(String name, Claim.DiagnosisComponent element) throws IOException {
32645    if (element != null) {
32646      open(name);
32647      composeClaimDiagnosisComponentInner(element);
32648      close();
32649    }
32650  }
32651
32652  protected void composeClaimDiagnosisComponentInner(Claim.DiagnosisComponent element) throws IOException {
32653      composeBackbone(element);
32654      if (element.hasSequenceElement()) {
32655        composePositiveIntCore("sequence", element.getSequenceElement(), false);
32656        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
32657      }
32658      if (element.hasDiagnosis()) {
32659        composeType("diagnosis", element.getDiagnosis());
32660      }
32661      if (element.hasType()) {
32662        openArray("type");
32663        for (CodeableConcept e : element.getType()) 
32664          composeCodeableConcept(null, e);
32665        closeArray();
32666      };
32667      if (element.hasOnAdmission()) {
32668        composeCodeableConcept("onAdmission", element.getOnAdmission());
32669      }
32670      if (element.hasPackageCode()) {
32671        composeCodeableConcept("packageCode", element.getPackageCode());
32672      }
32673  }
32674
32675  protected void composeClaimProcedureComponent(String name, Claim.ProcedureComponent element) throws IOException {
32676    if (element != null) {
32677      open(name);
32678      composeClaimProcedureComponentInner(element);
32679      close();
32680    }
32681  }
32682
32683  protected void composeClaimProcedureComponentInner(Claim.ProcedureComponent element) throws IOException {
32684      composeBackbone(element);
32685      if (element.hasSequenceElement()) {
32686        composePositiveIntCore("sequence", element.getSequenceElement(), false);
32687        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
32688      }
32689      if (element.hasDateElement()) {
32690        composeDateTimeCore("date", element.getDateElement(), false);
32691        composeDateTimeExtras("date", element.getDateElement(), false);
32692      }
32693      if (element.hasProcedure()) {
32694        composeType("procedure", element.getProcedure());
32695      }
32696  }
32697
32698  protected void composeClaimInsuranceComponent(String name, Claim.InsuranceComponent element) throws IOException {
32699    if (element != null) {
32700      open(name);
32701      composeClaimInsuranceComponentInner(element);
32702      close();
32703    }
32704  }
32705
32706  protected void composeClaimInsuranceComponentInner(Claim.InsuranceComponent element) throws IOException {
32707      composeBackbone(element);
32708      if (element.hasSequenceElement()) {
32709        composePositiveIntCore("sequence", element.getSequenceElement(), false);
32710        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
32711      }
32712      if (element.hasFocalElement()) {
32713        composeBooleanCore("focal", element.getFocalElement(), false);
32714        composeBooleanExtras("focal", element.getFocalElement(), false);
32715      }
32716      if (element.hasIdentifier()) {
32717        composeIdentifier("identifier", element.getIdentifier());
32718      }
32719      if (element.hasCoverage()) {
32720        composeReference("coverage", element.getCoverage());
32721      }
32722      if (element.hasBusinessArrangementElement()) {
32723        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
32724        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
32725      }
32726      if (element.hasPreAuthRef()) {
32727        openArray("preAuthRef");
32728        for (StringType e : element.getPreAuthRef()) 
32729          composeStringCore(null, e, true);
32730        closeArray();
32731        if (anyHasExtras(element.getPreAuthRef())) {
32732          openArray("_preAuthRef");
32733          for (StringType e : element.getPreAuthRef()) 
32734            composeStringExtras(null, e, true);
32735          closeArray();
32736        }
32737      };
32738      if (element.hasClaimResponse()) {
32739        composeReference("claimResponse", element.getClaimResponse());
32740      }
32741  }
32742
32743  protected void composeClaimAccidentComponent(String name, Claim.AccidentComponent element) throws IOException {
32744    if (element != null) {
32745      open(name);
32746      composeClaimAccidentComponentInner(element);
32747      close();
32748    }
32749  }
32750
32751  protected void composeClaimAccidentComponentInner(Claim.AccidentComponent element) throws IOException {
32752      composeBackbone(element);
32753      if (element.hasDateElement()) {
32754        composeDateCore("date", element.getDateElement(), false);
32755        composeDateExtras("date", element.getDateElement(), false);
32756      }
32757      if (element.hasType()) {
32758        composeCodeableConcept("type", element.getType());
32759      }
32760      if (element.hasLocation()) {
32761        composeType("location", element.getLocation());
32762      }
32763  }
32764
32765  protected void composeClaimItemComponent(String name, Claim.ItemComponent element) throws IOException {
32766    if (element != null) {
32767      open(name);
32768      composeClaimItemComponentInner(element);
32769      close();
32770    }
32771  }
32772
32773  protected void composeClaimItemComponentInner(Claim.ItemComponent element) throws IOException {
32774      composeBackbone(element);
32775      if (element.hasSequenceElement()) {
32776        composePositiveIntCore("sequence", element.getSequenceElement(), false);
32777        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
32778      }
32779      if (element.hasCareTeamSequence()) {
32780        openArray("careTeamSequence");
32781        for (PositiveIntType e : element.getCareTeamSequence()) 
32782          composePositiveIntCore(null, e, true);
32783        closeArray();
32784        if (anyHasExtras(element.getCareTeamSequence())) {
32785          openArray("_careTeamSequence");
32786          for (PositiveIntType e : element.getCareTeamSequence()) 
32787            composePositiveIntExtras(null, e, true);
32788          closeArray();
32789        }
32790      };
32791      if (element.hasDiagnosisSequence()) {
32792        openArray("diagnosisSequence");
32793        for (PositiveIntType e : element.getDiagnosisSequence()) 
32794          composePositiveIntCore(null, e, true);
32795        closeArray();
32796        if (anyHasExtras(element.getDiagnosisSequence())) {
32797          openArray("_diagnosisSequence");
32798          for (PositiveIntType e : element.getDiagnosisSequence()) 
32799            composePositiveIntExtras(null, e, true);
32800          closeArray();
32801        }
32802      };
32803      if (element.hasProcedureSequence()) {
32804        openArray("procedureSequence");
32805        for (PositiveIntType e : element.getProcedureSequence()) 
32806          composePositiveIntCore(null, e, true);
32807        closeArray();
32808        if (anyHasExtras(element.getProcedureSequence())) {
32809          openArray("_procedureSequence");
32810          for (PositiveIntType e : element.getProcedureSequence()) 
32811            composePositiveIntExtras(null, e, true);
32812          closeArray();
32813        }
32814      };
32815      if (element.hasInformationSequence()) {
32816        openArray("informationSequence");
32817        for (PositiveIntType e : element.getInformationSequence()) 
32818          composePositiveIntCore(null, e, true);
32819        closeArray();
32820        if (anyHasExtras(element.getInformationSequence())) {
32821          openArray("_informationSequence");
32822          for (PositiveIntType e : element.getInformationSequence()) 
32823            composePositiveIntExtras(null, e, true);
32824          closeArray();
32825        }
32826      };
32827      if (element.hasRevenue()) {
32828        composeCodeableConcept("revenue", element.getRevenue());
32829      }
32830      if (element.hasCategory()) {
32831        composeCodeableConcept("category", element.getCategory());
32832      }
32833      if (element.hasBillcode()) {
32834        composeCodeableConcept("billcode", element.getBillcode());
32835      }
32836      if (element.hasModifier()) {
32837        openArray("modifier");
32838        for (CodeableConcept e : element.getModifier()) 
32839          composeCodeableConcept(null, e);
32840        closeArray();
32841      };
32842      if (element.hasProgramCode()) {
32843        openArray("programCode");
32844        for (CodeableConcept e : element.getProgramCode()) 
32845          composeCodeableConcept(null, e);
32846        closeArray();
32847      };
32848      if (element.hasServiced()) {
32849        composeType("serviced", element.getServiced());
32850      }
32851      if (element.hasLocation()) {
32852        composeType("location", element.getLocation());
32853      }
32854      if (element.hasQuantity()) {
32855        composeQuantity("quantity", element.getQuantity());
32856      }
32857      if (element.hasUnitPrice()) {
32858        composeMoney("unitPrice", element.getUnitPrice());
32859      }
32860      if (element.hasFactorElement()) {
32861        composeDecimalCore("factor", element.getFactorElement(), false);
32862        composeDecimalExtras("factor", element.getFactorElement(), false);
32863      }
32864      if (element.hasNet()) {
32865        composeMoney("net", element.getNet());
32866      }
32867      if (element.hasUdi()) {
32868        openArray("udi");
32869        for (Reference e : element.getUdi()) 
32870          composeReference(null, e);
32871        closeArray();
32872      };
32873      if (element.hasBodySite()) {
32874        composeCodeableConcept("bodySite", element.getBodySite());
32875      }
32876      if (element.hasSubSite()) {
32877        openArray("subSite");
32878        for (CodeableConcept e : element.getSubSite()) 
32879          composeCodeableConcept(null, e);
32880        closeArray();
32881      };
32882      if (element.hasEncounter()) {
32883        openArray("encounter");
32884        for (Reference e : element.getEncounter()) 
32885          composeReference(null, e);
32886        closeArray();
32887      };
32888      if (element.hasDetail()) {
32889        openArray("detail");
32890        for (Claim.DetailComponent e : element.getDetail()) 
32891          composeClaimDetailComponent(null, e);
32892        closeArray();
32893      };
32894  }
32895
32896  protected void composeClaimDetailComponent(String name, Claim.DetailComponent element) throws IOException {
32897    if (element != null) {
32898      open(name);
32899      composeClaimDetailComponentInner(element);
32900      close();
32901    }
32902  }
32903
32904  protected void composeClaimDetailComponentInner(Claim.DetailComponent element) throws IOException {
32905      composeBackbone(element);
32906      if (element.hasSequenceElement()) {
32907        composePositiveIntCore("sequence", element.getSequenceElement(), false);
32908        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
32909      }
32910      if (element.hasRevenue()) {
32911        composeCodeableConcept("revenue", element.getRevenue());
32912      }
32913      if (element.hasCategory()) {
32914        composeCodeableConcept("category", element.getCategory());
32915      }
32916      if (element.hasBillcode()) {
32917        composeCodeableConcept("billcode", element.getBillcode());
32918      }
32919      if (element.hasModifier()) {
32920        openArray("modifier");
32921        for (CodeableConcept e : element.getModifier()) 
32922          composeCodeableConcept(null, e);
32923        closeArray();
32924      };
32925      if (element.hasProgramCode()) {
32926        openArray("programCode");
32927        for (CodeableConcept e : element.getProgramCode()) 
32928          composeCodeableConcept(null, e);
32929        closeArray();
32930      };
32931      if (element.hasQuantity()) {
32932        composeQuantity("quantity", element.getQuantity());
32933      }
32934      if (element.hasUnitPrice()) {
32935        composeMoney("unitPrice", element.getUnitPrice());
32936      }
32937      if (element.hasFactorElement()) {
32938        composeDecimalCore("factor", element.getFactorElement(), false);
32939        composeDecimalExtras("factor", element.getFactorElement(), false);
32940      }
32941      if (element.hasNet()) {
32942        composeMoney("net", element.getNet());
32943      }
32944      if (element.hasUdi()) {
32945        openArray("udi");
32946        for (Reference e : element.getUdi()) 
32947          composeReference(null, e);
32948        closeArray();
32949      };
32950      if (element.hasSubDetail()) {
32951        openArray("subDetail");
32952        for (Claim.SubDetailComponent e : element.getSubDetail()) 
32953          composeClaimSubDetailComponent(null, e);
32954        closeArray();
32955      };
32956  }
32957
32958  protected void composeClaimSubDetailComponent(String name, Claim.SubDetailComponent element) throws IOException {
32959    if (element != null) {
32960      open(name);
32961      composeClaimSubDetailComponentInner(element);
32962      close();
32963    }
32964  }
32965
32966  protected void composeClaimSubDetailComponentInner(Claim.SubDetailComponent element) throws IOException {
32967      composeBackbone(element);
32968      if (element.hasSequenceElement()) {
32969        composePositiveIntCore("sequence", element.getSequenceElement(), false);
32970        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
32971      }
32972      if (element.hasRevenue()) {
32973        composeCodeableConcept("revenue", element.getRevenue());
32974      }
32975      if (element.hasCategory()) {
32976        composeCodeableConcept("category", element.getCategory());
32977      }
32978      if (element.hasBillcode()) {
32979        composeCodeableConcept("billcode", element.getBillcode());
32980      }
32981      if (element.hasModifier()) {
32982        openArray("modifier");
32983        for (CodeableConcept e : element.getModifier()) 
32984          composeCodeableConcept(null, e);
32985        closeArray();
32986      };
32987      if (element.hasProgramCode()) {
32988        openArray("programCode");
32989        for (CodeableConcept e : element.getProgramCode()) 
32990          composeCodeableConcept(null, e);
32991        closeArray();
32992      };
32993      if (element.hasQuantity()) {
32994        composeQuantity("quantity", element.getQuantity());
32995      }
32996      if (element.hasUnitPrice()) {
32997        composeMoney("unitPrice", element.getUnitPrice());
32998      }
32999      if (element.hasFactorElement()) {
33000        composeDecimalCore("factor", element.getFactorElement(), false);
33001        composeDecimalExtras("factor", element.getFactorElement(), false);
33002      }
33003      if (element.hasNet()) {
33004        composeMoney("net", element.getNet());
33005      }
33006      if (element.hasUdi()) {
33007        openArray("udi");
33008        for (Reference e : element.getUdi()) 
33009          composeReference(null, e);
33010        closeArray();
33011      };
33012  }
33013
33014  protected void composeClaimResponse(String name, ClaimResponse element) throws IOException {
33015    if (element != null) {
33016      prop("resourceType", name);
33017      composeClaimResponseInner(element);
33018    }
33019  }
33020
33021  protected void composeClaimResponseInner(ClaimResponse element) throws IOException {
33022      composeDomainResourceElements(element);
33023      if (element.hasIdentifier()) {
33024        openArray("identifier");
33025        for (Identifier e : element.getIdentifier()) 
33026          composeIdentifier(null, e);
33027        closeArray();
33028      };
33029      if (element.hasStatusElement()) {
33030        composeEnumerationCore("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
33031        composeEnumerationExtras("status", element.getStatusElement(), new ClaimResponse.ClaimResponseStatusEnumFactory(), false);
33032      }
33033      if (element.hasType()) {
33034        composeCodeableConcept("type", element.getType());
33035      }
33036      if (element.hasSubType()) {
33037        composeCodeableConcept("subType", element.getSubType());
33038      }
33039      if (element.hasUseElement()) {
33040        composeEnumerationCore("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
33041        composeEnumerationExtras("use", element.getUseElement(), new ClaimResponse.UseEnumFactory(), false);
33042      }
33043      if (element.hasPatient()) {
33044        composeReference("patient", element.getPatient());
33045      }
33046      if (element.hasCreatedElement()) {
33047        composeDateTimeCore("created", element.getCreatedElement(), false);
33048        composeDateTimeExtras("created", element.getCreatedElement(), false);
33049      }
33050      if (element.hasInsurer()) {
33051        composeReference("insurer", element.getInsurer());
33052      }
33053      if (element.hasRequestProvider()) {
33054        composeReference("requestProvider", element.getRequestProvider());
33055      }
33056      if (element.hasRequest()) {
33057        composeReference("request", element.getRequest());
33058      }
33059      if (element.hasOutcomeElement()) {
33060        composeEnumerationCore("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
33061        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ClaimResponse.RemittanceOutcomeEnumFactory(), false);
33062      }
33063      if (element.hasDispositionElement()) {
33064        composeStringCore("disposition", element.getDispositionElement(), false);
33065        composeStringExtras("disposition", element.getDispositionElement(), false);
33066      }
33067      if (element.hasPreAuthRefElement()) {
33068        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
33069        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
33070      }
33071      if (element.hasPayeeType()) {
33072        composeCodeableConcept("payeeType", element.getPayeeType());
33073      }
33074      if (element.hasItem()) {
33075        openArray("item");
33076        for (ClaimResponse.ItemComponent e : element.getItem()) 
33077          composeClaimResponseItemComponent(null, e);
33078        closeArray();
33079      };
33080      if (element.hasAddItem()) {
33081        openArray("addItem");
33082        for (ClaimResponse.AddedItemComponent e : element.getAddItem()) 
33083          composeClaimResponseAddedItemComponent(null, e);
33084        closeArray();
33085      };
33086      if (element.hasError()) {
33087        openArray("error");
33088        for (ClaimResponse.ErrorComponent e : element.getError()) 
33089          composeClaimResponseErrorComponent(null, e);
33090        closeArray();
33091      };
33092      if (element.hasTotal()) {
33093        openArray("total");
33094        for (ClaimResponse.TotalComponent e : element.getTotal()) 
33095          composeClaimResponseTotalComponent(null, e);
33096        closeArray();
33097      };
33098      if (element.hasPayment()) {
33099        composeClaimResponsePaymentComponent("payment", element.getPayment());
33100      }
33101      if (element.hasReserved()) {
33102        composeCoding("reserved", element.getReserved());
33103      }
33104      if (element.hasForm()) {
33105        composeCodeableConcept("form", element.getForm());
33106      }
33107      if (element.hasProcessNote()) {
33108        openArray("processNote");
33109        for (ClaimResponse.NoteComponent e : element.getProcessNote()) 
33110          composeClaimResponseNoteComponent(null, e);
33111        closeArray();
33112      };
33113      if (element.hasCommunicationRequest()) {
33114        openArray("communicationRequest");
33115        for (Reference e : element.getCommunicationRequest()) 
33116          composeReference(null, e);
33117        closeArray();
33118      };
33119      if (element.hasInsurance()) {
33120        openArray("insurance");
33121        for (ClaimResponse.InsuranceComponent e : element.getInsurance()) 
33122          composeClaimResponseInsuranceComponent(null, e);
33123        closeArray();
33124      };
33125  }
33126
33127  protected void composeClaimResponseItemComponent(String name, ClaimResponse.ItemComponent element) throws IOException {
33128    if (element != null) {
33129      open(name);
33130      composeClaimResponseItemComponentInner(element);
33131      close();
33132    }
33133  }
33134
33135  protected void composeClaimResponseItemComponentInner(ClaimResponse.ItemComponent element) throws IOException {
33136      composeBackbone(element);
33137      if (element.hasItemSequenceElement()) {
33138        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
33139        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
33140      }
33141      if (element.hasNoteNumber()) {
33142        openArray("noteNumber");
33143        for (PositiveIntType e : element.getNoteNumber()) 
33144          composePositiveIntCore(null, e, true);
33145        closeArray();
33146        if (anyHasExtras(element.getNoteNumber())) {
33147          openArray("_noteNumber");
33148          for (PositiveIntType e : element.getNoteNumber()) 
33149            composePositiveIntExtras(null, e, true);
33150          closeArray();
33151        }
33152      };
33153      if (element.hasAdjudication()) {
33154        openArray("adjudication");
33155        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
33156          composeClaimResponseAdjudicationComponent(null, e);
33157        closeArray();
33158      };
33159      if (element.hasDetail()) {
33160        openArray("detail");
33161        for (ClaimResponse.ItemDetailComponent e : element.getDetail()) 
33162          composeClaimResponseItemDetailComponent(null, e);
33163        closeArray();
33164      };
33165  }
33166
33167  protected void composeClaimResponseAdjudicationComponent(String name, ClaimResponse.AdjudicationComponent element) throws IOException {
33168    if (element != null) {
33169      open(name);
33170      composeClaimResponseAdjudicationComponentInner(element);
33171      close();
33172    }
33173  }
33174
33175  protected void composeClaimResponseAdjudicationComponentInner(ClaimResponse.AdjudicationComponent element) throws IOException {
33176      composeBackbone(element);
33177      if (element.hasCategory()) {
33178        composeCodeableConcept("category", element.getCategory());
33179      }
33180      if (element.hasReason()) {
33181        composeCodeableConcept("reason", element.getReason());
33182      }
33183      if (element.hasAmount()) {
33184        composeMoney("amount", element.getAmount());
33185      }
33186      if (element.hasValueElement()) {
33187        composeDecimalCore("value", element.getValueElement(), false);
33188        composeDecimalExtras("value", element.getValueElement(), false);
33189      }
33190  }
33191
33192  protected void composeClaimResponseItemDetailComponent(String name, ClaimResponse.ItemDetailComponent element) throws IOException {
33193    if (element != null) {
33194      open(name);
33195      composeClaimResponseItemDetailComponentInner(element);
33196      close();
33197    }
33198  }
33199
33200  protected void composeClaimResponseItemDetailComponentInner(ClaimResponse.ItemDetailComponent element) throws IOException {
33201      composeBackbone(element);
33202      if (element.hasDetailSequenceElement()) {
33203        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
33204        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
33205      }
33206      if (element.hasNoteNumber()) {
33207        openArray("noteNumber");
33208        for (PositiveIntType e : element.getNoteNumber()) 
33209          composePositiveIntCore(null, e, true);
33210        closeArray();
33211        if (anyHasExtras(element.getNoteNumber())) {
33212          openArray("_noteNumber");
33213          for (PositiveIntType e : element.getNoteNumber()) 
33214            composePositiveIntExtras(null, e, true);
33215          closeArray();
33216        }
33217      };
33218      if (element.hasAdjudication()) {
33219        openArray("adjudication");
33220        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
33221          composeClaimResponseAdjudicationComponent(null, e);
33222        closeArray();
33223      };
33224      if (element.hasSubDetail()) {
33225        openArray("subDetail");
33226        for (ClaimResponse.SubDetailComponent e : element.getSubDetail()) 
33227          composeClaimResponseSubDetailComponent(null, e);
33228        closeArray();
33229      };
33230  }
33231
33232  protected void composeClaimResponseSubDetailComponent(String name, ClaimResponse.SubDetailComponent element) throws IOException {
33233    if (element != null) {
33234      open(name);
33235      composeClaimResponseSubDetailComponentInner(element);
33236      close();
33237    }
33238  }
33239
33240  protected void composeClaimResponseSubDetailComponentInner(ClaimResponse.SubDetailComponent element) throws IOException {
33241      composeBackbone(element);
33242      if (element.hasSubDetailSequenceElement()) {
33243        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
33244        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
33245      }
33246      if (element.hasNoteNumber()) {
33247        openArray("noteNumber");
33248        for (PositiveIntType e : element.getNoteNumber()) 
33249          composePositiveIntCore(null, e, true);
33250        closeArray();
33251        if (anyHasExtras(element.getNoteNumber())) {
33252          openArray("_noteNumber");
33253          for (PositiveIntType e : element.getNoteNumber()) 
33254            composePositiveIntExtras(null, e, true);
33255          closeArray();
33256        }
33257      };
33258      if (element.hasAdjudication()) {
33259        openArray("adjudication");
33260        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
33261          composeClaimResponseAdjudicationComponent(null, e);
33262        closeArray();
33263      };
33264  }
33265
33266  protected void composeClaimResponseAddedItemComponent(String name, ClaimResponse.AddedItemComponent element) throws IOException {
33267    if (element != null) {
33268      open(name);
33269      composeClaimResponseAddedItemComponentInner(element);
33270      close();
33271    }
33272  }
33273
33274  protected void composeClaimResponseAddedItemComponentInner(ClaimResponse.AddedItemComponent element) throws IOException {
33275      composeBackbone(element);
33276      if (element.hasItemSequence()) {
33277        openArray("itemSequence");
33278        for (PositiveIntType e : element.getItemSequence()) 
33279          composePositiveIntCore(null, e, true);
33280        closeArray();
33281        if (anyHasExtras(element.getItemSequence())) {
33282          openArray("_itemSequence");
33283          for (PositiveIntType e : element.getItemSequence()) 
33284            composePositiveIntExtras(null, e, true);
33285          closeArray();
33286        }
33287      };
33288      if (element.hasDetailSequence()) {
33289        openArray("detailSequence");
33290        for (PositiveIntType e : element.getDetailSequence()) 
33291          composePositiveIntCore(null, e, true);
33292        closeArray();
33293        if (anyHasExtras(element.getDetailSequence())) {
33294          openArray("_detailSequence");
33295          for (PositiveIntType e : element.getDetailSequence()) 
33296            composePositiveIntExtras(null, e, true);
33297          closeArray();
33298        }
33299      };
33300      if (element.hasSubdetailSequence()) {
33301        openArray("subdetailSequence");
33302        for (PositiveIntType e : element.getSubdetailSequence()) 
33303          composePositiveIntCore(null, e, true);
33304        closeArray();
33305        if (anyHasExtras(element.getSubdetailSequence())) {
33306          openArray("_subdetailSequence");
33307          for (PositiveIntType e : element.getSubdetailSequence()) 
33308            composePositiveIntExtras(null, e, true);
33309          closeArray();
33310        }
33311      };
33312      if (element.hasProvider()) {
33313        openArray("provider");
33314        for (Reference e : element.getProvider()) 
33315          composeReference(null, e);
33316        closeArray();
33317      };
33318      if (element.hasBillcode()) {
33319        composeCodeableConcept("billcode", element.getBillcode());
33320      }
33321      if (element.hasModifier()) {
33322        openArray("modifier");
33323        for (CodeableConcept e : element.getModifier()) 
33324          composeCodeableConcept(null, e);
33325        closeArray();
33326      };
33327      if (element.hasProgramCode()) {
33328        openArray("programCode");
33329        for (CodeableConcept e : element.getProgramCode()) 
33330          composeCodeableConcept(null, e);
33331        closeArray();
33332      };
33333      if (element.hasServiced()) {
33334        composeType("serviced", element.getServiced());
33335      }
33336      if (element.hasLocation()) {
33337        composeType("location", element.getLocation());
33338      }
33339      if (element.hasQuantity()) {
33340        composeQuantity("quantity", element.getQuantity());
33341      }
33342      if (element.hasUnitPrice()) {
33343        composeMoney("unitPrice", element.getUnitPrice());
33344      }
33345      if (element.hasFactorElement()) {
33346        composeDecimalCore("factor", element.getFactorElement(), false);
33347        composeDecimalExtras("factor", element.getFactorElement(), false);
33348      }
33349      if (element.hasNet()) {
33350        composeMoney("net", element.getNet());
33351      }
33352      if (element.hasBodySite()) {
33353        composeCodeableConcept("bodySite", element.getBodySite());
33354      }
33355      if (element.hasSubSite()) {
33356        openArray("subSite");
33357        for (CodeableConcept e : element.getSubSite()) 
33358          composeCodeableConcept(null, e);
33359        closeArray();
33360      };
33361      if (element.hasNoteNumber()) {
33362        openArray("noteNumber");
33363        for (PositiveIntType e : element.getNoteNumber()) 
33364          composePositiveIntCore(null, e, true);
33365        closeArray();
33366        if (anyHasExtras(element.getNoteNumber())) {
33367          openArray("_noteNumber");
33368          for (PositiveIntType e : element.getNoteNumber()) 
33369            composePositiveIntExtras(null, e, true);
33370          closeArray();
33371        }
33372      };
33373      if (element.hasAdjudication()) {
33374        openArray("adjudication");
33375        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
33376          composeClaimResponseAdjudicationComponent(null, e);
33377        closeArray();
33378      };
33379      if (element.hasDetail()) {
33380        openArray("detail");
33381        for (ClaimResponse.AddedItemDetailComponent e : element.getDetail()) 
33382          composeClaimResponseAddedItemDetailComponent(null, e);
33383        closeArray();
33384      };
33385  }
33386
33387  protected void composeClaimResponseAddedItemDetailComponent(String name, ClaimResponse.AddedItemDetailComponent element) throws IOException {
33388    if (element != null) {
33389      open(name);
33390      composeClaimResponseAddedItemDetailComponentInner(element);
33391      close();
33392    }
33393  }
33394
33395  protected void composeClaimResponseAddedItemDetailComponentInner(ClaimResponse.AddedItemDetailComponent element) throws IOException {
33396      composeBackbone(element);
33397      if (element.hasBillcode()) {
33398        composeCodeableConcept("billcode", element.getBillcode());
33399      }
33400      if (element.hasModifier()) {
33401        openArray("modifier");
33402        for (CodeableConcept e : element.getModifier()) 
33403          composeCodeableConcept(null, e);
33404        closeArray();
33405      };
33406      if (element.hasQuantity()) {
33407        composeQuantity("quantity", element.getQuantity());
33408      }
33409      if (element.hasUnitPrice()) {
33410        composeMoney("unitPrice", element.getUnitPrice());
33411      }
33412      if (element.hasFactorElement()) {
33413        composeDecimalCore("factor", element.getFactorElement(), false);
33414        composeDecimalExtras("factor", element.getFactorElement(), false);
33415      }
33416      if (element.hasNet()) {
33417        composeMoney("net", element.getNet());
33418      }
33419      if (element.hasNoteNumber()) {
33420        openArray("noteNumber");
33421        for (PositiveIntType e : element.getNoteNumber()) 
33422          composePositiveIntCore(null, e, true);
33423        closeArray();
33424        if (anyHasExtras(element.getNoteNumber())) {
33425          openArray("_noteNumber");
33426          for (PositiveIntType e : element.getNoteNumber()) 
33427            composePositiveIntExtras(null, e, true);
33428          closeArray();
33429        }
33430      };
33431      if (element.hasAdjudication()) {
33432        openArray("adjudication");
33433        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
33434          composeClaimResponseAdjudicationComponent(null, e);
33435        closeArray();
33436      };
33437      if (element.hasSubDetail()) {
33438        openArray("subDetail");
33439        for (ClaimResponse.AddedItemSubDetailComponent e : element.getSubDetail()) 
33440          composeClaimResponseAddedItemSubDetailComponent(null, e);
33441        closeArray();
33442      };
33443  }
33444
33445  protected void composeClaimResponseAddedItemSubDetailComponent(String name, ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
33446    if (element != null) {
33447      open(name);
33448      composeClaimResponseAddedItemSubDetailComponentInner(element);
33449      close();
33450    }
33451  }
33452
33453  protected void composeClaimResponseAddedItemSubDetailComponentInner(ClaimResponse.AddedItemSubDetailComponent element) throws IOException {
33454      composeBackbone(element);
33455      if (element.hasBillcode()) {
33456        composeCodeableConcept("billcode", element.getBillcode());
33457      }
33458      if (element.hasModifier()) {
33459        openArray("modifier");
33460        for (CodeableConcept e : element.getModifier()) 
33461          composeCodeableConcept(null, e);
33462        closeArray();
33463      };
33464      if (element.hasQuantity()) {
33465        composeQuantity("quantity", element.getQuantity());
33466      }
33467      if (element.hasUnitPrice()) {
33468        composeMoney("unitPrice", element.getUnitPrice());
33469      }
33470      if (element.hasFactorElement()) {
33471        composeDecimalCore("factor", element.getFactorElement(), false);
33472        composeDecimalExtras("factor", element.getFactorElement(), false);
33473      }
33474      if (element.hasNet()) {
33475        composeMoney("net", element.getNet());
33476      }
33477      if (element.hasNoteNumber()) {
33478        openArray("noteNumber");
33479        for (PositiveIntType e : element.getNoteNumber()) 
33480          composePositiveIntCore(null, e, true);
33481        closeArray();
33482        if (anyHasExtras(element.getNoteNumber())) {
33483          openArray("_noteNumber");
33484          for (PositiveIntType e : element.getNoteNumber()) 
33485            composePositiveIntExtras(null, e, true);
33486          closeArray();
33487        }
33488      };
33489      if (element.hasAdjudication()) {
33490        openArray("adjudication");
33491        for (ClaimResponse.AdjudicationComponent e : element.getAdjudication()) 
33492          composeClaimResponseAdjudicationComponent(null, e);
33493        closeArray();
33494      };
33495  }
33496
33497  protected void composeClaimResponseErrorComponent(String name, ClaimResponse.ErrorComponent element) throws IOException {
33498    if (element != null) {
33499      open(name);
33500      composeClaimResponseErrorComponentInner(element);
33501      close();
33502    }
33503  }
33504
33505  protected void composeClaimResponseErrorComponentInner(ClaimResponse.ErrorComponent element) throws IOException {
33506      composeBackbone(element);
33507      if (element.hasItemSequenceElement()) {
33508        composePositiveIntCore("itemSequence", element.getItemSequenceElement(), false);
33509        composePositiveIntExtras("itemSequence", element.getItemSequenceElement(), false);
33510      }
33511      if (element.hasDetailSequenceElement()) {
33512        composePositiveIntCore("detailSequence", element.getDetailSequenceElement(), false);
33513        composePositiveIntExtras("detailSequence", element.getDetailSequenceElement(), false);
33514      }
33515      if (element.hasSubDetailSequenceElement()) {
33516        composePositiveIntCore("subDetailSequence", element.getSubDetailSequenceElement(), false);
33517        composePositiveIntExtras("subDetailSequence", element.getSubDetailSequenceElement(), false);
33518      }
33519      if (element.hasCode()) {
33520        composeCodeableConcept("code", element.getCode());
33521      }
33522  }
33523
33524  protected void composeClaimResponseTotalComponent(String name, ClaimResponse.TotalComponent element) throws IOException {
33525    if (element != null) {
33526      open(name);
33527      composeClaimResponseTotalComponentInner(element);
33528      close();
33529    }
33530  }
33531
33532  protected void composeClaimResponseTotalComponentInner(ClaimResponse.TotalComponent element) throws IOException {
33533      composeBackbone(element);
33534      if (element.hasCategory()) {
33535        composeCodeableConcept("category", element.getCategory());
33536      }
33537      if (element.hasAmount()) {
33538        composeMoney("amount", element.getAmount());
33539      }
33540  }
33541
33542  protected void composeClaimResponsePaymentComponent(String name, ClaimResponse.PaymentComponent element) throws IOException {
33543    if (element != null) {
33544      open(name);
33545      composeClaimResponsePaymentComponentInner(element);
33546      close();
33547    }
33548  }
33549
33550  protected void composeClaimResponsePaymentComponentInner(ClaimResponse.PaymentComponent element) throws IOException {
33551      composeBackbone(element);
33552      if (element.hasType()) {
33553        composeCodeableConcept("type", element.getType());
33554      }
33555      if (element.hasAdjustment()) {
33556        composeMoney("adjustment", element.getAdjustment());
33557      }
33558      if (element.hasAdjustmentReason()) {
33559        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
33560      }
33561      if (element.hasDateElement()) {
33562        composeDateCore("date", element.getDateElement(), false);
33563        composeDateExtras("date", element.getDateElement(), false);
33564      }
33565      if (element.hasAmount()) {
33566        composeMoney("amount", element.getAmount());
33567      }
33568      if (element.hasIdentifier()) {
33569        composeIdentifier("identifier", element.getIdentifier());
33570      }
33571  }
33572
33573  protected void composeClaimResponseNoteComponent(String name, ClaimResponse.NoteComponent element) throws IOException {
33574    if (element != null) {
33575      open(name);
33576      composeClaimResponseNoteComponentInner(element);
33577      close();
33578    }
33579  }
33580
33581  protected void composeClaimResponseNoteComponentInner(ClaimResponse.NoteComponent element) throws IOException {
33582      composeBackbone(element);
33583      if (element.hasNumberElement()) {
33584        composePositiveIntCore("number", element.getNumberElement(), false);
33585        composePositiveIntExtras("number", element.getNumberElement(), false);
33586      }
33587      if (element.hasTypeElement()) {
33588        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
33589        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
33590      }
33591      if (element.hasTextElement()) {
33592        composeStringCore("text", element.getTextElement(), false);
33593        composeStringExtras("text", element.getTextElement(), false);
33594      }
33595      if (element.hasLanguage()) {
33596        composeCodeableConcept("language", element.getLanguage());
33597      }
33598  }
33599
33600  protected void composeClaimResponseInsuranceComponent(String name, ClaimResponse.InsuranceComponent element) throws IOException {
33601    if (element != null) {
33602      open(name);
33603      composeClaimResponseInsuranceComponentInner(element);
33604      close();
33605    }
33606  }
33607
33608  protected void composeClaimResponseInsuranceComponentInner(ClaimResponse.InsuranceComponent element) throws IOException {
33609      composeBackbone(element);
33610      if (element.hasSequenceElement()) {
33611        composePositiveIntCore("sequence", element.getSequenceElement(), false);
33612        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
33613      }
33614      if (element.hasFocalElement()) {
33615        composeBooleanCore("focal", element.getFocalElement(), false);
33616        composeBooleanExtras("focal", element.getFocalElement(), false);
33617      }
33618      if (element.hasCoverage()) {
33619        composeReference("coverage", element.getCoverage());
33620      }
33621      if (element.hasBusinessArrangementElement()) {
33622        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
33623        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
33624      }
33625      if (element.hasClaimResponse()) {
33626        composeReference("claimResponse", element.getClaimResponse());
33627      }
33628  }
33629
33630  protected void composeClinicalImpression(String name, ClinicalImpression element) throws IOException {
33631    if (element != null) {
33632      prop("resourceType", name);
33633      composeClinicalImpressionInner(element);
33634    }
33635  }
33636
33637  protected void composeClinicalImpressionInner(ClinicalImpression element) throws IOException {
33638      composeDomainResourceElements(element);
33639      if (element.hasIdentifier()) {
33640        openArray("identifier");
33641        for (Identifier e : element.getIdentifier()) 
33642          composeIdentifier(null, e);
33643        closeArray();
33644      };
33645      if (element.hasStatusElement()) {
33646        composeEnumerationCore("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
33647        composeEnumerationExtras("status", element.getStatusElement(), new ClinicalImpression.ClinicalImpressionStatusEnumFactory(), false);
33648      }
33649      if (element.hasStatusReason()) {
33650        composeCodeableConcept("statusReason", element.getStatusReason());
33651      }
33652      if (element.hasCode()) {
33653        composeCodeableConcept("code", element.getCode());
33654      }
33655      if (element.hasDescriptionElement()) {
33656        composeStringCore("description", element.getDescriptionElement(), false);
33657        composeStringExtras("description", element.getDescriptionElement(), false);
33658      }
33659      if (element.hasSubject()) {
33660        composeReference("subject", element.getSubject());
33661      }
33662      if (element.hasContext()) {
33663        composeReference("context", element.getContext());
33664      }
33665      if (element.hasEffective()) {
33666        composeType("effective", element.getEffective());
33667      }
33668      if (element.hasDateElement()) {
33669        composeDateTimeCore("date", element.getDateElement(), false);
33670        composeDateTimeExtras("date", element.getDateElement(), false);
33671      }
33672      if (element.hasAssessor()) {
33673        composeReference("assessor", element.getAssessor());
33674      }
33675      if (element.hasPrevious()) {
33676        composeReference("previous", element.getPrevious());
33677      }
33678      if (element.hasProblem()) {
33679        openArray("problem");
33680        for (Reference e : element.getProblem()) 
33681          composeReference(null, e);
33682        closeArray();
33683      };
33684      if (element.hasInvestigation()) {
33685        openArray("investigation");
33686        for (ClinicalImpression.ClinicalImpressionInvestigationComponent e : element.getInvestigation()) 
33687          composeClinicalImpressionClinicalImpressionInvestigationComponent(null, e);
33688        closeArray();
33689      };
33690      if (element.hasProtocol()) {
33691        openArray("protocol");
33692        for (UriType e : element.getProtocol()) 
33693          composeUriCore(null, e, true);
33694        closeArray();
33695        if (anyHasExtras(element.getProtocol())) {
33696          openArray("_protocol");
33697          for (UriType e : element.getProtocol()) 
33698            composeUriExtras(null, e, true);
33699          closeArray();
33700        }
33701      };
33702      if (element.hasSummaryElement()) {
33703        composeStringCore("summary", element.getSummaryElement(), false);
33704        composeStringExtras("summary", element.getSummaryElement(), false);
33705      }
33706      if (element.hasFinding()) {
33707        openArray("finding");
33708        for (ClinicalImpression.ClinicalImpressionFindingComponent e : element.getFinding()) 
33709          composeClinicalImpressionClinicalImpressionFindingComponent(null, e);
33710        closeArray();
33711      };
33712      if (element.hasPrognosisCodeableConcept()) {
33713        openArray("prognosisCodeableConcept");
33714        for (CodeableConcept e : element.getPrognosisCodeableConcept()) 
33715          composeCodeableConcept(null, e);
33716        closeArray();
33717      };
33718      if (element.hasPrognosisReference()) {
33719        openArray("prognosisReference");
33720        for (Reference e : element.getPrognosisReference()) 
33721          composeReference(null, e);
33722        closeArray();
33723      };
33724      if (element.hasSupportingInfo()) {
33725        openArray("supportingInfo");
33726        for (Reference e : element.getSupportingInfo()) 
33727          composeReference(null, e);
33728        closeArray();
33729      };
33730      if (element.hasNote()) {
33731        openArray("note");
33732        for (Annotation e : element.getNote()) 
33733          composeAnnotation(null, e);
33734        closeArray();
33735      };
33736  }
33737
33738  protected void composeClinicalImpressionClinicalImpressionInvestigationComponent(String name, ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
33739    if (element != null) {
33740      open(name);
33741      composeClinicalImpressionClinicalImpressionInvestigationComponentInner(element);
33742      close();
33743    }
33744  }
33745
33746  protected void composeClinicalImpressionClinicalImpressionInvestigationComponentInner(ClinicalImpression.ClinicalImpressionInvestigationComponent element) throws IOException {
33747      composeBackbone(element);
33748      if (element.hasCode()) {
33749        composeCodeableConcept("code", element.getCode());
33750      }
33751      if (element.hasItem()) {
33752        openArray("item");
33753        for (Reference e : element.getItem()) 
33754          composeReference(null, e);
33755        closeArray();
33756      };
33757  }
33758
33759  protected void composeClinicalImpressionClinicalImpressionFindingComponent(String name, ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
33760    if (element != null) {
33761      open(name);
33762      composeClinicalImpressionClinicalImpressionFindingComponentInner(element);
33763      close();
33764    }
33765  }
33766
33767  protected void composeClinicalImpressionClinicalImpressionFindingComponentInner(ClinicalImpression.ClinicalImpressionFindingComponent element) throws IOException {
33768      composeBackbone(element);
33769      if (element.hasItemCodeableConcept()) {
33770        composeCodeableConcept("itemCodeableConcept", element.getItemCodeableConcept());
33771      }
33772      if (element.hasItemReference()) {
33773        composeReference("itemReference", element.getItemReference());
33774      }
33775      if (element.hasBasisElement()) {
33776        composeStringCore("basis", element.getBasisElement(), false);
33777        composeStringExtras("basis", element.getBasisElement(), false);
33778      }
33779  }
33780
33781  protected void composeCodeSystem(String name, CodeSystem element) throws IOException {
33782    if (element != null) {
33783      prop("resourceType", name);
33784      composeCodeSystemInner(element);
33785    }
33786  }
33787
33788  protected void composeCodeSystemInner(CodeSystem element) throws IOException {
33789      composeDomainResourceElements(element);
33790      if (element.hasUrlElement()) {
33791        composeUriCore("url", element.getUrlElement(), false);
33792        composeUriExtras("url", element.getUrlElement(), false);
33793      }
33794      if (element.hasIdentifier()) {
33795        openArray("identifier");
33796        for (Identifier e : element.getIdentifier()) 
33797          composeIdentifier(null, e);
33798        closeArray();
33799      };
33800      if (element.hasVersionElement()) {
33801        composeStringCore("version", element.getVersionElement(), false);
33802        composeStringExtras("version", element.getVersionElement(), false);
33803      }
33804      if (element.hasNameElement()) {
33805        composeStringCore("name", element.getNameElement(), false);
33806        composeStringExtras("name", element.getNameElement(), false);
33807      }
33808      if (element.hasTitleElement()) {
33809        composeStringCore("title", element.getTitleElement(), false);
33810        composeStringExtras("title", element.getTitleElement(), false);
33811      }
33812      if (element.hasStatusElement()) {
33813        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33814        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
33815      }
33816      if (element.hasExperimentalElement()) {
33817        composeBooleanCore("experimental", element.getExperimentalElement(), false);
33818        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
33819      }
33820      if (element.hasDateElement()) {
33821        composeDateTimeCore("date", element.getDateElement(), false);
33822        composeDateTimeExtras("date", element.getDateElement(), false);
33823      }
33824      if (element.hasPublisherElement()) {
33825        composeStringCore("publisher", element.getPublisherElement(), false);
33826        composeStringExtras("publisher", element.getPublisherElement(), false);
33827      }
33828      if (element.hasContact()) {
33829        openArray("contact");
33830        for (ContactDetail e : element.getContact()) 
33831          composeContactDetail(null, e);
33832        closeArray();
33833      };
33834      if (element.hasDescriptionElement()) {
33835        composeMarkdownCore("description", element.getDescriptionElement(), false);
33836        composeMarkdownExtras("description", element.getDescriptionElement(), false);
33837      }
33838      if (element.hasUseContext()) {
33839        openArray("useContext");
33840        for (UsageContext e : element.getUseContext()) 
33841          composeUsageContext(null, e);
33842        closeArray();
33843      };
33844      if (element.hasJurisdiction()) {
33845        openArray("jurisdiction");
33846        for (CodeableConcept e : element.getJurisdiction()) 
33847          composeCodeableConcept(null, e);
33848        closeArray();
33849      };
33850      if (element.hasPurposeElement()) {
33851        composeMarkdownCore("purpose", element.getPurposeElement(), false);
33852        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
33853      }
33854      if (element.hasCopyrightElement()) {
33855        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
33856        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
33857      }
33858      if (element.hasCaseSensitiveElement()) {
33859        composeBooleanCore("caseSensitive", element.getCaseSensitiveElement(), false);
33860        composeBooleanExtras("caseSensitive", element.getCaseSensitiveElement(), false);
33861      }
33862      if (element.hasValueSetElement()) {
33863        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
33864        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
33865      }
33866      if (element.hasHierarchyMeaningElement()) {
33867        composeEnumerationCore("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
33868        composeEnumerationExtras("hierarchyMeaning", element.getHierarchyMeaningElement(), new CodeSystem.CodeSystemHierarchyMeaningEnumFactory(), false);
33869      }
33870      if (element.hasCompositionalElement()) {
33871        composeBooleanCore("compositional", element.getCompositionalElement(), false);
33872        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
33873      }
33874      if (element.hasVersionNeededElement()) {
33875        composeBooleanCore("versionNeeded", element.getVersionNeededElement(), false);
33876        composeBooleanExtras("versionNeeded", element.getVersionNeededElement(), false);
33877      }
33878      if (element.hasContentElement()) {
33879        composeEnumerationCore("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
33880        composeEnumerationExtras("content", element.getContentElement(), new CodeSystem.CodeSystemContentModeEnumFactory(), false);
33881      }
33882      if (element.hasSupplementsElement()) {
33883        composeCanonicalCore("supplements", element.getSupplementsElement(), false);
33884        composeCanonicalExtras("supplements", element.getSupplementsElement(), false);
33885      }
33886      if (element.hasCountElement()) {
33887        composeUnsignedIntCore("count", element.getCountElement(), false);
33888        composeUnsignedIntExtras("count", element.getCountElement(), false);
33889      }
33890      if (element.hasFilter()) {
33891        openArray("filter");
33892        for (CodeSystem.CodeSystemFilterComponent e : element.getFilter()) 
33893          composeCodeSystemCodeSystemFilterComponent(null, e);
33894        closeArray();
33895      };
33896      if (element.hasProperty()) {
33897        openArray("property");
33898        for (CodeSystem.PropertyComponent e : element.getProperty()) 
33899          composeCodeSystemPropertyComponent(null, e);
33900        closeArray();
33901      };
33902      if (element.hasConcept()) {
33903        openArray("concept");
33904        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
33905          composeCodeSystemConceptDefinitionComponent(null, e);
33906        closeArray();
33907      };
33908  }
33909
33910  protected void composeCodeSystemCodeSystemFilterComponent(String name, CodeSystem.CodeSystemFilterComponent element) throws IOException {
33911    if (element != null) {
33912      open(name);
33913      composeCodeSystemCodeSystemFilterComponentInner(element);
33914      close();
33915    }
33916  }
33917
33918  protected void composeCodeSystemCodeSystemFilterComponentInner(CodeSystem.CodeSystemFilterComponent element) throws IOException {
33919      composeBackbone(element);
33920      if (element.hasCodeElement()) {
33921        composeCodeCore("code", element.getCodeElement(), false);
33922        composeCodeExtras("code", element.getCodeElement(), false);
33923      }
33924      if (element.hasDescriptionElement()) {
33925        composeStringCore("description", element.getDescriptionElement(), false);
33926        composeStringExtras("description", element.getDescriptionElement(), false);
33927      }
33928      if (element.hasOperator()) {
33929        openArray("operator");
33930        for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
33931          composeEnumerationCore(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
33932        closeArray();
33933        if (anyHasExtras(element.getOperator())) {
33934          openArray("_operator");
33935          for (Enumeration<CodeSystem.FilterOperator> e : element.getOperator()) 
33936            composeEnumerationExtras(null, e, new CodeSystem.FilterOperatorEnumFactory(), true);
33937          closeArray();
33938        }
33939      };
33940      if (element.hasValueElement()) {
33941        composeStringCore("value", element.getValueElement(), false);
33942        composeStringExtras("value", element.getValueElement(), false);
33943      }
33944  }
33945
33946  protected void composeCodeSystemPropertyComponent(String name, CodeSystem.PropertyComponent element) throws IOException {
33947    if (element != null) {
33948      open(name);
33949      composeCodeSystemPropertyComponentInner(element);
33950      close();
33951    }
33952  }
33953
33954  protected void composeCodeSystemPropertyComponentInner(CodeSystem.PropertyComponent element) throws IOException {
33955      composeBackbone(element);
33956      if (element.hasCodeElement()) {
33957        composeCodeCore("code", element.getCodeElement(), false);
33958        composeCodeExtras("code", element.getCodeElement(), false);
33959      }
33960      if (element.hasUriElement()) {
33961        composeUriCore("uri", element.getUriElement(), false);
33962        composeUriExtras("uri", element.getUriElement(), false);
33963      }
33964      if (element.hasDescriptionElement()) {
33965        composeStringCore("description", element.getDescriptionElement(), false);
33966        composeStringExtras("description", element.getDescriptionElement(), false);
33967      }
33968      if (element.hasTypeElement()) {
33969        composeEnumerationCore("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
33970        composeEnumerationExtras("type", element.getTypeElement(), new CodeSystem.PropertyTypeEnumFactory(), false);
33971      }
33972  }
33973
33974  protected void composeCodeSystemConceptDefinitionComponent(String name, CodeSystem.ConceptDefinitionComponent element) throws IOException {
33975    if (element != null) {
33976      open(name);
33977      composeCodeSystemConceptDefinitionComponentInner(element);
33978      close();
33979    }
33980  }
33981
33982  protected void composeCodeSystemConceptDefinitionComponentInner(CodeSystem.ConceptDefinitionComponent element) throws IOException {
33983      composeBackbone(element);
33984      if (element.hasCodeElement()) {
33985        composeCodeCore("code", element.getCodeElement(), false);
33986        composeCodeExtras("code", element.getCodeElement(), false);
33987      }
33988      if (element.hasDisplayElement()) {
33989        composeStringCore("display", element.getDisplayElement(), false);
33990        composeStringExtras("display", element.getDisplayElement(), false);
33991      }
33992      if (element.hasDefinitionElement()) {
33993        composeStringCore("definition", element.getDefinitionElement(), false);
33994        composeStringExtras("definition", element.getDefinitionElement(), false);
33995      }
33996      if (element.hasDesignation()) {
33997        openArray("designation");
33998        for (CodeSystem.ConceptDefinitionDesignationComponent e : element.getDesignation()) 
33999          composeCodeSystemConceptDefinitionDesignationComponent(null, e);
34000        closeArray();
34001      };
34002      if (element.hasProperty()) {
34003        openArray("property");
34004        for (CodeSystem.ConceptPropertyComponent e : element.getProperty()) 
34005          composeCodeSystemConceptPropertyComponent(null, e);
34006        closeArray();
34007      };
34008      if (element.hasConcept()) {
34009        openArray("concept");
34010        for (CodeSystem.ConceptDefinitionComponent e : element.getConcept()) 
34011          composeCodeSystemConceptDefinitionComponent(null, e);
34012        closeArray();
34013      };
34014  }
34015
34016  protected void composeCodeSystemConceptDefinitionDesignationComponent(String name, CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
34017    if (element != null) {
34018      open(name);
34019      composeCodeSystemConceptDefinitionDesignationComponentInner(element);
34020      close();
34021    }
34022  }
34023
34024  protected void composeCodeSystemConceptDefinitionDesignationComponentInner(CodeSystem.ConceptDefinitionDesignationComponent element) throws IOException {
34025      composeBackbone(element);
34026      if (element.hasLanguageElement()) {
34027        composeCodeCore("language", element.getLanguageElement(), false);
34028        composeCodeExtras("language", element.getLanguageElement(), false);
34029      }
34030      if (element.hasUse()) {
34031        composeCoding("use", element.getUse());
34032      }
34033      if (element.hasValueElement()) {
34034        composeStringCore("value", element.getValueElement(), false);
34035        composeStringExtras("value", element.getValueElement(), false);
34036      }
34037  }
34038
34039  protected void composeCodeSystemConceptPropertyComponent(String name, CodeSystem.ConceptPropertyComponent element) throws IOException {
34040    if (element != null) {
34041      open(name);
34042      composeCodeSystemConceptPropertyComponentInner(element);
34043      close();
34044    }
34045  }
34046
34047  protected void composeCodeSystemConceptPropertyComponentInner(CodeSystem.ConceptPropertyComponent element) throws IOException {
34048      composeBackbone(element);
34049      if (element.hasCodeElement()) {
34050        composeCodeCore("code", element.getCodeElement(), false);
34051        composeCodeExtras("code", element.getCodeElement(), false);
34052      }
34053      if (element.hasValue()) {
34054        composeType("value", element.getValue());
34055      }
34056  }
34057
34058  protected void composeCommunication(String name, Communication element) throws IOException {
34059    if (element != null) {
34060      prop("resourceType", name);
34061      composeCommunicationInner(element);
34062    }
34063  }
34064
34065  protected void composeCommunicationInner(Communication element) throws IOException {
34066      composeDomainResourceElements(element);
34067      if (element.hasIdentifier()) {
34068        openArray("identifier");
34069        for (Identifier e : element.getIdentifier()) 
34070          composeIdentifier(null, e);
34071        closeArray();
34072      };
34073      if (element.hasInstantiatesCanonical()) {
34074        openArray("instantiatesCanonical");
34075        for (CanonicalType e : element.getInstantiatesCanonical()) 
34076          composeCanonicalCore(null, e, true);
34077        closeArray();
34078        if (anyHasExtras(element.getInstantiatesCanonical())) {
34079          openArray("_instantiatesCanonical");
34080          for (CanonicalType e : element.getInstantiatesCanonical()) 
34081            composeCanonicalExtras(null, e, true);
34082          closeArray();
34083        }
34084      };
34085      if (element.hasInstantiatesUri()) {
34086        openArray("instantiatesUri");
34087        for (UriType e : element.getInstantiatesUri()) 
34088          composeUriCore(null, e, true);
34089        closeArray();
34090        if (anyHasExtras(element.getInstantiatesUri())) {
34091          openArray("_instantiatesUri");
34092          for (UriType e : element.getInstantiatesUri()) 
34093            composeUriExtras(null, e, true);
34094          closeArray();
34095        }
34096      };
34097      if (element.hasBasedOn()) {
34098        openArray("basedOn");
34099        for (Reference e : element.getBasedOn()) 
34100          composeReference(null, e);
34101        closeArray();
34102      };
34103      if (element.hasPartOf()) {
34104        openArray("partOf");
34105        for (Reference e : element.getPartOf()) 
34106          composeReference(null, e);
34107        closeArray();
34108      };
34109      if (element.hasInResponseTo()) {
34110        openArray("inResponseTo");
34111        for (Reference e : element.getInResponseTo()) 
34112          composeReference(null, e);
34113        closeArray();
34114      };
34115      if (element.hasStatusElement()) {
34116        composeEnumerationCore("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
34117        composeEnumerationExtras("status", element.getStatusElement(), new Communication.CommunicationStatusEnumFactory(), false);
34118      }
34119      if (element.hasStatusReason()) {
34120        composeCodeableConcept("statusReason", element.getStatusReason());
34121      }
34122      if (element.hasCategory()) {
34123        openArray("category");
34124        for (CodeableConcept e : element.getCategory()) 
34125          composeCodeableConcept(null, e);
34126        closeArray();
34127      };
34128      if (element.hasPriorityElement()) {
34129        composeEnumerationCore("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
34130        composeEnumerationExtras("priority", element.getPriorityElement(), new Communication.CommunicationPriorityEnumFactory(), false);
34131      }
34132      if (element.hasMedium()) {
34133        openArray("medium");
34134        for (CodeableConcept e : element.getMedium()) 
34135          composeCodeableConcept(null, e);
34136        closeArray();
34137      };
34138      if (element.hasSubject()) {
34139        composeReference("subject", element.getSubject());
34140      }
34141      if (element.hasTopic()) {
34142        composeCodeableConcept("topic", element.getTopic());
34143      }
34144      if (element.hasAbout()) {
34145        openArray("about");
34146        for (Reference e : element.getAbout()) 
34147          composeReference(null, e);
34148        closeArray();
34149      };
34150      if (element.hasContext()) {
34151        composeReference("context", element.getContext());
34152      }
34153      if (element.hasSentElement()) {
34154        composeDateTimeCore("sent", element.getSentElement(), false);
34155        composeDateTimeExtras("sent", element.getSentElement(), false);
34156      }
34157      if (element.hasReceivedElement()) {
34158        composeDateTimeCore("received", element.getReceivedElement(), false);
34159        composeDateTimeExtras("received", element.getReceivedElement(), false);
34160      }
34161      if (element.hasRecipient()) {
34162        openArray("recipient");
34163        for (Reference e : element.getRecipient()) 
34164          composeReference(null, e);
34165        closeArray();
34166      };
34167      if (element.hasSender()) {
34168        composeReference("sender", element.getSender());
34169      }
34170      if (element.hasReasonCode()) {
34171        openArray("reasonCode");
34172        for (CodeableConcept e : element.getReasonCode()) 
34173          composeCodeableConcept(null, e);
34174        closeArray();
34175      };
34176      if (element.hasReasonReference()) {
34177        openArray("reasonReference");
34178        for (Reference e : element.getReasonReference()) 
34179          composeReference(null, e);
34180        closeArray();
34181      };
34182      if (element.hasPayload()) {
34183        openArray("payload");
34184        for (Communication.CommunicationPayloadComponent e : element.getPayload()) 
34185          composeCommunicationCommunicationPayloadComponent(null, e);
34186        closeArray();
34187      };
34188      if (element.hasNote()) {
34189        openArray("note");
34190        for (Annotation e : element.getNote()) 
34191          composeAnnotation(null, e);
34192        closeArray();
34193      };
34194  }
34195
34196  protected void composeCommunicationCommunicationPayloadComponent(String name, Communication.CommunicationPayloadComponent element) throws IOException {
34197    if (element != null) {
34198      open(name);
34199      composeCommunicationCommunicationPayloadComponentInner(element);
34200      close();
34201    }
34202  }
34203
34204  protected void composeCommunicationCommunicationPayloadComponentInner(Communication.CommunicationPayloadComponent element) throws IOException {
34205      composeBackbone(element);
34206      if (element.hasContent()) {
34207        composeType("content", element.getContent());
34208      }
34209  }
34210
34211  protected void composeCommunicationRequest(String name, CommunicationRequest element) throws IOException {
34212    if (element != null) {
34213      prop("resourceType", name);
34214      composeCommunicationRequestInner(element);
34215    }
34216  }
34217
34218  protected void composeCommunicationRequestInner(CommunicationRequest element) throws IOException {
34219      composeDomainResourceElements(element);
34220      if (element.hasIdentifier()) {
34221        openArray("identifier");
34222        for (Identifier e : element.getIdentifier()) 
34223          composeIdentifier(null, e);
34224        closeArray();
34225      };
34226      if (element.hasBasedOn()) {
34227        openArray("basedOn");
34228        for (Reference e : element.getBasedOn()) 
34229          composeReference(null, e);
34230        closeArray();
34231      };
34232      if (element.hasReplaces()) {
34233        openArray("replaces");
34234        for (Reference e : element.getReplaces()) 
34235          composeReference(null, e);
34236        closeArray();
34237      };
34238      if (element.hasGroupIdentifier()) {
34239        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
34240      }
34241      if (element.hasStatusElement()) {
34242        composeEnumerationCore("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
34243        composeEnumerationExtras("status", element.getStatusElement(), new CommunicationRequest.CommunicationRequestStatusEnumFactory(), false);
34244      }
34245      if (element.hasStatusReason()) {
34246        composeCodeableConcept("statusReason", element.getStatusReason());
34247      }
34248      if (element.hasCategory()) {
34249        openArray("category");
34250        for (CodeableConcept e : element.getCategory()) 
34251          composeCodeableConcept(null, e);
34252        closeArray();
34253      };
34254      if (element.hasPriorityElement()) {
34255        composeEnumerationCore("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
34256        composeEnumerationExtras("priority", element.getPriorityElement(), new CommunicationRequest.CommunicationPriorityEnumFactory(), false);
34257      }
34258      if (element.hasDoNotPerformElement()) {
34259        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
34260        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
34261      }
34262      if (element.hasMedium()) {
34263        openArray("medium");
34264        for (CodeableConcept e : element.getMedium()) 
34265          composeCodeableConcept(null, e);
34266        closeArray();
34267      };
34268      if (element.hasSubject()) {
34269        composeReference("subject", element.getSubject());
34270      }
34271      if (element.hasAbout()) {
34272        openArray("about");
34273        for (Reference e : element.getAbout()) 
34274          composeReference(null, e);
34275        closeArray();
34276      };
34277      if (element.hasContext()) {
34278        composeReference("context", element.getContext());
34279      }
34280      if (element.hasPayload()) {
34281        openArray("payload");
34282        for (CommunicationRequest.CommunicationRequestPayloadComponent e : element.getPayload()) 
34283          composeCommunicationRequestCommunicationRequestPayloadComponent(null, e);
34284        closeArray();
34285      };
34286      if (element.hasOccurrence()) {
34287        composeType("occurrence", element.getOccurrence());
34288      }
34289      if (element.hasAuthoredOnElement()) {
34290        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
34291        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
34292      }
34293      if (element.hasRequester()) {
34294        composeReference("requester", element.getRequester());
34295      }
34296      if (element.hasRecipient()) {
34297        openArray("recipient");
34298        for (Reference e : element.getRecipient()) 
34299          composeReference(null, e);
34300        closeArray();
34301      };
34302      if (element.hasSender()) {
34303        composeReference("sender", element.getSender());
34304      }
34305      if (element.hasReasonCode()) {
34306        openArray("reasonCode");
34307        for (CodeableConcept e : element.getReasonCode()) 
34308          composeCodeableConcept(null, e);
34309        closeArray();
34310      };
34311      if (element.hasReasonReference()) {
34312        openArray("reasonReference");
34313        for (Reference e : element.getReasonReference()) 
34314          composeReference(null, e);
34315        closeArray();
34316      };
34317      if (element.hasNote()) {
34318        openArray("note");
34319        for (Annotation e : element.getNote()) 
34320          composeAnnotation(null, e);
34321        closeArray();
34322      };
34323  }
34324
34325  protected void composeCommunicationRequestCommunicationRequestPayloadComponent(String name, CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
34326    if (element != null) {
34327      open(name);
34328      composeCommunicationRequestCommunicationRequestPayloadComponentInner(element);
34329      close();
34330    }
34331  }
34332
34333  protected void composeCommunicationRequestCommunicationRequestPayloadComponentInner(CommunicationRequest.CommunicationRequestPayloadComponent element) throws IOException {
34334      composeBackbone(element);
34335      if (element.hasContent()) {
34336        composeType("content", element.getContent());
34337      }
34338  }
34339
34340  protected void composeCompartmentDefinition(String name, CompartmentDefinition element) throws IOException {
34341    if (element != null) {
34342      prop("resourceType", name);
34343      composeCompartmentDefinitionInner(element);
34344    }
34345  }
34346
34347  protected void composeCompartmentDefinitionInner(CompartmentDefinition element) throws IOException {
34348      composeDomainResourceElements(element);
34349      if (element.hasUrlElement()) {
34350        composeUriCore("url", element.getUrlElement(), false);
34351        composeUriExtras("url", element.getUrlElement(), false);
34352      }
34353      if (element.hasVersionElement()) {
34354        composeStringCore("version", element.getVersionElement(), false);
34355        composeStringExtras("version", element.getVersionElement(), false);
34356      }
34357      if (element.hasNameElement()) {
34358        composeStringCore("name", element.getNameElement(), false);
34359        composeStringExtras("name", element.getNameElement(), false);
34360      }
34361      if (element.hasStatusElement()) {
34362        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34363        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34364      }
34365      if (element.hasExperimentalElement()) {
34366        composeBooleanCore("experimental", element.getExperimentalElement(), false);
34367        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
34368      }
34369      if (element.hasDateElement()) {
34370        composeDateTimeCore("date", element.getDateElement(), false);
34371        composeDateTimeExtras("date", element.getDateElement(), false);
34372      }
34373      if (element.hasPublisherElement()) {
34374        composeStringCore("publisher", element.getPublisherElement(), false);
34375        composeStringExtras("publisher", element.getPublisherElement(), false);
34376      }
34377      if (element.hasContact()) {
34378        openArray("contact");
34379        for (ContactDetail e : element.getContact()) 
34380          composeContactDetail(null, e);
34381        closeArray();
34382      };
34383      if (element.hasDescriptionElement()) {
34384        composeMarkdownCore("description", element.getDescriptionElement(), false);
34385        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34386      }
34387      if (element.hasUseContext()) {
34388        openArray("useContext");
34389        for (UsageContext e : element.getUseContext()) 
34390          composeUsageContext(null, e);
34391        closeArray();
34392      };
34393      if (element.hasPurposeElement()) {
34394        composeMarkdownCore("purpose", element.getPurposeElement(), false);
34395        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
34396      }
34397      if (element.hasCodeElement()) {
34398        composeEnumerationCore("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
34399        composeEnumerationExtras("code", element.getCodeElement(), new CompartmentDefinition.CompartmentTypeEnumFactory(), false);
34400      }
34401      if (element.hasSearchElement()) {
34402        composeBooleanCore("search", element.getSearchElement(), false);
34403        composeBooleanExtras("search", element.getSearchElement(), false);
34404      }
34405      if (element.hasResource()) {
34406        openArray("resource");
34407        for (CompartmentDefinition.CompartmentDefinitionResourceComponent e : element.getResource()) 
34408          composeCompartmentDefinitionCompartmentDefinitionResourceComponent(null, e);
34409        closeArray();
34410      };
34411  }
34412
34413  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponent(String name, CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
34414    if (element != null) {
34415      open(name);
34416      composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(element);
34417      close();
34418    }
34419  }
34420
34421  protected void composeCompartmentDefinitionCompartmentDefinitionResourceComponentInner(CompartmentDefinition.CompartmentDefinitionResourceComponent element) throws IOException {
34422      composeBackbone(element);
34423      if (element.hasCodeElement()) {
34424        composeCodeCore("code", element.getCodeElement(), false);
34425        composeCodeExtras("code", element.getCodeElement(), false);
34426      }
34427      if (element.hasParam()) {
34428        openArray("param");
34429        for (StringType e : element.getParam()) 
34430          composeStringCore(null, e, true);
34431        closeArray();
34432        if (anyHasExtras(element.getParam())) {
34433          openArray("_param");
34434          for (StringType e : element.getParam()) 
34435            composeStringExtras(null, e, true);
34436          closeArray();
34437        }
34438      };
34439      if (element.hasDocumentationElement()) {
34440        composeStringCore("documentation", element.getDocumentationElement(), false);
34441        composeStringExtras("documentation", element.getDocumentationElement(), false);
34442      }
34443  }
34444
34445  protected void composeComposition(String name, Composition element) throws IOException {
34446    if (element != null) {
34447      prop("resourceType", name);
34448      composeCompositionInner(element);
34449    }
34450  }
34451
34452  protected void composeCompositionInner(Composition element) throws IOException {
34453      composeDomainResourceElements(element);
34454      if (element.hasIdentifier()) {
34455        composeIdentifier("identifier", element.getIdentifier());
34456      }
34457      if (element.hasStatusElement()) {
34458        composeEnumerationCore("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
34459        composeEnumerationExtras("status", element.getStatusElement(), new Composition.CompositionStatusEnumFactory(), false);
34460      }
34461      if (element.hasType()) {
34462        composeCodeableConcept("type", element.getType());
34463      }
34464      if (element.hasCategory()) {
34465        openArray("category");
34466        for (CodeableConcept e : element.getCategory()) 
34467          composeCodeableConcept(null, e);
34468        closeArray();
34469      };
34470      if (element.hasSubject()) {
34471        composeReference("subject", element.getSubject());
34472      }
34473      if (element.hasEncounter()) {
34474        composeReference("encounter", element.getEncounter());
34475      }
34476      if (element.hasDateElement()) {
34477        composeDateTimeCore("date", element.getDateElement(), false);
34478        composeDateTimeExtras("date", element.getDateElement(), false);
34479      }
34480      if (element.hasAuthor()) {
34481        openArray("author");
34482        for (Reference e : element.getAuthor()) 
34483          composeReference(null, e);
34484        closeArray();
34485      };
34486      if (element.hasTitleElement()) {
34487        composeStringCore("title", element.getTitleElement(), false);
34488        composeStringExtras("title", element.getTitleElement(), false);
34489      }
34490      if (element.hasConfidentialityElement()) {
34491        composeEnumerationCore("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
34492        composeEnumerationExtras("confidentiality", element.getConfidentialityElement(), new Composition.DocumentConfidentialityEnumFactory(), false);
34493      }
34494      if (element.hasAttester()) {
34495        openArray("attester");
34496        for (Composition.CompositionAttesterComponent e : element.getAttester()) 
34497          composeCompositionCompositionAttesterComponent(null, e);
34498        closeArray();
34499      };
34500      if (element.hasCustodian()) {
34501        composeReference("custodian", element.getCustodian());
34502      }
34503      if (element.hasRelatesTo()) {
34504        openArray("relatesTo");
34505        for (Composition.CompositionRelatesToComponent e : element.getRelatesTo()) 
34506          composeCompositionCompositionRelatesToComponent(null, e);
34507        closeArray();
34508      };
34509      if (element.hasEvent()) {
34510        openArray("event");
34511        for (Composition.CompositionEventComponent e : element.getEvent()) 
34512          composeCompositionCompositionEventComponent(null, e);
34513        closeArray();
34514      };
34515      if (element.hasSection()) {
34516        openArray("section");
34517        for (Composition.SectionComponent e : element.getSection()) 
34518          composeCompositionSectionComponent(null, e);
34519        closeArray();
34520      };
34521  }
34522
34523  protected void composeCompositionCompositionAttesterComponent(String name, Composition.CompositionAttesterComponent element) throws IOException {
34524    if (element != null) {
34525      open(name);
34526      composeCompositionCompositionAttesterComponentInner(element);
34527      close();
34528    }
34529  }
34530
34531  protected void composeCompositionCompositionAttesterComponentInner(Composition.CompositionAttesterComponent element) throws IOException {
34532      composeBackbone(element);
34533      if (element.hasModeElement()) {
34534        composeEnumerationCore("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
34535        composeEnumerationExtras("mode", element.getModeElement(), new Composition.CompositionAttestationModeEnumFactory(), false);
34536      }
34537      if (element.hasTimeElement()) {
34538        composeDateTimeCore("time", element.getTimeElement(), false);
34539        composeDateTimeExtras("time", element.getTimeElement(), false);
34540      }
34541      if (element.hasParty()) {
34542        composeReference("party", element.getParty());
34543      }
34544  }
34545
34546  protected void composeCompositionCompositionRelatesToComponent(String name, Composition.CompositionRelatesToComponent element) throws IOException {
34547    if (element != null) {
34548      open(name);
34549      composeCompositionCompositionRelatesToComponentInner(element);
34550      close();
34551    }
34552  }
34553
34554  protected void composeCompositionCompositionRelatesToComponentInner(Composition.CompositionRelatesToComponent element) throws IOException {
34555      composeBackbone(element);
34556      if (element.hasCodeElement()) {
34557        composeEnumerationCore("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
34558        composeEnumerationExtras("code", element.getCodeElement(), new Composition.DocumentRelationshipTypeEnumFactory(), false);
34559      }
34560      if (element.hasTarget()) {
34561        composeType("target", element.getTarget());
34562      }
34563  }
34564
34565  protected void composeCompositionCompositionEventComponent(String name, Composition.CompositionEventComponent element) throws IOException {
34566    if (element != null) {
34567      open(name);
34568      composeCompositionCompositionEventComponentInner(element);
34569      close();
34570    }
34571  }
34572
34573  protected void composeCompositionCompositionEventComponentInner(Composition.CompositionEventComponent element) throws IOException {
34574      composeBackbone(element);
34575      if (element.hasCode()) {
34576        openArray("code");
34577        for (CodeableConcept e : element.getCode()) 
34578          composeCodeableConcept(null, e);
34579        closeArray();
34580      };
34581      if (element.hasPeriod()) {
34582        composePeriod("period", element.getPeriod());
34583      }
34584      if (element.hasDetail()) {
34585        openArray("detail");
34586        for (Reference e : element.getDetail()) 
34587          composeReference(null, e);
34588        closeArray();
34589      };
34590  }
34591
34592  protected void composeCompositionSectionComponent(String name, Composition.SectionComponent element) throws IOException {
34593    if (element != null) {
34594      open(name);
34595      composeCompositionSectionComponentInner(element);
34596      close();
34597    }
34598  }
34599
34600  protected void composeCompositionSectionComponentInner(Composition.SectionComponent element) throws IOException {
34601      composeBackbone(element);
34602      if (element.hasTitleElement()) {
34603        composeStringCore("title", element.getTitleElement(), false);
34604        composeStringExtras("title", element.getTitleElement(), false);
34605      }
34606      if (element.hasCode()) {
34607        composeCodeableConcept("code", element.getCode());
34608      }
34609      if (element.hasAuthor()) {
34610        openArray("author");
34611        for (Reference e : element.getAuthor()) 
34612          composeReference(null, e);
34613        closeArray();
34614      };
34615      if (element.hasText()) {
34616        composeNarrative("text", element.getText());
34617      }
34618      if (element.hasModeElement()) {
34619        composeEnumerationCore("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
34620        composeEnumerationExtras("mode", element.getModeElement(), new Composition.SectionModeEnumFactory(), false);
34621      }
34622      if (element.hasOrderedBy()) {
34623        composeCodeableConcept("orderedBy", element.getOrderedBy());
34624      }
34625      if (element.hasEntry()) {
34626        openArray("entry");
34627        for (Reference e : element.getEntry()) 
34628          composeReference(null, e);
34629        closeArray();
34630      };
34631      if (element.hasEmptyReason()) {
34632        composeCodeableConcept("emptyReason", element.getEmptyReason());
34633      }
34634      if (element.hasSection()) {
34635        openArray("section");
34636        for (Composition.SectionComponent e : element.getSection()) 
34637          composeCompositionSectionComponent(null, e);
34638        closeArray();
34639      };
34640  }
34641
34642  protected void composeConceptMap(String name, ConceptMap element) throws IOException {
34643    if (element != null) {
34644      prop("resourceType", name);
34645      composeConceptMapInner(element);
34646    }
34647  }
34648
34649  protected void composeConceptMapInner(ConceptMap element) throws IOException {
34650      composeDomainResourceElements(element);
34651      if (element.hasUrlElement()) {
34652        composeUriCore("url", element.getUrlElement(), false);
34653        composeUriExtras("url", element.getUrlElement(), false);
34654      }
34655      if (element.hasIdentifier()) {
34656        composeIdentifier("identifier", element.getIdentifier());
34657      }
34658      if (element.hasVersionElement()) {
34659        composeStringCore("version", element.getVersionElement(), false);
34660        composeStringExtras("version", element.getVersionElement(), false);
34661      }
34662      if (element.hasNameElement()) {
34663        composeStringCore("name", element.getNameElement(), false);
34664        composeStringExtras("name", element.getNameElement(), false);
34665      }
34666      if (element.hasTitleElement()) {
34667        composeStringCore("title", element.getTitleElement(), false);
34668        composeStringExtras("title", element.getTitleElement(), false);
34669      }
34670      if (element.hasStatusElement()) {
34671        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34672        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
34673      }
34674      if (element.hasExperimentalElement()) {
34675        composeBooleanCore("experimental", element.getExperimentalElement(), false);
34676        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
34677      }
34678      if (element.hasDateElement()) {
34679        composeDateTimeCore("date", element.getDateElement(), false);
34680        composeDateTimeExtras("date", element.getDateElement(), false);
34681      }
34682      if (element.hasPublisherElement()) {
34683        composeStringCore("publisher", element.getPublisherElement(), false);
34684        composeStringExtras("publisher", element.getPublisherElement(), false);
34685      }
34686      if (element.hasContact()) {
34687        openArray("contact");
34688        for (ContactDetail e : element.getContact()) 
34689          composeContactDetail(null, e);
34690        closeArray();
34691      };
34692      if (element.hasDescriptionElement()) {
34693        composeMarkdownCore("description", element.getDescriptionElement(), false);
34694        composeMarkdownExtras("description", element.getDescriptionElement(), false);
34695      }
34696      if (element.hasUseContext()) {
34697        openArray("useContext");
34698        for (UsageContext e : element.getUseContext()) 
34699          composeUsageContext(null, e);
34700        closeArray();
34701      };
34702      if (element.hasJurisdiction()) {
34703        openArray("jurisdiction");
34704        for (CodeableConcept e : element.getJurisdiction()) 
34705          composeCodeableConcept(null, e);
34706        closeArray();
34707      };
34708      if (element.hasPurposeElement()) {
34709        composeMarkdownCore("purpose", element.getPurposeElement(), false);
34710        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
34711      }
34712      if (element.hasCopyrightElement()) {
34713        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
34714        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
34715      }
34716      if (element.hasSource()) {
34717        composeType("source", element.getSource());
34718      }
34719      if (element.hasTarget()) {
34720        composeType("target", element.getTarget());
34721      }
34722      if (element.hasGroup()) {
34723        openArray("group");
34724        for (ConceptMap.ConceptMapGroupComponent e : element.getGroup()) 
34725          composeConceptMapConceptMapGroupComponent(null, e);
34726        closeArray();
34727      };
34728  }
34729
34730  protected void composeConceptMapConceptMapGroupComponent(String name, ConceptMap.ConceptMapGroupComponent element) throws IOException {
34731    if (element != null) {
34732      open(name);
34733      composeConceptMapConceptMapGroupComponentInner(element);
34734      close();
34735    }
34736  }
34737
34738  protected void composeConceptMapConceptMapGroupComponentInner(ConceptMap.ConceptMapGroupComponent element) throws IOException {
34739      composeBackbone(element);
34740      if (element.hasSourceElement()) {
34741        composeUriCore("source", element.getSourceElement(), false);
34742        composeUriExtras("source", element.getSourceElement(), false);
34743      }
34744      if (element.hasSourceVersionElement()) {
34745        composeStringCore("sourceVersion", element.getSourceVersionElement(), false);
34746        composeStringExtras("sourceVersion", element.getSourceVersionElement(), false);
34747      }
34748      if (element.hasTargetElement()) {
34749        composeUriCore("target", element.getTargetElement(), false);
34750        composeUriExtras("target", element.getTargetElement(), false);
34751      }
34752      if (element.hasTargetVersionElement()) {
34753        composeStringCore("targetVersion", element.getTargetVersionElement(), false);
34754        composeStringExtras("targetVersion", element.getTargetVersionElement(), false);
34755      }
34756      if (element.hasElement()) {
34757        openArray("element");
34758        for (ConceptMap.SourceElementComponent e : element.getElement()) 
34759          composeConceptMapSourceElementComponent(null, e);
34760        closeArray();
34761      };
34762      if (element.hasUnmapped()) {
34763        composeConceptMapConceptMapGroupUnmappedComponent("unmapped", element.getUnmapped());
34764      }
34765  }
34766
34767  protected void composeConceptMapSourceElementComponent(String name, ConceptMap.SourceElementComponent element) throws IOException {
34768    if (element != null) {
34769      open(name);
34770      composeConceptMapSourceElementComponentInner(element);
34771      close();
34772    }
34773  }
34774
34775  protected void composeConceptMapSourceElementComponentInner(ConceptMap.SourceElementComponent element) throws IOException {
34776      composeBackbone(element);
34777      if (element.hasCodeElement()) {
34778        composeCodeCore("code", element.getCodeElement(), false);
34779        composeCodeExtras("code", element.getCodeElement(), false);
34780      }
34781      if (element.hasDisplayElement()) {
34782        composeStringCore("display", element.getDisplayElement(), false);
34783        composeStringExtras("display", element.getDisplayElement(), false);
34784      }
34785      if (element.hasTarget()) {
34786        openArray("target");
34787        for (ConceptMap.TargetElementComponent e : element.getTarget()) 
34788          composeConceptMapTargetElementComponent(null, e);
34789        closeArray();
34790      };
34791  }
34792
34793  protected void composeConceptMapTargetElementComponent(String name, ConceptMap.TargetElementComponent element) throws IOException {
34794    if (element != null) {
34795      open(name);
34796      composeConceptMapTargetElementComponentInner(element);
34797      close();
34798    }
34799  }
34800
34801  protected void composeConceptMapTargetElementComponentInner(ConceptMap.TargetElementComponent element) throws IOException {
34802      composeBackbone(element);
34803      if (element.hasCodeElement()) {
34804        composeCodeCore("code", element.getCodeElement(), false);
34805        composeCodeExtras("code", element.getCodeElement(), false);
34806      }
34807      if (element.hasDisplayElement()) {
34808        composeStringCore("display", element.getDisplayElement(), false);
34809        composeStringExtras("display", element.getDisplayElement(), false);
34810      }
34811      if (element.hasEquivalenceElement()) {
34812        composeEnumerationCore("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
34813        composeEnumerationExtras("equivalence", element.getEquivalenceElement(), new Enumerations.ConceptMapEquivalenceEnumFactory(), false);
34814      }
34815      if (element.hasCommentElement()) {
34816        composeStringCore("comment", element.getCommentElement(), false);
34817        composeStringExtras("comment", element.getCommentElement(), false);
34818      }
34819      if (element.hasDependsOn()) {
34820        openArray("dependsOn");
34821        for (ConceptMap.OtherElementComponent e : element.getDependsOn()) 
34822          composeConceptMapOtherElementComponent(null, e);
34823        closeArray();
34824      };
34825      if (element.hasProduct()) {
34826        openArray("product");
34827        for (ConceptMap.OtherElementComponent e : element.getProduct()) 
34828          composeConceptMapOtherElementComponent(null, e);
34829        closeArray();
34830      };
34831  }
34832
34833  protected void composeConceptMapOtherElementComponent(String name, ConceptMap.OtherElementComponent element) throws IOException {
34834    if (element != null) {
34835      open(name);
34836      composeConceptMapOtherElementComponentInner(element);
34837      close();
34838    }
34839  }
34840
34841  protected void composeConceptMapOtherElementComponentInner(ConceptMap.OtherElementComponent element) throws IOException {
34842      composeBackbone(element);
34843      if (element.hasPropertyElement()) {
34844        composeUriCore("property", element.getPropertyElement(), false);
34845        composeUriExtras("property", element.getPropertyElement(), false);
34846      }
34847      if (element.hasSystemElement()) {
34848        composeCanonicalCore("system", element.getSystemElement(), false);
34849        composeCanonicalExtras("system", element.getSystemElement(), false);
34850      }
34851      if (element.hasValueElement()) {
34852        composeStringCore("value", element.getValueElement(), false);
34853        composeStringExtras("value", element.getValueElement(), false);
34854      }
34855      if (element.hasDisplayElement()) {
34856        composeStringCore("display", element.getDisplayElement(), false);
34857        composeStringExtras("display", element.getDisplayElement(), false);
34858      }
34859  }
34860
34861  protected void composeConceptMapConceptMapGroupUnmappedComponent(String name, ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
34862    if (element != null) {
34863      open(name);
34864      composeConceptMapConceptMapGroupUnmappedComponentInner(element);
34865      close();
34866    }
34867  }
34868
34869  protected void composeConceptMapConceptMapGroupUnmappedComponentInner(ConceptMap.ConceptMapGroupUnmappedComponent element) throws IOException {
34870      composeBackbone(element);
34871      if (element.hasModeElement()) {
34872        composeEnumerationCore("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
34873        composeEnumerationExtras("mode", element.getModeElement(), new ConceptMap.ConceptMapGroupUnmappedModeEnumFactory(), false);
34874      }
34875      if (element.hasCodeElement()) {
34876        composeCodeCore("code", element.getCodeElement(), false);
34877        composeCodeExtras("code", element.getCodeElement(), false);
34878      }
34879      if (element.hasDisplayElement()) {
34880        composeStringCore("display", element.getDisplayElement(), false);
34881        composeStringExtras("display", element.getDisplayElement(), false);
34882      }
34883      if (element.hasUrlElement()) {
34884        composeCanonicalCore("url", element.getUrlElement(), false);
34885        composeCanonicalExtras("url", element.getUrlElement(), false);
34886      }
34887  }
34888
34889  protected void composeCondition(String name, Condition element) throws IOException {
34890    if (element != null) {
34891      prop("resourceType", name);
34892      composeConditionInner(element);
34893    }
34894  }
34895
34896  protected void composeConditionInner(Condition element) throws IOException {
34897      composeDomainResourceElements(element);
34898      if (element.hasIdentifier()) {
34899        openArray("identifier");
34900        for (Identifier e : element.getIdentifier()) 
34901          composeIdentifier(null, e);
34902        closeArray();
34903      };
34904      if (element.hasClinicalStatus()) {
34905        composeCodeableConcept("clinicalStatus", element.getClinicalStatus());
34906      }
34907      if (element.hasVerificationStatus()) {
34908        composeCodeableConcept("verificationStatus", element.getVerificationStatus());
34909      }
34910      if (element.hasCategory()) {
34911        openArray("category");
34912        for (CodeableConcept e : element.getCategory()) 
34913          composeCodeableConcept(null, e);
34914        closeArray();
34915      };
34916      if (element.hasSeverity()) {
34917        composeCodeableConcept("severity", element.getSeverity());
34918      }
34919      if (element.hasCode()) {
34920        composeCodeableConcept("code", element.getCode());
34921      }
34922      if (element.hasBodySite()) {
34923        openArray("bodySite");
34924        for (CodeableConcept e : element.getBodySite()) 
34925          composeCodeableConcept(null, e);
34926        closeArray();
34927      };
34928      if (element.hasSubject()) {
34929        composeReference("subject", element.getSubject());
34930      }
34931      if (element.hasContext()) {
34932        composeReference("context", element.getContext());
34933      }
34934      if (element.hasOnset()) {
34935        composeType("onset", element.getOnset());
34936      }
34937      if (element.hasAbatement()) {
34938        composeType("abatement", element.getAbatement());
34939      }
34940      if (element.hasRecordedDateElement()) {
34941        composeDateTimeCore("recordedDate", element.getRecordedDateElement(), false);
34942        composeDateTimeExtras("recordedDate", element.getRecordedDateElement(), false);
34943      }
34944      if (element.hasRecorder()) {
34945        composeReference("recorder", element.getRecorder());
34946      }
34947      if (element.hasAsserter()) {
34948        composeReference("asserter", element.getAsserter());
34949      }
34950      if (element.hasStage()) {
34951        openArray("stage");
34952        for (Condition.ConditionStageComponent e : element.getStage()) 
34953          composeConditionConditionStageComponent(null, e);
34954        closeArray();
34955      };
34956      if (element.hasEvidence()) {
34957        openArray("evidence");
34958        for (Condition.ConditionEvidenceComponent e : element.getEvidence()) 
34959          composeConditionConditionEvidenceComponent(null, e);
34960        closeArray();
34961      };
34962      if (element.hasNote()) {
34963        openArray("note");
34964        for (Annotation e : element.getNote()) 
34965          composeAnnotation(null, e);
34966        closeArray();
34967      };
34968  }
34969
34970  protected void composeConditionConditionStageComponent(String name, Condition.ConditionStageComponent element) throws IOException {
34971    if (element != null) {
34972      open(name);
34973      composeConditionConditionStageComponentInner(element);
34974      close();
34975    }
34976  }
34977
34978  protected void composeConditionConditionStageComponentInner(Condition.ConditionStageComponent element) throws IOException {
34979      composeBackbone(element);
34980      if (element.hasSummary()) {
34981        composeCodeableConcept("summary", element.getSummary());
34982      }
34983      if (element.hasAssessment()) {
34984        openArray("assessment");
34985        for (Reference e : element.getAssessment()) 
34986          composeReference(null, e);
34987        closeArray();
34988      };
34989      if (element.hasType()) {
34990        composeCodeableConcept("type", element.getType());
34991      }
34992  }
34993
34994  protected void composeConditionConditionEvidenceComponent(String name, Condition.ConditionEvidenceComponent element) throws IOException {
34995    if (element != null) {
34996      open(name);
34997      composeConditionConditionEvidenceComponentInner(element);
34998      close();
34999    }
35000  }
35001
35002  protected void composeConditionConditionEvidenceComponentInner(Condition.ConditionEvidenceComponent element) throws IOException {
35003      composeBackbone(element);
35004      if (element.hasCode()) {
35005        openArray("code");
35006        for (CodeableConcept e : element.getCode()) 
35007          composeCodeableConcept(null, e);
35008        closeArray();
35009      };
35010      if (element.hasDetail()) {
35011        openArray("detail");
35012        for (Reference e : element.getDetail()) 
35013          composeReference(null, e);
35014        closeArray();
35015      };
35016  }
35017
35018  protected void composeConsent(String name, Consent element) throws IOException {
35019    if (element != null) {
35020      prop("resourceType", name);
35021      composeConsentInner(element);
35022    }
35023  }
35024
35025  protected void composeConsentInner(Consent element) throws IOException {
35026      composeDomainResourceElements(element);
35027      if (element.hasIdentifier()) {
35028        openArray("identifier");
35029        for (Identifier e : element.getIdentifier()) 
35030          composeIdentifier(null, e);
35031        closeArray();
35032      };
35033      if (element.hasStatusElement()) {
35034        composeEnumerationCore("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
35035        composeEnumerationExtras("status", element.getStatusElement(), new Consent.ConsentStateEnumFactory(), false);
35036      }
35037      if (element.hasScope()) {
35038        composeCodeableConcept("scope", element.getScope());
35039      }
35040      if (element.hasCategory()) {
35041        openArray("category");
35042        for (CodeableConcept e : element.getCategory()) 
35043          composeCodeableConcept(null, e);
35044        closeArray();
35045      };
35046      if (element.hasPatient()) {
35047        composeReference("patient", element.getPatient());
35048      }
35049      if (element.hasDateTimeElement()) {
35050        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
35051        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
35052      }
35053      if (element.hasPerformer()) {
35054        openArray("performer");
35055        for (Reference e : element.getPerformer()) 
35056          composeReference(null, e);
35057        closeArray();
35058      };
35059      if (element.hasOrganization()) {
35060        openArray("organization");
35061        for (Reference e : element.getOrganization()) 
35062          composeReference(null, e);
35063        closeArray();
35064      };
35065      if (element.hasSource()) {
35066        composeType("source", element.getSource());
35067      }
35068      if (element.hasPolicy()) {
35069        openArray("policy");
35070        for (Consent.ConsentPolicyComponent e : element.getPolicy()) 
35071          composeConsentConsentPolicyComponent(null, e);
35072        closeArray();
35073      };
35074      if (element.hasPolicyRule()) {
35075        composeCodeableConcept("policyRule", element.getPolicyRule());
35076      }
35077      if (element.hasVerification()) {
35078        openArray("verification");
35079        for (Consent.ConsentVerificationComponent e : element.getVerification()) 
35080          composeConsentConsentVerificationComponent(null, e);
35081        closeArray();
35082      };
35083      if (element.hasProvision()) {
35084        composeConsentprovisionComponent("provision", element.getProvision());
35085      }
35086  }
35087
35088  protected void composeConsentConsentPolicyComponent(String name, Consent.ConsentPolicyComponent element) throws IOException {
35089    if (element != null) {
35090      open(name);
35091      composeConsentConsentPolicyComponentInner(element);
35092      close();
35093    }
35094  }
35095
35096  protected void composeConsentConsentPolicyComponentInner(Consent.ConsentPolicyComponent element) throws IOException {
35097      composeBackbone(element);
35098      if (element.hasAuthorityElement()) {
35099        composeUriCore("authority", element.getAuthorityElement(), false);
35100        composeUriExtras("authority", element.getAuthorityElement(), false);
35101      }
35102      if (element.hasUriElement()) {
35103        composeUriCore("uri", element.getUriElement(), false);
35104        composeUriExtras("uri", element.getUriElement(), false);
35105      }
35106  }
35107
35108  protected void composeConsentConsentVerificationComponent(String name, Consent.ConsentVerificationComponent element) throws IOException {
35109    if (element != null) {
35110      open(name);
35111      composeConsentConsentVerificationComponentInner(element);
35112      close();
35113    }
35114  }
35115
35116  protected void composeConsentConsentVerificationComponentInner(Consent.ConsentVerificationComponent element) throws IOException {
35117      composeBackbone(element);
35118      if (element.hasVerifiedElement()) {
35119        composeBooleanCore("verified", element.getVerifiedElement(), false);
35120        composeBooleanExtras("verified", element.getVerifiedElement(), false);
35121      }
35122      if (element.hasVerifiedWith()) {
35123        composeReference("verifiedWith", element.getVerifiedWith());
35124      }
35125      if (element.hasVerificationDateElement()) {
35126        composeDateTimeCore("verificationDate", element.getVerificationDateElement(), false);
35127        composeDateTimeExtras("verificationDate", element.getVerificationDateElement(), false);
35128      }
35129  }
35130
35131  protected void composeConsentprovisionComponent(String name, Consent.provisionComponent element) throws IOException {
35132    if (element != null) {
35133      open(name);
35134      composeConsentprovisionComponentInner(element);
35135      close();
35136    }
35137  }
35138
35139  protected void composeConsentprovisionComponentInner(Consent.provisionComponent element) throws IOException {
35140      composeBackbone(element);
35141      if (element.hasTypeElement()) {
35142        composeEnumerationCore("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
35143        composeEnumerationExtras("type", element.getTypeElement(), new Consent.ConsentProvisionTypeEnumFactory(), false);
35144      }
35145      if (element.hasPeriod()) {
35146        composePeriod("period", element.getPeriod());
35147      }
35148      if (element.hasActor()) {
35149        openArray("actor");
35150        for (Consent.provisionActorComponent e : element.getActor()) 
35151          composeConsentprovisionActorComponent(null, e);
35152        closeArray();
35153      };
35154      if (element.hasAction()) {
35155        openArray("action");
35156        for (CodeableConcept e : element.getAction()) 
35157          composeCodeableConcept(null, e);
35158        closeArray();
35159      };
35160      if (element.hasSecurityLabel()) {
35161        openArray("securityLabel");
35162        for (Coding e : element.getSecurityLabel()) 
35163          composeCoding(null, e);
35164        closeArray();
35165      };
35166      if (element.hasPurpose()) {
35167        openArray("purpose");
35168        for (Coding e : element.getPurpose()) 
35169          composeCoding(null, e);
35170        closeArray();
35171      };
35172      if (element.hasClass_()) {
35173        openArray("class");
35174        for (Coding e : element.getClass_()) 
35175          composeCoding(null, e);
35176        closeArray();
35177      };
35178      if (element.hasCode()) {
35179        openArray("code");
35180        for (CodeableConcept e : element.getCode()) 
35181          composeCodeableConcept(null, e);
35182        closeArray();
35183      };
35184      if (element.hasDataPeriod()) {
35185        composePeriod("dataPeriod", element.getDataPeriod());
35186      }
35187      if (element.hasData()) {
35188        openArray("data");
35189        for (Consent.provisionDataComponent e : element.getData()) 
35190          composeConsentprovisionDataComponent(null, e);
35191        closeArray();
35192      };
35193      if (element.hasProvision()) {
35194        openArray("provision");
35195        for (Consent.provisionComponent e : element.getProvision()) 
35196          composeConsentprovisionComponent(null, e);
35197        closeArray();
35198      };
35199  }
35200
35201  protected void composeConsentprovisionActorComponent(String name, Consent.provisionActorComponent element) throws IOException {
35202    if (element != null) {
35203      open(name);
35204      composeConsentprovisionActorComponentInner(element);
35205      close();
35206    }
35207  }
35208
35209  protected void composeConsentprovisionActorComponentInner(Consent.provisionActorComponent element) throws IOException {
35210      composeBackbone(element);
35211      if (element.hasRole()) {
35212        composeCodeableConcept("role", element.getRole());
35213      }
35214      if (element.hasReference()) {
35215        composeReference("reference", element.getReference());
35216      }
35217  }
35218
35219  protected void composeConsentprovisionDataComponent(String name, Consent.provisionDataComponent element) throws IOException {
35220    if (element != null) {
35221      open(name);
35222      composeConsentprovisionDataComponentInner(element);
35223      close();
35224    }
35225  }
35226
35227  protected void composeConsentprovisionDataComponentInner(Consent.provisionDataComponent element) throws IOException {
35228      composeBackbone(element);
35229      if (element.hasMeaningElement()) {
35230        composeEnumerationCore("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
35231        composeEnumerationExtras("meaning", element.getMeaningElement(), new Consent.ConsentDataMeaningEnumFactory(), false);
35232      }
35233      if (element.hasReference()) {
35234        composeReference("reference", element.getReference());
35235      }
35236  }
35237
35238  protected void composeContract(String name, Contract element) throws IOException {
35239    if (element != null) {
35240      prop("resourceType", name);
35241      composeContractInner(element);
35242    }
35243  }
35244
35245  protected void composeContractInner(Contract element) throws IOException {
35246      composeDomainResourceElements(element);
35247      if (element.hasIdentifier()) {
35248        openArray("identifier");
35249        for (Identifier e : element.getIdentifier()) 
35250          composeIdentifier(null, e);
35251        closeArray();
35252      };
35253      if (element.hasUrlElement()) {
35254        composeUriCore("url", element.getUrlElement(), false);
35255        composeUriExtras("url", element.getUrlElement(), false);
35256      }
35257      if (element.hasVersionElement()) {
35258        composeStringCore("version", element.getVersionElement(), false);
35259        composeStringExtras("version", element.getVersionElement(), false);
35260      }
35261      if (element.hasStatusElement()) {
35262        composeEnumerationCore("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
35263        composeEnumerationExtras("status", element.getStatusElement(), new Contract.ContractStatusEnumFactory(), false);
35264      }
35265      if (element.hasLegalState()) {
35266        composeCodeableConcept("legalState", element.getLegalState());
35267      }
35268      if (element.hasInstantiatesCanonical()) {
35269        composeReference("instantiatesCanonical", element.getInstantiatesCanonical());
35270      }
35271      if (element.hasInstantiatesUriElement()) {
35272        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
35273        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
35274      }
35275      if (element.hasContentDerivative()) {
35276        composeCodeableConcept("contentDerivative", element.getContentDerivative());
35277      }
35278      if (element.hasIssuedElement()) {
35279        composeDateTimeCore("issued", element.getIssuedElement(), false);
35280        composeDateTimeExtras("issued", element.getIssuedElement(), false);
35281      }
35282      if (element.hasApplies()) {
35283        composePeriod("applies", element.getApplies());
35284      }
35285      if (element.hasExpirationType()) {
35286        composeCodeableConcept("expirationType", element.getExpirationType());
35287      }
35288      if (element.hasSubject()) {
35289        openArray("subject");
35290        for (Reference e : element.getSubject()) 
35291          composeReference(null, e);
35292        closeArray();
35293      };
35294      if (element.hasAuthority()) {
35295        openArray("authority");
35296        for (Reference e : element.getAuthority()) 
35297          composeReference(null, e);
35298        closeArray();
35299      };
35300      if (element.hasDomain()) {
35301        openArray("domain");
35302        for (Reference e : element.getDomain()) 
35303          composeReference(null, e);
35304        closeArray();
35305      };
35306      if (element.hasSite()) {
35307        openArray("site");
35308        for (Reference e : element.getSite()) 
35309          composeReference(null, e);
35310        closeArray();
35311      };
35312      if (element.hasNameElement()) {
35313        composeStringCore("name", element.getNameElement(), false);
35314        composeStringExtras("name", element.getNameElement(), false);
35315      }
35316      if (element.hasTitleElement()) {
35317        composeStringCore("title", element.getTitleElement(), false);
35318        composeStringExtras("title", element.getTitleElement(), false);
35319      }
35320      if (element.hasSubtitleElement()) {
35321        composeStringCore("subtitle", element.getSubtitleElement(), false);
35322        composeStringExtras("subtitle", element.getSubtitleElement(), false);
35323      }
35324      if (element.hasAlias()) {
35325        openArray("alias");
35326        for (StringType e : element.getAlias()) 
35327          composeStringCore(null, e, true);
35328        closeArray();
35329        if (anyHasExtras(element.getAlias())) {
35330          openArray("_alias");
35331          for (StringType e : element.getAlias()) 
35332            composeStringExtras(null, e, true);
35333          closeArray();
35334        }
35335      };
35336      if (element.hasAuthor()) {
35337        composeReference("author", element.getAuthor());
35338      }
35339      if (element.hasScope()) {
35340        composeCodeableConcept("scope", element.getScope());
35341      }
35342      if (element.hasTopic()) {
35343        composeType("topic", element.getTopic());
35344      }
35345      if (element.hasType()) {
35346        composeCodeableConcept("type", element.getType());
35347      }
35348      if (element.hasSubType()) {
35349        openArray("subType");
35350        for (CodeableConcept e : element.getSubType()) 
35351          composeCodeableConcept(null, e);
35352        closeArray();
35353      };
35354      if (element.hasContentDefinition()) {
35355        composeContractContentDefinitionComponent("contentDefinition", element.getContentDefinition());
35356      }
35357      if (element.hasTerm()) {
35358        openArray("term");
35359        for (Contract.TermComponent e : element.getTerm()) 
35360          composeContractTermComponent(null, e);
35361        closeArray();
35362      };
35363      if (element.hasSupportingInfo()) {
35364        openArray("supportingInfo");
35365        for (Reference e : element.getSupportingInfo()) 
35366          composeReference(null, e);
35367        closeArray();
35368      };
35369      if (element.hasRelevantHistory()) {
35370        openArray("relevantHistory");
35371        for (Reference e : element.getRelevantHistory()) 
35372          composeReference(null, e);
35373        closeArray();
35374      };
35375      if (element.hasSigner()) {
35376        openArray("signer");
35377        for (Contract.SignatoryComponent e : element.getSigner()) 
35378          composeContractSignatoryComponent(null, e);
35379        closeArray();
35380      };
35381      if (element.hasFriendly()) {
35382        openArray("friendly");
35383        for (Contract.FriendlyLanguageComponent e : element.getFriendly()) 
35384          composeContractFriendlyLanguageComponent(null, e);
35385        closeArray();
35386      };
35387      if (element.hasLegal()) {
35388        openArray("legal");
35389        for (Contract.LegalLanguageComponent e : element.getLegal()) 
35390          composeContractLegalLanguageComponent(null, e);
35391        closeArray();
35392      };
35393      if (element.hasRule()) {
35394        openArray("rule");
35395        for (Contract.ComputableLanguageComponent e : element.getRule()) 
35396          composeContractComputableLanguageComponent(null, e);
35397        closeArray();
35398      };
35399      if (element.hasLegallyBinding()) {
35400        composeType("legallyBinding", element.getLegallyBinding());
35401      }
35402  }
35403
35404  protected void composeContractContentDefinitionComponent(String name, Contract.ContentDefinitionComponent element) throws IOException {
35405    if (element != null) {
35406      open(name);
35407      composeContractContentDefinitionComponentInner(element);
35408      close();
35409    }
35410  }
35411
35412  protected void composeContractContentDefinitionComponentInner(Contract.ContentDefinitionComponent element) throws IOException {
35413      composeBackbone(element);
35414      if (element.hasType()) {
35415        composeCodeableConcept("type", element.getType());
35416      }
35417      if (element.hasSubType()) {
35418        composeCodeableConcept("subType", element.getSubType());
35419      }
35420      if (element.hasPublisher()) {
35421        composeReference("publisher", element.getPublisher());
35422      }
35423      if (element.hasPublicationDateElement()) {
35424        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
35425        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
35426      }
35427      if (element.hasPublicationStatusElement()) {
35428        composeEnumerationCore("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
35429        composeEnumerationExtras("publicationStatus", element.getPublicationStatusElement(), new Contract.ContractPublicationStatusEnumFactory(), false);
35430      }
35431      if (element.hasCopyrightElement()) {
35432        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
35433        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
35434      }
35435  }
35436
35437  protected void composeContractTermComponent(String name, Contract.TermComponent element) throws IOException {
35438    if (element != null) {
35439      open(name);
35440      composeContractTermComponentInner(element);
35441      close();
35442    }
35443  }
35444
35445  protected void composeContractTermComponentInner(Contract.TermComponent element) throws IOException {
35446      composeBackbone(element);
35447      if (element.hasIdentifier()) {
35448        composeIdentifier("identifier", element.getIdentifier());
35449      }
35450      if (element.hasIssuedElement()) {
35451        composeDateTimeCore("issued", element.getIssuedElement(), false);
35452        composeDateTimeExtras("issued", element.getIssuedElement(), false);
35453      }
35454      if (element.hasApplies()) {
35455        composePeriod("applies", element.getApplies());
35456      }
35457      if (element.hasTopic()) {
35458        composeType("topic", element.getTopic());
35459      }
35460      if (element.hasType()) {
35461        composeCodeableConcept("type", element.getType());
35462      }
35463      if (element.hasSubType()) {
35464        composeCodeableConcept("subType", element.getSubType());
35465      }
35466      if (element.hasTextElement()) {
35467        composeStringCore("text", element.getTextElement(), false);
35468        composeStringExtras("text", element.getTextElement(), false);
35469      }
35470      if (element.hasSecurityLabel()) {
35471        openArray("securityLabel");
35472        for (Contract.SecurityLabelComponent e : element.getSecurityLabel()) 
35473          composeContractSecurityLabelComponent(null, e);
35474        closeArray();
35475      };
35476      if (element.hasOffer()) {
35477        composeContractContractOfferComponent("offer", element.getOffer());
35478      }
35479      if (element.hasAsset()) {
35480        openArray("asset");
35481        for (Contract.ContractAssetComponent e : element.getAsset()) 
35482          composeContractContractAssetComponent(null, e);
35483        closeArray();
35484      };
35485      if (element.hasAction()) {
35486        openArray("action");
35487        for (Contract.ActionComponent e : element.getAction()) 
35488          composeContractActionComponent(null, e);
35489        closeArray();
35490      };
35491      if (element.hasGroup()) {
35492        openArray("group");
35493        for (Contract.TermComponent e : element.getGroup()) 
35494          composeContractTermComponent(null, e);
35495        closeArray();
35496      };
35497  }
35498
35499  protected void composeContractSecurityLabelComponent(String name, Contract.SecurityLabelComponent element) throws IOException {
35500    if (element != null) {
35501      open(name);
35502      composeContractSecurityLabelComponentInner(element);
35503      close();
35504    }
35505  }
35506
35507  protected void composeContractSecurityLabelComponentInner(Contract.SecurityLabelComponent element) throws IOException {
35508      composeBackbone(element);
35509      if (element.hasNumber()) {
35510        openArray("number");
35511        for (UnsignedIntType e : element.getNumber()) 
35512          composeUnsignedIntCore(null, e, true);
35513        closeArray();
35514        if (anyHasExtras(element.getNumber())) {
35515          openArray("_number");
35516          for (UnsignedIntType e : element.getNumber()) 
35517            composeUnsignedIntExtras(null, e, true);
35518          closeArray();
35519        }
35520      };
35521      if (element.hasClassification()) {
35522        composeCoding("classification", element.getClassification());
35523      }
35524      if (element.hasCategory()) {
35525        openArray("category");
35526        for (Coding e : element.getCategory()) 
35527          composeCoding(null, e);
35528        closeArray();
35529      };
35530      if (element.hasControl()) {
35531        openArray("control");
35532        for (Coding e : element.getControl()) 
35533          composeCoding(null, e);
35534        closeArray();
35535      };
35536  }
35537
35538  protected void composeContractContractOfferComponent(String name, Contract.ContractOfferComponent element) throws IOException {
35539    if (element != null) {
35540      open(name);
35541      composeContractContractOfferComponentInner(element);
35542      close();
35543    }
35544  }
35545
35546  protected void composeContractContractOfferComponentInner(Contract.ContractOfferComponent element) throws IOException {
35547      composeBackbone(element);
35548      if (element.hasIdentifier()) {
35549        openArray("identifier");
35550        for (Identifier e : element.getIdentifier()) 
35551          composeIdentifier(null, e);
35552        closeArray();
35553      };
35554      if (element.hasParty()) {
35555        openArray("party");
35556        for (Contract.ContractPartyComponent e : element.getParty()) 
35557          composeContractContractPartyComponent(null, e);
35558        closeArray();
35559      };
35560      if (element.hasTopic()) {
35561        composeReference("topic", element.getTopic());
35562      }
35563      if (element.hasType()) {
35564        composeCodeableConcept("type", element.getType());
35565      }
35566      if (element.hasDecision()) {
35567        composeCodeableConcept("decision", element.getDecision());
35568      }
35569      if (element.hasDecisionMode()) {
35570        openArray("decisionMode");
35571        for (CodeableConcept e : element.getDecisionMode()) 
35572          composeCodeableConcept(null, e);
35573        closeArray();
35574      };
35575      if (element.hasAnswer()) {
35576        openArray("answer");
35577        for (Contract.AnswerComponent e : element.getAnswer()) 
35578          composeContractAnswerComponent(null, e);
35579        closeArray();
35580      };
35581      if (element.hasTextElement()) {
35582        composeStringCore("text", element.getTextElement(), false);
35583        composeStringExtras("text", element.getTextElement(), false);
35584      }
35585      if (element.hasLinkId()) {
35586        openArray("linkId");
35587        for (StringType e : element.getLinkId()) 
35588          composeStringCore(null, e, true);
35589        closeArray();
35590        if (anyHasExtras(element.getLinkId())) {
35591          openArray("_linkId");
35592          for (StringType e : element.getLinkId()) 
35593            composeStringExtras(null, e, true);
35594          closeArray();
35595        }
35596      };
35597      if (element.hasSecurityLabelNumber()) {
35598        openArray("securityLabelNumber");
35599        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
35600          composeUnsignedIntCore(null, e, true);
35601        closeArray();
35602        if (anyHasExtras(element.getSecurityLabelNumber())) {
35603          openArray("_securityLabelNumber");
35604          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
35605            composeUnsignedIntExtras(null, e, true);
35606          closeArray();
35607        }
35608      };
35609  }
35610
35611  protected void composeContractContractPartyComponent(String name, Contract.ContractPartyComponent element) throws IOException {
35612    if (element != null) {
35613      open(name);
35614      composeContractContractPartyComponentInner(element);
35615      close();
35616    }
35617  }
35618
35619  protected void composeContractContractPartyComponentInner(Contract.ContractPartyComponent element) throws IOException {
35620      composeBackbone(element);
35621      if (element.hasReference()) {
35622        openArray("reference");
35623        for (Reference e : element.getReference()) 
35624          composeReference(null, e);
35625        closeArray();
35626      };
35627      if (element.hasRole()) {
35628        composeCodeableConcept("role", element.getRole());
35629      }
35630  }
35631
35632  protected void composeContractAnswerComponent(String name, Contract.AnswerComponent element) throws IOException {
35633    if (element != null) {
35634      open(name);
35635      composeContractAnswerComponentInner(element);
35636      close();
35637    }
35638  }
35639
35640  protected void composeContractAnswerComponentInner(Contract.AnswerComponent element) throws IOException {
35641      composeBackbone(element);
35642      if (element.hasValue()) {
35643        composeType("value", element.getValue());
35644      }
35645  }
35646
35647  protected void composeContractContractAssetComponent(String name, Contract.ContractAssetComponent element) throws IOException {
35648    if (element != null) {
35649      open(name);
35650      composeContractContractAssetComponentInner(element);
35651      close();
35652    }
35653  }
35654
35655  protected void composeContractContractAssetComponentInner(Contract.ContractAssetComponent element) throws IOException {
35656      composeBackbone(element);
35657      if (element.hasScope()) {
35658        composeCodeableConcept("scope", element.getScope());
35659      }
35660      if (element.hasType()) {
35661        openArray("type");
35662        for (CodeableConcept e : element.getType()) 
35663          composeCodeableConcept(null, e);
35664        closeArray();
35665      };
35666      if (element.hasTypeReference()) {
35667        openArray("typeReference");
35668        for (Reference e : element.getTypeReference()) 
35669          composeReference(null, e);
35670        closeArray();
35671      };
35672      if (element.hasSubtype()) {
35673        openArray("subtype");
35674        for (CodeableConcept e : element.getSubtype()) 
35675          composeCodeableConcept(null, e);
35676        closeArray();
35677      };
35678      if (element.hasRelationship()) {
35679        composeCoding("relationship", element.getRelationship());
35680      }
35681      if (element.hasContext()) {
35682        openArray("context");
35683        for (Contract.AssetContextComponent e : element.getContext()) 
35684          composeContractAssetContextComponent(null, e);
35685        closeArray();
35686      };
35687      if (element.hasConditionElement()) {
35688        composeStringCore("condition", element.getConditionElement(), false);
35689        composeStringExtras("condition", element.getConditionElement(), false);
35690      }
35691      if (element.hasPeriodType()) {
35692        openArray("periodType");
35693        for (CodeableConcept e : element.getPeriodType()) 
35694          composeCodeableConcept(null, e);
35695        closeArray();
35696      };
35697      if (element.hasPeriod()) {
35698        openArray("period");
35699        for (Period e : element.getPeriod()) 
35700          composePeriod(null, e);
35701        closeArray();
35702      };
35703      if (element.hasUsePeriod()) {
35704        openArray("usePeriod");
35705        for (Period e : element.getUsePeriod()) 
35706          composePeriod(null, e);
35707        closeArray();
35708      };
35709      if (element.hasTextElement()) {
35710        composeStringCore("text", element.getTextElement(), false);
35711        composeStringExtras("text", element.getTextElement(), false);
35712      }
35713      if (element.hasLinkId()) {
35714        openArray("linkId");
35715        for (StringType e : element.getLinkId()) 
35716          composeStringCore(null, e, true);
35717        closeArray();
35718        if (anyHasExtras(element.getLinkId())) {
35719          openArray("_linkId");
35720          for (StringType e : element.getLinkId()) 
35721            composeStringExtras(null, e, true);
35722          closeArray();
35723        }
35724      };
35725      if (element.hasAnswer()) {
35726        openArray("answer");
35727        for (Contract.AnswerComponent e : element.getAnswer()) 
35728          composeContractAnswerComponent(null, e);
35729        closeArray();
35730      };
35731      if (element.hasSecurityLabelNumber()) {
35732        openArray("securityLabelNumber");
35733        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
35734          composeUnsignedIntCore(null, e, true);
35735        closeArray();
35736        if (anyHasExtras(element.getSecurityLabelNumber())) {
35737          openArray("_securityLabelNumber");
35738          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
35739            composeUnsignedIntExtras(null, e, true);
35740          closeArray();
35741        }
35742      };
35743      if (element.hasValuedItem()) {
35744        openArray("valuedItem");
35745        for (Contract.ValuedItemComponent e : element.getValuedItem()) 
35746          composeContractValuedItemComponent(null, e);
35747        closeArray();
35748      };
35749  }
35750
35751  protected void composeContractAssetContextComponent(String name, Contract.AssetContextComponent element) throws IOException {
35752    if (element != null) {
35753      open(name);
35754      composeContractAssetContextComponentInner(element);
35755      close();
35756    }
35757  }
35758
35759  protected void composeContractAssetContextComponentInner(Contract.AssetContextComponent element) throws IOException {
35760      composeBackbone(element);
35761      if (element.hasReference()) {
35762        composeReference("reference", element.getReference());
35763      }
35764      if (element.hasCode()) {
35765        openArray("code");
35766        for (CodeableConcept e : element.getCode()) 
35767          composeCodeableConcept(null, e);
35768        closeArray();
35769      };
35770      if (element.hasTextElement()) {
35771        composeStringCore("text", element.getTextElement(), false);
35772        composeStringExtras("text", element.getTextElement(), false);
35773      }
35774  }
35775
35776  protected void composeContractValuedItemComponent(String name, Contract.ValuedItemComponent element) throws IOException {
35777    if (element != null) {
35778      open(name);
35779      composeContractValuedItemComponentInner(element);
35780      close();
35781    }
35782  }
35783
35784  protected void composeContractValuedItemComponentInner(Contract.ValuedItemComponent element) throws IOException {
35785      composeBackbone(element);
35786      if (element.hasEntity()) {
35787        composeType("entity", element.getEntity());
35788      }
35789      if (element.hasIdentifier()) {
35790        composeIdentifier("identifier", element.getIdentifier());
35791      }
35792      if (element.hasEffectiveTimeElement()) {
35793        composeDateTimeCore("effectiveTime", element.getEffectiveTimeElement(), false);
35794        composeDateTimeExtras("effectiveTime", element.getEffectiveTimeElement(), false);
35795      }
35796      if (element.hasQuantity()) {
35797        composeQuantity("quantity", element.getQuantity());
35798      }
35799      if (element.hasUnitPrice()) {
35800        composeMoney("unitPrice", element.getUnitPrice());
35801      }
35802      if (element.hasFactorElement()) {
35803        composeDecimalCore("factor", element.getFactorElement(), false);
35804        composeDecimalExtras("factor", element.getFactorElement(), false);
35805      }
35806      if (element.hasPointsElement()) {
35807        composeDecimalCore("points", element.getPointsElement(), false);
35808        composeDecimalExtras("points", element.getPointsElement(), false);
35809      }
35810      if (element.hasNet()) {
35811        composeMoney("net", element.getNet());
35812      }
35813      if (element.hasPaymentElement()) {
35814        composeStringCore("payment", element.getPaymentElement(), false);
35815        composeStringExtras("payment", element.getPaymentElement(), false);
35816      }
35817      if (element.hasPaymentDateElement()) {
35818        composeDateTimeCore("paymentDate", element.getPaymentDateElement(), false);
35819        composeDateTimeExtras("paymentDate", element.getPaymentDateElement(), false);
35820      }
35821      if (element.hasResponsible()) {
35822        composeReference("responsible", element.getResponsible());
35823      }
35824      if (element.hasRecipient()) {
35825        composeReference("recipient", element.getRecipient());
35826      }
35827      if (element.hasLinkId()) {
35828        openArray("linkId");
35829        for (StringType e : element.getLinkId()) 
35830          composeStringCore(null, e, true);
35831        closeArray();
35832        if (anyHasExtras(element.getLinkId())) {
35833          openArray("_linkId");
35834          for (StringType e : element.getLinkId()) 
35835            composeStringExtras(null, e, true);
35836          closeArray();
35837        }
35838      };
35839      if (element.hasSecurityLabelNumber()) {
35840        openArray("securityLabelNumber");
35841        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
35842          composeUnsignedIntCore(null, e, true);
35843        closeArray();
35844        if (anyHasExtras(element.getSecurityLabelNumber())) {
35845          openArray("_securityLabelNumber");
35846          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
35847            composeUnsignedIntExtras(null, e, true);
35848          closeArray();
35849        }
35850      };
35851  }
35852
35853  protected void composeContractActionComponent(String name, Contract.ActionComponent element) throws IOException {
35854    if (element != null) {
35855      open(name);
35856      composeContractActionComponentInner(element);
35857      close();
35858    }
35859  }
35860
35861  protected void composeContractActionComponentInner(Contract.ActionComponent element) throws IOException {
35862      composeBackbone(element);
35863      if (element.hasDoNotPerformElement()) {
35864        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
35865        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
35866      }
35867      if (element.hasType()) {
35868        composeCodeableConcept("type", element.getType());
35869      }
35870      if (element.hasSubject()) {
35871        openArray("subject");
35872        for (Contract.ActionSubjectComponent e : element.getSubject()) 
35873          composeContractActionSubjectComponent(null, e);
35874        closeArray();
35875      };
35876      if (element.hasIntent()) {
35877        composeCodeableConcept("intent", element.getIntent());
35878      }
35879      if (element.hasLinkId()) {
35880        openArray("linkId");
35881        for (StringType e : element.getLinkId()) 
35882          composeStringCore(null, e, true);
35883        closeArray();
35884        if (anyHasExtras(element.getLinkId())) {
35885          openArray("_linkId");
35886          for (StringType e : element.getLinkId()) 
35887            composeStringExtras(null, e, true);
35888          closeArray();
35889        }
35890      };
35891      if (element.hasStatus()) {
35892        composeCodeableConcept("status", element.getStatus());
35893      }
35894      if (element.hasContext()) {
35895        composeReference("context", element.getContext());
35896      }
35897      if (element.hasContextLinkId()) {
35898        openArray("contextLinkId");
35899        for (StringType e : element.getContextLinkId()) 
35900          composeStringCore(null, e, true);
35901        closeArray();
35902        if (anyHasExtras(element.getContextLinkId())) {
35903          openArray("_contextLinkId");
35904          for (StringType e : element.getContextLinkId()) 
35905            composeStringExtras(null, e, true);
35906          closeArray();
35907        }
35908      };
35909      if (element.hasOccurrence()) {
35910        composeType("occurrence", element.getOccurrence());
35911      }
35912      if (element.hasRequester()) {
35913        openArray("requester");
35914        for (Reference e : element.getRequester()) 
35915          composeReference(null, e);
35916        closeArray();
35917      };
35918      if (element.hasRequesterLinkId()) {
35919        openArray("requesterLinkId");
35920        for (StringType e : element.getRequesterLinkId()) 
35921          composeStringCore(null, e, true);
35922        closeArray();
35923        if (anyHasExtras(element.getRequesterLinkId())) {
35924          openArray("_requesterLinkId");
35925          for (StringType e : element.getRequesterLinkId()) 
35926            composeStringExtras(null, e, true);
35927          closeArray();
35928        }
35929      };
35930      if (element.hasPerformerType()) {
35931        openArray("performerType");
35932        for (CodeableConcept e : element.getPerformerType()) 
35933          composeCodeableConcept(null, e);
35934        closeArray();
35935      };
35936      if (element.hasPerformerRole()) {
35937        composeCodeableConcept("performerRole", element.getPerformerRole());
35938      }
35939      if (element.hasPerformer()) {
35940        composeReference("performer", element.getPerformer());
35941      }
35942      if (element.hasPerformerLinkId()) {
35943        openArray("performerLinkId");
35944        for (StringType e : element.getPerformerLinkId()) 
35945          composeStringCore(null, e, true);
35946        closeArray();
35947        if (anyHasExtras(element.getPerformerLinkId())) {
35948          openArray("_performerLinkId");
35949          for (StringType e : element.getPerformerLinkId()) 
35950            composeStringExtras(null, e, true);
35951          closeArray();
35952        }
35953      };
35954      if (element.hasReasonCode()) {
35955        openArray("reasonCode");
35956        for (CodeableConcept e : element.getReasonCode()) 
35957          composeCodeableConcept(null, e);
35958        closeArray();
35959      };
35960      if (element.hasReasonReference()) {
35961        openArray("reasonReference");
35962        for (Reference e : element.getReasonReference()) 
35963          composeReference(null, e);
35964        closeArray();
35965      };
35966      if (element.hasReason()) {
35967        openArray("reason");
35968        for (StringType e : element.getReason()) 
35969          composeStringCore(null, e, true);
35970        closeArray();
35971        if (anyHasExtras(element.getReason())) {
35972          openArray("_reason");
35973          for (StringType e : element.getReason()) 
35974            composeStringExtras(null, e, true);
35975          closeArray();
35976        }
35977      };
35978      if (element.hasReasonLinkId()) {
35979        openArray("reasonLinkId");
35980        for (StringType e : element.getReasonLinkId()) 
35981          composeStringCore(null, e, true);
35982        closeArray();
35983        if (anyHasExtras(element.getReasonLinkId())) {
35984          openArray("_reasonLinkId");
35985          for (StringType e : element.getReasonLinkId()) 
35986            composeStringExtras(null, e, true);
35987          closeArray();
35988        }
35989      };
35990      if (element.hasNote()) {
35991        openArray("note");
35992        for (Annotation e : element.getNote()) 
35993          composeAnnotation(null, e);
35994        closeArray();
35995      };
35996      if (element.hasSecurityLabelNumber()) {
35997        openArray("securityLabelNumber");
35998        for (UnsignedIntType e : element.getSecurityLabelNumber()) 
35999          composeUnsignedIntCore(null, e, true);
36000        closeArray();
36001        if (anyHasExtras(element.getSecurityLabelNumber())) {
36002          openArray("_securityLabelNumber");
36003          for (UnsignedIntType e : element.getSecurityLabelNumber()) 
36004            composeUnsignedIntExtras(null, e, true);
36005          closeArray();
36006        }
36007      };
36008  }
36009
36010  protected void composeContractActionSubjectComponent(String name, Contract.ActionSubjectComponent element) throws IOException {
36011    if (element != null) {
36012      open(name);
36013      composeContractActionSubjectComponentInner(element);
36014      close();
36015    }
36016  }
36017
36018  protected void composeContractActionSubjectComponentInner(Contract.ActionSubjectComponent element) throws IOException {
36019      composeBackbone(element);
36020      if (element.hasReference()) {
36021        openArray("reference");
36022        for (Reference e : element.getReference()) 
36023          composeReference(null, e);
36024        closeArray();
36025      };
36026      if (element.hasRole()) {
36027        composeCodeableConcept("role", element.getRole());
36028      }
36029  }
36030
36031  protected void composeContractSignatoryComponent(String name, Contract.SignatoryComponent element) throws IOException {
36032    if (element != null) {
36033      open(name);
36034      composeContractSignatoryComponentInner(element);
36035      close();
36036    }
36037  }
36038
36039  protected void composeContractSignatoryComponentInner(Contract.SignatoryComponent element) throws IOException {
36040      composeBackbone(element);
36041      if (element.hasType()) {
36042        composeCoding("type", element.getType());
36043      }
36044      if (element.hasParty()) {
36045        composeReference("party", element.getParty());
36046      }
36047      if (element.hasSignature()) {
36048        openArray("signature");
36049        for (Signature e : element.getSignature()) 
36050          composeSignature(null, e);
36051        closeArray();
36052      };
36053  }
36054
36055  protected void composeContractFriendlyLanguageComponent(String name, Contract.FriendlyLanguageComponent element) throws IOException {
36056    if (element != null) {
36057      open(name);
36058      composeContractFriendlyLanguageComponentInner(element);
36059      close();
36060    }
36061  }
36062
36063  protected void composeContractFriendlyLanguageComponentInner(Contract.FriendlyLanguageComponent element) throws IOException {
36064      composeBackbone(element);
36065      if (element.hasContent()) {
36066        composeType("content", element.getContent());
36067      }
36068  }
36069
36070  protected void composeContractLegalLanguageComponent(String name, Contract.LegalLanguageComponent element) throws IOException {
36071    if (element != null) {
36072      open(name);
36073      composeContractLegalLanguageComponentInner(element);
36074      close();
36075    }
36076  }
36077
36078  protected void composeContractLegalLanguageComponentInner(Contract.LegalLanguageComponent element) throws IOException {
36079      composeBackbone(element);
36080      if (element.hasContent()) {
36081        composeType("content", element.getContent());
36082      }
36083  }
36084
36085  protected void composeContractComputableLanguageComponent(String name, Contract.ComputableLanguageComponent element) throws IOException {
36086    if (element != null) {
36087      open(name);
36088      composeContractComputableLanguageComponentInner(element);
36089      close();
36090    }
36091  }
36092
36093  protected void composeContractComputableLanguageComponentInner(Contract.ComputableLanguageComponent element) throws IOException {
36094      composeBackbone(element);
36095      if (element.hasContent()) {
36096        composeType("content", element.getContent());
36097      }
36098  }
36099
36100  protected void composeCoverage(String name, Coverage element) throws IOException {
36101    if (element != null) {
36102      prop("resourceType", name);
36103      composeCoverageInner(element);
36104    }
36105  }
36106
36107  protected void composeCoverageInner(Coverage element) throws IOException {
36108      composeDomainResourceElements(element);
36109      if (element.hasIdentifier()) {
36110        openArray("identifier");
36111        for (Identifier e : element.getIdentifier()) 
36112          composeIdentifier(null, e);
36113        closeArray();
36114      };
36115      if (element.hasStatusElement()) {
36116        composeEnumerationCore("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
36117        composeEnumerationExtras("status", element.getStatusElement(), new Coverage.CoverageStatusEnumFactory(), false);
36118      }
36119      if (element.hasType()) {
36120        composeCodeableConcept("type", element.getType());
36121      }
36122      if (element.hasPolicyHolder()) {
36123        composeReference("policyHolder", element.getPolicyHolder());
36124      }
36125      if (element.hasSubscriber()) {
36126        composeReference("subscriber", element.getSubscriber());
36127      }
36128      if (element.hasSubscriberIdElement()) {
36129        composeStringCore("subscriberId", element.getSubscriberIdElement(), false);
36130        composeStringExtras("subscriberId", element.getSubscriberIdElement(), false);
36131      }
36132      if (element.hasBeneficiary()) {
36133        composeReference("beneficiary", element.getBeneficiary());
36134      }
36135      if (element.hasDependentElement()) {
36136        composeStringCore("dependent", element.getDependentElement(), false);
36137        composeStringExtras("dependent", element.getDependentElement(), false);
36138      }
36139      if (element.hasRelationship()) {
36140        composeCodeableConcept("relationship", element.getRelationship());
36141      }
36142      if (element.hasPeriod()) {
36143        composePeriod("period", element.getPeriod());
36144      }
36145      if (element.hasPayor()) {
36146        openArray("payor");
36147        for (Reference e : element.getPayor()) 
36148          composeReference(null, e);
36149        closeArray();
36150      };
36151      if (element.hasClass_()) {
36152        openArray("class");
36153        for (Coverage.ClassComponent e : element.getClass_()) 
36154          composeCoverageClassComponent(null, e);
36155        closeArray();
36156      };
36157      if (element.hasOrderElement()) {
36158        composePositiveIntCore("order", element.getOrderElement(), false);
36159        composePositiveIntExtras("order", element.getOrderElement(), false);
36160      }
36161      if (element.hasNetworkElement()) {
36162        composeStringCore("network", element.getNetworkElement(), false);
36163        composeStringExtras("network", element.getNetworkElement(), false);
36164      }
36165      if (element.hasCopay()) {
36166        openArray("copay");
36167        for (Coverage.CoPayComponent e : element.getCopay()) 
36168          composeCoverageCoPayComponent(null, e);
36169        closeArray();
36170      };
36171      if (element.hasContract()) {
36172        openArray("contract");
36173        for (Reference e : element.getContract()) 
36174          composeReference(null, e);
36175        closeArray();
36176      };
36177  }
36178
36179  protected void composeCoverageClassComponent(String name, Coverage.ClassComponent element) throws IOException {
36180    if (element != null) {
36181      open(name);
36182      composeCoverageClassComponentInner(element);
36183      close();
36184    }
36185  }
36186
36187  protected void composeCoverageClassComponentInner(Coverage.ClassComponent element) throws IOException {
36188      composeBackbone(element);
36189      if (element.hasType()) {
36190        composeCoding("type", element.getType());
36191      }
36192      if (element.hasValueElement()) {
36193        composeStringCore("value", element.getValueElement(), false);
36194        composeStringExtras("value", element.getValueElement(), false);
36195      }
36196      if (element.hasNameElement()) {
36197        composeStringCore("name", element.getNameElement(), false);
36198        composeStringExtras("name", element.getNameElement(), false);
36199      }
36200  }
36201
36202  protected void composeCoverageCoPayComponent(String name, Coverage.CoPayComponent element) throws IOException {
36203    if (element != null) {
36204      open(name);
36205      composeCoverageCoPayComponentInner(element);
36206      close();
36207    }
36208  }
36209
36210  protected void composeCoverageCoPayComponentInner(Coverage.CoPayComponent element) throws IOException {
36211      composeBackbone(element);
36212      if (element.hasType()) {
36213        composeCoding("type", element.getType());
36214      }
36215      if (element.hasValue()) {
36216        composeQuantity("value", element.getValue());
36217      }
36218  }
36219
36220  protected void composeCoverageEligibilityRequest(String name, CoverageEligibilityRequest element) throws IOException {
36221    if (element != null) {
36222      prop("resourceType", name);
36223      composeCoverageEligibilityRequestInner(element);
36224    }
36225  }
36226
36227  protected void composeCoverageEligibilityRequestInner(CoverageEligibilityRequest element) throws IOException {
36228      composeDomainResourceElements(element);
36229      if (element.hasIdentifier()) {
36230        openArray("identifier");
36231        for (Identifier e : element.getIdentifier()) 
36232          composeIdentifier(null, e);
36233        closeArray();
36234      };
36235      if (element.hasStatusElement()) {
36236        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
36237        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityRequest.EligibilityRequestStatusEnumFactory(), false);
36238      }
36239      if (element.hasPriority()) {
36240        composeCodeableConcept("priority", element.getPriority());
36241      }
36242      if (element.hasPurpose()) {
36243        openArray("purpose");
36244        for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
36245          composeEnumerationCore(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
36246        closeArray();
36247        if (anyHasExtras(element.getPurpose())) {
36248          openArray("_purpose");
36249          for (Enumeration<CoverageEligibilityRequest.EligibilityRequestPurpose> e : element.getPurpose()) 
36250            composeEnumerationExtras(null, e, new CoverageEligibilityRequest.EligibilityRequestPurposeEnumFactory(), true);
36251          closeArray();
36252        }
36253      };
36254      if (element.hasPatient()) {
36255        composeReference("patient", element.getPatient());
36256      }
36257      if (element.hasServiced()) {
36258        composeType("serviced", element.getServiced());
36259      }
36260      if (element.hasCreatedElement()) {
36261        composeDateTimeCore("created", element.getCreatedElement(), false);
36262        composeDateTimeExtras("created", element.getCreatedElement(), false);
36263      }
36264      if (element.hasEnterer()) {
36265        composeReference("enterer", element.getEnterer());
36266      }
36267      if (element.hasProvider()) {
36268        composeReference("provider", element.getProvider());
36269      }
36270      if (element.hasInsurer()) {
36271        composeReference("insurer", element.getInsurer());
36272      }
36273      if (element.hasFacility()) {
36274        composeReference("facility", element.getFacility());
36275      }
36276      if (element.hasSupportingInformation()) {
36277        openArray("supportingInformation");
36278        for (CoverageEligibilityRequest.InformationComponent e : element.getSupportingInformation()) 
36279          composeCoverageEligibilityRequestInformationComponent(null, e);
36280        closeArray();
36281      };
36282      if (element.hasInsurance()) {
36283        openArray("insurance");
36284        for (CoverageEligibilityRequest.InsuranceComponent e : element.getInsurance()) 
36285          composeCoverageEligibilityRequestInsuranceComponent(null, e);
36286        closeArray();
36287      };
36288      if (element.hasItem()) {
36289        openArray("item");
36290        for (CoverageEligibilityRequest.DetailsComponent e : element.getItem()) 
36291          composeCoverageEligibilityRequestDetailsComponent(null, e);
36292        closeArray();
36293      };
36294  }
36295
36296  protected void composeCoverageEligibilityRequestInformationComponent(String name, CoverageEligibilityRequest.InformationComponent element) throws IOException {
36297    if (element != null) {
36298      open(name);
36299      composeCoverageEligibilityRequestInformationComponentInner(element);
36300      close();
36301    }
36302  }
36303
36304  protected void composeCoverageEligibilityRequestInformationComponentInner(CoverageEligibilityRequest.InformationComponent element) throws IOException {
36305      composeBackbone(element);
36306      if (element.hasSequenceElement()) {
36307        composePositiveIntCore("sequence", element.getSequenceElement(), false);
36308        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
36309      }
36310      if (element.hasInformation()) {
36311        composeReference("information", element.getInformation());
36312      }
36313      if (element.hasAppliesToAllElement()) {
36314        composeBooleanCore("appliesToAll", element.getAppliesToAllElement(), false);
36315        composeBooleanExtras("appliesToAll", element.getAppliesToAllElement(), false);
36316      }
36317  }
36318
36319  protected void composeCoverageEligibilityRequestInsuranceComponent(String name, CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
36320    if (element != null) {
36321      open(name);
36322      composeCoverageEligibilityRequestInsuranceComponentInner(element);
36323      close();
36324    }
36325  }
36326
36327  protected void composeCoverageEligibilityRequestInsuranceComponentInner(CoverageEligibilityRequest.InsuranceComponent element) throws IOException {
36328      composeBackbone(element);
36329      if (element.hasFocalElement()) {
36330        composeBooleanCore("focal", element.getFocalElement(), false);
36331        composeBooleanExtras("focal", element.getFocalElement(), false);
36332      }
36333      if (element.hasCoverage()) {
36334        composeReference("coverage", element.getCoverage());
36335      }
36336      if (element.hasBusinessArrangementElement()) {
36337        composeStringCore("businessArrangement", element.getBusinessArrangementElement(), false);
36338        composeStringExtras("businessArrangement", element.getBusinessArrangementElement(), false);
36339      }
36340  }
36341
36342  protected void composeCoverageEligibilityRequestDetailsComponent(String name, CoverageEligibilityRequest.DetailsComponent element) throws IOException {
36343    if (element != null) {
36344      open(name);
36345      composeCoverageEligibilityRequestDetailsComponentInner(element);
36346      close();
36347    }
36348  }
36349
36350  protected void composeCoverageEligibilityRequestDetailsComponentInner(CoverageEligibilityRequest.DetailsComponent element) throws IOException {
36351      composeBackbone(element);
36352      if (element.hasSupportingInformationSequence()) {
36353        openArray("supportingInformationSequence");
36354        for (PositiveIntType e : element.getSupportingInformationSequence()) 
36355          composePositiveIntCore(null, e, true);
36356        closeArray();
36357        if (anyHasExtras(element.getSupportingInformationSequence())) {
36358          openArray("_supportingInformationSequence");
36359          for (PositiveIntType e : element.getSupportingInformationSequence()) 
36360            composePositiveIntExtras(null, e, true);
36361          closeArray();
36362        }
36363      };
36364      if (element.hasCategory()) {
36365        composeCodeableConcept("category", element.getCategory());
36366      }
36367      if (element.hasBillcode()) {
36368        composeCodeableConcept("billcode", element.getBillcode());
36369      }
36370      if (element.hasModifier()) {
36371        openArray("modifier");
36372        for (CodeableConcept e : element.getModifier()) 
36373          composeCodeableConcept(null, e);
36374        closeArray();
36375      };
36376      if (element.hasProvider()) {
36377        composeReference("provider", element.getProvider());
36378      }
36379      if (element.hasQuantity()) {
36380        composeQuantity("quantity", element.getQuantity());
36381      }
36382      if (element.hasUnitPrice()) {
36383        composeMoney("unitPrice", element.getUnitPrice());
36384      }
36385      if (element.hasFacility()) {
36386        composeReference("facility", element.getFacility());
36387      }
36388      if (element.hasDiagnosis()) {
36389        openArray("diagnosis");
36390        for (CoverageEligibilityRequest.DiagnosisComponent e : element.getDiagnosis()) 
36391          composeCoverageEligibilityRequestDiagnosisComponent(null, e);
36392        closeArray();
36393      };
36394      if (element.hasDetail()) {
36395        openArray("detail");
36396        for (Reference e : element.getDetail()) 
36397          composeReference(null, e);
36398        closeArray();
36399      };
36400  }
36401
36402  protected void composeCoverageEligibilityRequestDiagnosisComponent(String name, CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
36403    if (element != null) {
36404      open(name);
36405      composeCoverageEligibilityRequestDiagnosisComponentInner(element);
36406      close();
36407    }
36408  }
36409
36410  protected void composeCoverageEligibilityRequestDiagnosisComponentInner(CoverageEligibilityRequest.DiagnosisComponent element) throws IOException {
36411      composeBackbone(element);
36412      if (element.hasDiagnosis()) {
36413        composeType("diagnosis", element.getDiagnosis());
36414      }
36415  }
36416
36417  protected void composeCoverageEligibilityResponse(String name, CoverageEligibilityResponse element) throws IOException {
36418    if (element != null) {
36419      prop("resourceType", name);
36420      composeCoverageEligibilityResponseInner(element);
36421    }
36422  }
36423
36424  protected void composeCoverageEligibilityResponseInner(CoverageEligibilityResponse element) throws IOException {
36425      composeDomainResourceElements(element);
36426      if (element.hasIdentifier()) {
36427        openArray("identifier");
36428        for (Identifier e : element.getIdentifier()) 
36429          composeIdentifier(null, e);
36430        closeArray();
36431      };
36432      if (element.hasStatusElement()) {
36433        composeEnumerationCore("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
36434        composeEnumerationExtras("status", element.getStatusElement(), new CoverageEligibilityResponse.EligibilityResponseStatusEnumFactory(), false);
36435      }
36436      if (element.hasPurpose()) {
36437        openArray("purpose");
36438        for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
36439          composeEnumerationCore(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
36440        closeArray();
36441        if (anyHasExtras(element.getPurpose())) {
36442          openArray("_purpose");
36443          for (Enumeration<CoverageEligibilityResponse.EligibilityResponsePurpose> e : element.getPurpose()) 
36444            composeEnumerationExtras(null, e, new CoverageEligibilityResponse.EligibilityResponsePurposeEnumFactory(), true);
36445          closeArray();
36446        }
36447      };
36448      if (element.hasPatient()) {
36449        composeReference("patient", element.getPatient());
36450      }
36451      if (element.hasServiced()) {
36452        composeType("serviced", element.getServiced());
36453      }
36454      if (element.hasCreatedElement()) {
36455        composeDateTimeCore("created", element.getCreatedElement(), false);
36456        composeDateTimeExtras("created", element.getCreatedElement(), false);
36457      }
36458      if (element.hasRequestProvider()) {
36459        composeReference("requestProvider", element.getRequestProvider());
36460      }
36461      if (element.hasRequest()) {
36462        composeReference("request", element.getRequest());
36463      }
36464      if (element.hasOutcomeElement()) {
36465        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
36466        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
36467      }
36468      if (element.hasDispositionElement()) {
36469        composeStringCore("disposition", element.getDispositionElement(), false);
36470        composeStringExtras("disposition", element.getDispositionElement(), false);
36471      }
36472      if (element.hasInsurer()) {
36473        composeReference("insurer", element.getInsurer());
36474      }
36475      if (element.hasInsurance()) {
36476        openArray("insurance");
36477        for (CoverageEligibilityResponse.InsuranceComponent e : element.getInsurance()) 
36478          composeCoverageEligibilityResponseInsuranceComponent(null, e);
36479        closeArray();
36480      };
36481      if (element.hasPreAuthRefElement()) {
36482        composeStringCore("preAuthRef", element.getPreAuthRefElement(), false);
36483        composeStringExtras("preAuthRef", element.getPreAuthRefElement(), false);
36484      }
36485      if (element.hasForm()) {
36486        composeCodeableConcept("form", element.getForm());
36487      }
36488      if (element.hasError()) {
36489        openArray("error");
36490        for (CoverageEligibilityResponse.ErrorsComponent e : element.getError()) 
36491          composeCoverageEligibilityResponseErrorsComponent(null, e);
36492        closeArray();
36493      };
36494  }
36495
36496  protected void composeCoverageEligibilityResponseInsuranceComponent(String name, CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
36497    if (element != null) {
36498      open(name);
36499      composeCoverageEligibilityResponseInsuranceComponentInner(element);
36500      close();
36501    }
36502  }
36503
36504  protected void composeCoverageEligibilityResponseInsuranceComponentInner(CoverageEligibilityResponse.InsuranceComponent element) throws IOException {
36505      composeBackbone(element);
36506      if (element.hasCoverage()) {
36507        composeReference("coverage", element.getCoverage());
36508      }
36509      if (element.hasContract()) {
36510        composeReference("contract", element.getContract());
36511      }
36512      if (element.hasInforceElement()) {
36513        composeBooleanCore("inforce", element.getInforceElement(), false);
36514        composeBooleanExtras("inforce", element.getInforceElement(), false);
36515      }
36516      if (element.hasItem()) {
36517        openArray("item");
36518        for (CoverageEligibilityResponse.ItemsComponent e : element.getItem()) 
36519          composeCoverageEligibilityResponseItemsComponent(null, e);
36520        closeArray();
36521      };
36522  }
36523
36524  protected void composeCoverageEligibilityResponseItemsComponent(String name, CoverageEligibilityResponse.ItemsComponent element) throws IOException {
36525    if (element != null) {
36526      open(name);
36527      composeCoverageEligibilityResponseItemsComponentInner(element);
36528      close();
36529    }
36530  }
36531
36532  protected void composeCoverageEligibilityResponseItemsComponentInner(CoverageEligibilityResponse.ItemsComponent element) throws IOException {
36533      composeBackbone(element);
36534      if (element.hasCategory()) {
36535        composeCodeableConcept("category", element.getCategory());
36536      }
36537      if (element.hasBillcode()) {
36538        composeCodeableConcept("billcode", element.getBillcode());
36539      }
36540      if (element.hasModifier()) {
36541        openArray("modifier");
36542        for (CodeableConcept e : element.getModifier()) 
36543          composeCodeableConcept(null, e);
36544        closeArray();
36545      };
36546      if (element.hasProvider()) {
36547        composeReference("provider", element.getProvider());
36548      }
36549      if (element.hasExcludedElement()) {
36550        composeBooleanCore("excluded", element.getExcludedElement(), false);
36551        composeBooleanExtras("excluded", element.getExcludedElement(), false);
36552      }
36553      if (element.hasNameElement()) {
36554        composeStringCore("name", element.getNameElement(), false);
36555        composeStringExtras("name", element.getNameElement(), false);
36556      }
36557      if (element.hasDescriptionElement()) {
36558        composeStringCore("description", element.getDescriptionElement(), false);
36559        composeStringExtras("description", element.getDescriptionElement(), false);
36560      }
36561      if (element.hasNetwork()) {
36562        composeCodeableConcept("network", element.getNetwork());
36563      }
36564      if (element.hasUnit()) {
36565        composeCodeableConcept("unit", element.getUnit());
36566      }
36567      if (element.hasTerm()) {
36568        composeCodeableConcept("term", element.getTerm());
36569      }
36570      if (element.hasBenefit()) {
36571        openArray("benefit");
36572        for (CoverageEligibilityResponse.BenefitComponent e : element.getBenefit()) 
36573          composeCoverageEligibilityResponseBenefitComponent(null, e);
36574        closeArray();
36575      };
36576      if (element.hasAuthorizationRequiredElement()) {
36577        composeBooleanCore("authorizationRequired", element.getAuthorizationRequiredElement(), false);
36578        composeBooleanExtras("authorizationRequired", element.getAuthorizationRequiredElement(), false);
36579      }
36580      if (element.hasAuthorizationSupporting()) {
36581        openArray("authorizationSupporting");
36582        for (CodeableConcept e : element.getAuthorizationSupporting()) 
36583          composeCodeableConcept(null, e);
36584        closeArray();
36585      };
36586      if (element.hasAuthorizationUrlElement()) {
36587        composeUriCore("authorizationUrl", element.getAuthorizationUrlElement(), false);
36588        composeUriExtras("authorizationUrl", element.getAuthorizationUrlElement(), false);
36589      }
36590  }
36591
36592  protected void composeCoverageEligibilityResponseBenefitComponent(String name, CoverageEligibilityResponse.BenefitComponent element) throws IOException {
36593    if (element != null) {
36594      open(name);
36595      composeCoverageEligibilityResponseBenefitComponentInner(element);
36596      close();
36597    }
36598  }
36599
36600  protected void composeCoverageEligibilityResponseBenefitComponentInner(CoverageEligibilityResponse.BenefitComponent element) throws IOException {
36601      composeBackbone(element);
36602      if (element.hasType()) {
36603        composeCodeableConcept("type", element.getType());
36604      }
36605      if (element.hasAllowed()) {
36606        composeType("allowed", element.getAllowed());
36607      }
36608      if (element.hasUsed()) {
36609        composeType("used", element.getUsed());
36610      }
36611  }
36612
36613  protected void composeCoverageEligibilityResponseErrorsComponent(String name, CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
36614    if (element != null) {
36615      open(name);
36616      composeCoverageEligibilityResponseErrorsComponentInner(element);
36617      close();
36618    }
36619  }
36620
36621  protected void composeCoverageEligibilityResponseErrorsComponentInner(CoverageEligibilityResponse.ErrorsComponent element) throws IOException {
36622      composeBackbone(element);
36623      if (element.hasCode()) {
36624        composeCodeableConcept("code", element.getCode());
36625      }
36626  }
36627
36628  protected void composeDetectedIssue(String name, DetectedIssue element) throws IOException {
36629    if (element != null) {
36630      prop("resourceType", name);
36631      composeDetectedIssueInner(element);
36632    }
36633  }
36634
36635  protected void composeDetectedIssueInner(DetectedIssue element) throws IOException {
36636      composeDomainResourceElements(element);
36637      if (element.hasIdentifier()) {
36638        openArray("identifier");
36639        for (Identifier e : element.getIdentifier()) 
36640          composeIdentifier(null, e);
36641        closeArray();
36642      };
36643      if (element.hasStatusElement()) {
36644        composeEnumerationCore("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
36645        composeEnumerationExtras("status", element.getStatusElement(), new DetectedIssue.DetectedIssueStatusEnumFactory(), false);
36646      }
36647      if (element.hasCategory()) {
36648        composeCodeableConcept("category", element.getCategory());
36649      }
36650      if (element.hasSeverityElement()) {
36651        composeEnumerationCore("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
36652        composeEnumerationExtras("severity", element.getSeverityElement(), new DetectedIssue.DetectedIssueSeverityEnumFactory(), false);
36653      }
36654      if (element.hasPatient()) {
36655        composeReference("patient", element.getPatient());
36656      }
36657      if (element.hasDateElement()) {
36658        composeDateTimeCore("date", element.getDateElement(), false);
36659        composeDateTimeExtras("date", element.getDateElement(), false);
36660      }
36661      if (element.hasAuthor()) {
36662        composeReference("author", element.getAuthor());
36663      }
36664      if (element.hasImplicated()) {
36665        openArray("implicated");
36666        for (Reference e : element.getImplicated()) 
36667          composeReference(null, e);
36668        closeArray();
36669      };
36670      if (element.hasDetailElement()) {
36671        composeStringCore("detail", element.getDetailElement(), false);
36672        composeStringExtras("detail", element.getDetailElement(), false);
36673      }
36674      if (element.hasReferenceElement()) {
36675        composeUriCore("reference", element.getReferenceElement(), false);
36676        composeUriExtras("reference", element.getReferenceElement(), false);
36677      }
36678      if (element.hasMitigation()) {
36679        openArray("mitigation");
36680        for (DetectedIssue.DetectedIssueMitigationComponent e : element.getMitigation()) 
36681          composeDetectedIssueDetectedIssueMitigationComponent(null, e);
36682        closeArray();
36683      };
36684  }
36685
36686  protected void composeDetectedIssueDetectedIssueMitigationComponent(String name, DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
36687    if (element != null) {
36688      open(name);
36689      composeDetectedIssueDetectedIssueMitigationComponentInner(element);
36690      close();
36691    }
36692  }
36693
36694  protected void composeDetectedIssueDetectedIssueMitigationComponentInner(DetectedIssue.DetectedIssueMitigationComponent element) throws IOException {
36695      composeBackbone(element);
36696      if (element.hasAction()) {
36697        composeCodeableConcept("action", element.getAction());
36698      }
36699      if (element.hasDateElement()) {
36700        composeDateTimeCore("date", element.getDateElement(), false);
36701        composeDateTimeExtras("date", element.getDateElement(), false);
36702      }
36703      if (element.hasAuthor()) {
36704        composeReference("author", element.getAuthor());
36705      }
36706  }
36707
36708  protected void composeDevice(String name, Device element) throws IOException {
36709    if (element != null) {
36710      prop("resourceType", name);
36711      composeDeviceInner(element);
36712    }
36713  }
36714
36715  protected void composeDeviceInner(Device element) throws IOException {
36716      composeDomainResourceElements(element);
36717      if (element.hasIdentifier()) {
36718        openArray("identifier");
36719        for (Identifier e : element.getIdentifier()) 
36720          composeIdentifier(null, e);
36721        closeArray();
36722      };
36723      if (element.hasDefinition()) {
36724        composeReference("definition", element.getDefinition());
36725      }
36726      if (element.hasUdiCarrier()) {
36727        openArray("udiCarrier");
36728        for (Device.DeviceUdiCarrierComponent e : element.getUdiCarrier()) 
36729          composeDeviceDeviceUdiCarrierComponent(null, e);
36730        closeArray();
36731      };
36732      if (element.hasStatusElement()) {
36733        composeEnumerationCore("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
36734        composeEnumerationExtras("status", element.getStatusElement(), new Device.FHIRDeviceStatusEnumFactory(), false);
36735      }
36736      if (element.hasStatusReason()) {
36737        openArray("statusReason");
36738        for (CodeableConcept e : element.getStatusReason()) 
36739          composeCodeableConcept(null, e);
36740        closeArray();
36741      };
36742      if (element.hasDistinctIdentificationCodeElement()) {
36743        composeStringCore("distinctIdentificationCode", element.getDistinctIdentificationCodeElement(), false);
36744        composeStringExtras("distinctIdentificationCode", element.getDistinctIdentificationCodeElement(), false);
36745      }
36746      if (element.hasManufacturerElement()) {
36747        composeStringCore("manufacturer", element.getManufacturerElement(), false);
36748        composeStringExtras("manufacturer", element.getManufacturerElement(), false);
36749      }
36750      if (element.hasManufactureDateElement()) {
36751        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
36752        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
36753      }
36754      if (element.hasExpirationDateElement()) {
36755        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
36756        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
36757      }
36758      if (element.hasLotNumberElement()) {
36759        composeStringCore("lotNumber", element.getLotNumberElement(), false);
36760        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
36761      }
36762      if (element.hasSerialNumberElement()) {
36763        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
36764        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
36765      }
36766      if (element.hasDeviceName()) {
36767        openArray("deviceName");
36768        for (Device.DeviceDeviceNameComponent e : element.getDeviceName()) 
36769          composeDeviceDeviceDeviceNameComponent(null, e);
36770        closeArray();
36771      };
36772      if (element.hasModelNumberElement()) {
36773        composeStringCore("modelNumber", element.getModelNumberElement(), false);
36774        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
36775      }
36776      if (element.hasPartNumberElement()) {
36777        composeStringCore("partNumber", element.getPartNumberElement(), false);
36778        composeStringExtras("partNumber", element.getPartNumberElement(), false);
36779      }
36780      if (element.hasType()) {
36781        composeCodeableConcept("type", element.getType());
36782      }
36783      if (element.hasSpecialization()) {
36784        openArray("specialization");
36785        for (Device.DeviceSpecializationComponent e : element.getSpecialization()) 
36786          composeDeviceDeviceSpecializationComponent(null, e);
36787        closeArray();
36788      };
36789      if (element.hasVersion()) {
36790        openArray("version");
36791        for (Device.DeviceVersionComponent e : element.getVersion()) 
36792          composeDeviceDeviceVersionComponent(null, e);
36793        closeArray();
36794      };
36795      if (element.hasProperty()) {
36796        openArray("property");
36797        for (Device.DevicePropertyComponent e : element.getProperty()) 
36798          composeDeviceDevicePropertyComponent(null, e);
36799        closeArray();
36800      };
36801      if (element.hasPatient()) {
36802        composeReference("patient", element.getPatient());
36803      }
36804      if (element.hasOwner()) {
36805        composeReference("owner", element.getOwner());
36806      }
36807      if (element.hasContact()) {
36808        openArray("contact");
36809        for (ContactPoint e : element.getContact()) 
36810          composeContactPoint(null, e);
36811        closeArray();
36812      };
36813      if (element.hasLocation()) {
36814        composeReference("location", element.getLocation());
36815      }
36816      if (element.hasUrlElement()) {
36817        composeUriCore("url", element.getUrlElement(), false);
36818        composeUriExtras("url", element.getUrlElement(), false);
36819      }
36820      if (element.hasNote()) {
36821        openArray("note");
36822        for (Annotation e : element.getNote()) 
36823          composeAnnotation(null, e);
36824        closeArray();
36825      };
36826      if (element.hasSafety()) {
36827        openArray("safety");
36828        for (CodeableConcept e : element.getSafety()) 
36829          composeCodeableConcept(null, e);
36830        closeArray();
36831      };
36832      if (element.hasParent()) {
36833        composeReference("parent", element.getParent());
36834      }
36835  }
36836
36837  protected void composeDeviceDeviceUdiCarrierComponent(String name, Device.DeviceUdiCarrierComponent element) throws IOException {
36838    if (element != null) {
36839      open(name);
36840      composeDeviceDeviceUdiCarrierComponentInner(element);
36841      close();
36842    }
36843  }
36844
36845  protected void composeDeviceDeviceUdiCarrierComponentInner(Device.DeviceUdiCarrierComponent element) throws IOException {
36846      composeBackbone(element);
36847      if (element.hasDeviceIdentifierElement()) {
36848        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
36849        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
36850      }
36851      if (element.hasIssuerElement()) {
36852        composeUriCore("issuer", element.getIssuerElement(), false);
36853        composeUriExtras("issuer", element.getIssuerElement(), false);
36854      }
36855      if (element.hasJurisdictionElement()) {
36856        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
36857        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
36858      }
36859      if (element.hasCarrierAIDCElement()) {
36860        composeBase64BinaryCore("carrierAIDC", element.getCarrierAIDCElement(), false);
36861        composeBase64BinaryExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
36862      }
36863      if (element.hasCarrierHRFElement()) {
36864        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
36865        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
36866      }
36867      if (element.hasEntryTypeElement()) {
36868        composeEnumerationCore("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
36869        composeEnumerationExtras("entryType", element.getEntryTypeElement(), new Device.UDIEntryTypeEnumFactory(), false);
36870      }
36871  }
36872
36873  protected void composeDeviceDeviceDeviceNameComponent(String name, Device.DeviceDeviceNameComponent element) throws IOException {
36874    if (element != null) {
36875      open(name);
36876      composeDeviceDeviceDeviceNameComponentInner(element);
36877      close();
36878    }
36879  }
36880
36881  protected void composeDeviceDeviceDeviceNameComponentInner(Device.DeviceDeviceNameComponent element) throws IOException {
36882      composeBackbone(element);
36883      if (element.hasNameElement()) {
36884        composeStringCore("name", element.getNameElement(), false);
36885        composeStringExtras("name", element.getNameElement(), false);
36886      }
36887      if (element.hasTypeElement()) {
36888        composeEnumerationCore("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
36889        composeEnumerationExtras("type", element.getTypeElement(), new Device.DeviceNameTypeEnumFactory(), false);
36890      }
36891  }
36892
36893  protected void composeDeviceDeviceSpecializationComponent(String name, Device.DeviceSpecializationComponent element) throws IOException {
36894    if (element != null) {
36895      open(name);
36896      composeDeviceDeviceSpecializationComponentInner(element);
36897      close();
36898    }
36899  }
36900
36901  protected void composeDeviceDeviceSpecializationComponentInner(Device.DeviceSpecializationComponent element) throws IOException {
36902      composeBackbone(element);
36903      if (element.hasSystemType()) {
36904        composeCodeableConcept("systemType", element.getSystemType());
36905      }
36906      if (element.hasVersionElement()) {
36907        composeStringCore("version", element.getVersionElement(), false);
36908        composeStringExtras("version", element.getVersionElement(), false);
36909      }
36910  }
36911
36912  protected void composeDeviceDeviceVersionComponent(String name, Device.DeviceVersionComponent element) throws IOException {
36913    if (element != null) {
36914      open(name);
36915      composeDeviceDeviceVersionComponentInner(element);
36916      close();
36917    }
36918  }
36919
36920  protected void composeDeviceDeviceVersionComponentInner(Device.DeviceVersionComponent element) throws IOException {
36921      composeBackbone(element);
36922      if (element.hasType()) {
36923        composeCodeableConcept("type", element.getType());
36924      }
36925      if (element.hasComponent()) {
36926        composeIdentifier("component", element.getComponent());
36927      }
36928      if (element.hasValueElement()) {
36929        composeStringCore("value", element.getValueElement(), false);
36930        composeStringExtras("value", element.getValueElement(), false);
36931      }
36932  }
36933
36934  protected void composeDeviceDevicePropertyComponent(String name, Device.DevicePropertyComponent element) throws IOException {
36935    if (element != null) {
36936      open(name);
36937      composeDeviceDevicePropertyComponentInner(element);
36938      close();
36939    }
36940  }
36941
36942  protected void composeDeviceDevicePropertyComponentInner(Device.DevicePropertyComponent element) throws IOException {
36943      composeBackbone(element);
36944      if (element.hasType()) {
36945        composeCodeableConcept("type", element.getType());
36946      }
36947      if (element.hasValueQuanity()) {
36948        openArray("valueQuanity");
36949        for (Quantity e : element.getValueQuanity()) 
36950          composeQuantity(null, e);
36951        closeArray();
36952      };
36953      if (element.hasValueCode()) {
36954        openArray("valueCode");
36955        for (CodeableConcept e : element.getValueCode()) 
36956          composeCodeableConcept(null, e);
36957        closeArray();
36958      };
36959  }
36960
36961  protected void composeDeviceDefinition(String name, DeviceDefinition element) throws IOException {
36962    if (element != null) {
36963      prop("resourceType", name);
36964      composeDeviceDefinitionInner(element);
36965    }
36966  }
36967
36968  protected void composeDeviceDefinitionInner(DeviceDefinition element) throws IOException {
36969      composeDomainResourceElements(element);
36970      if (element.hasIdentifier()) {
36971        openArray("identifier");
36972        for (Identifier e : element.getIdentifier()) 
36973          composeIdentifier(null, e);
36974        closeArray();
36975      };
36976      if (element.hasUdiDeviceIdentifier()) {
36977        openArray("udiDeviceIdentifier");
36978        for (DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent e : element.getUdiDeviceIdentifier()) 
36979          composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(null, e);
36980        closeArray();
36981      };
36982      if (element.hasManufacturer()) {
36983        composeType("manufacturer", element.getManufacturer());
36984      }
36985      if (element.hasDeviceName()) {
36986        openArray("deviceName");
36987        for (DeviceDefinition.DeviceDefinitionDeviceNameComponent e : element.getDeviceName()) 
36988          composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(null, e);
36989        closeArray();
36990      };
36991      if (element.hasModelNumberElement()) {
36992        composeStringCore("modelNumber", element.getModelNumberElement(), false);
36993        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
36994      }
36995      if (element.hasType()) {
36996        composeCodeableConcept("type", element.getType());
36997      }
36998      if (element.hasSpecialization()) {
36999        openArray("specialization");
37000        for (DeviceDefinition.DeviceDefinitionSpecializationComponent e : element.getSpecialization()) 
37001          composeDeviceDefinitionDeviceDefinitionSpecializationComponent(null, e);
37002        closeArray();
37003      };
37004      if (element.hasVersion()) {
37005        openArray("version");
37006        for (StringType e : element.getVersion()) 
37007          composeStringCore(null, e, true);
37008        closeArray();
37009        if (anyHasExtras(element.getVersion())) {
37010          openArray("_version");
37011          for (StringType e : element.getVersion()) 
37012            composeStringExtras(null, e, true);
37013          closeArray();
37014        }
37015      };
37016      if (element.hasSafety()) {
37017        openArray("safety");
37018        for (CodeableConcept e : element.getSafety()) 
37019          composeCodeableConcept(null, e);
37020        closeArray();
37021      };
37022      if (element.hasShelfLifeStorage()) {
37023        openArray("shelfLifeStorage");
37024        for (ProductShelfLife e : element.getShelfLifeStorage()) 
37025          composeProductShelfLife(null, e);
37026        closeArray();
37027      };
37028      if (element.hasPhysicalCharacteristics()) {
37029        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
37030      }
37031      if (element.hasLanguageCode()) {
37032        openArray("languageCode");
37033        for (CodeableConcept e : element.getLanguageCode()) 
37034          composeCodeableConcept(null, e);
37035        closeArray();
37036      };
37037      if (element.hasCapability()) {
37038        openArray("capability");
37039        for (DeviceDefinition.DeviceDefinitionCapabilityComponent e : element.getCapability()) 
37040          composeDeviceDefinitionDeviceDefinitionCapabilityComponent(null, e);
37041        closeArray();
37042      };
37043      if (element.hasProperty()) {
37044        openArray("property");
37045        for (DeviceDefinition.DeviceDefinitionPropertyComponent e : element.getProperty()) 
37046          composeDeviceDefinitionDeviceDefinitionPropertyComponent(null, e);
37047        closeArray();
37048      };
37049      if (element.hasOwner()) {
37050        composeReference("owner", element.getOwner());
37051      }
37052      if (element.hasContact()) {
37053        openArray("contact");
37054        for (ContactPoint e : element.getContact()) 
37055          composeContactPoint(null, e);
37056        closeArray();
37057      };
37058      if (element.hasUrlElement()) {
37059        composeUriCore("url", element.getUrlElement(), false);
37060        composeUriExtras("url", element.getUrlElement(), false);
37061      }
37062      if (element.hasOnlineInformationElement()) {
37063        composeUriCore("onlineInformation", element.getOnlineInformationElement(), false);
37064        composeUriExtras("onlineInformation", element.getOnlineInformationElement(), false);
37065      }
37066      if (element.hasNote()) {
37067        openArray("note");
37068        for (Annotation e : element.getNote()) 
37069          composeAnnotation(null, e);
37070        closeArray();
37071      };
37072      if (element.hasQuantity()) {
37073        composeQuantity("quantity", element.getQuantity());
37074      }
37075      if (element.hasParentDevice()) {
37076        composeReference("parentDevice", element.getParentDevice());
37077      }
37078      if (element.hasMaterial()) {
37079        openArray("material");
37080        for (DeviceDefinition.DeviceDefinitionMaterialComponent e : element.getMaterial()) 
37081          composeDeviceDefinitionDeviceDefinitionMaterialComponent(null, e);
37082        closeArray();
37083      };
37084  }
37085
37086  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponent(String name, DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
37087    if (element != null) {
37088      open(name);
37089      composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(element);
37090      close();
37091    }
37092  }
37093
37094  protected void composeDeviceDefinitionDeviceDefinitionUdiDeviceIdentifierComponentInner(DeviceDefinition.DeviceDefinitionUdiDeviceIdentifierComponent element) throws IOException {
37095      composeBackbone(element);
37096      if (element.hasDeviceIdentifierElement()) {
37097        composeStringCore("deviceIdentifier", element.getDeviceIdentifierElement(), false);
37098        composeStringExtras("deviceIdentifier", element.getDeviceIdentifierElement(), false);
37099      }
37100      if (element.hasIssuerElement()) {
37101        composeUriCore("issuer", element.getIssuerElement(), false);
37102        composeUriExtras("issuer", element.getIssuerElement(), false);
37103      }
37104      if (element.hasJurisdictionElement()) {
37105        composeUriCore("jurisdiction", element.getJurisdictionElement(), false);
37106        composeUriExtras("jurisdiction", element.getJurisdictionElement(), false);
37107      }
37108  }
37109
37110  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponent(String name, DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
37111    if (element != null) {
37112      open(name);
37113      composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(element);
37114      close();
37115    }
37116  }
37117
37118  protected void composeDeviceDefinitionDeviceDefinitionDeviceNameComponentInner(DeviceDefinition.DeviceDefinitionDeviceNameComponent element) throws IOException {
37119      composeBackbone(element);
37120      if (element.hasNameElement()) {
37121        composeStringCore("name", element.getNameElement(), false);
37122        composeStringExtras("name", element.getNameElement(), false);
37123      }
37124      if (element.hasTypeElement()) {
37125        composeEnumerationCore("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
37126        composeEnumerationExtras("type", element.getTypeElement(), new DeviceDefinition.DeviceNameTypeEnumFactory(), false);
37127      }
37128  }
37129
37130  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponent(String name, DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
37131    if (element != null) {
37132      open(name);
37133      composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(element);
37134      close();
37135    }
37136  }
37137
37138  protected void composeDeviceDefinitionDeviceDefinitionSpecializationComponentInner(DeviceDefinition.DeviceDefinitionSpecializationComponent element) throws IOException {
37139      composeBackbone(element);
37140      if (element.hasSystemTypeElement()) {
37141        composeStringCore("systemType", element.getSystemTypeElement(), false);
37142        composeStringExtras("systemType", element.getSystemTypeElement(), false);
37143      }
37144      if (element.hasVersionElement()) {
37145        composeStringCore("version", element.getVersionElement(), false);
37146        composeStringExtras("version", element.getVersionElement(), false);
37147      }
37148  }
37149
37150  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponent(String name, DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
37151    if (element != null) {
37152      open(name);
37153      composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(element);
37154      close();
37155    }
37156  }
37157
37158  protected void composeDeviceDefinitionDeviceDefinitionCapabilityComponentInner(DeviceDefinition.DeviceDefinitionCapabilityComponent element) throws IOException {
37159      composeBackbone(element);
37160      if (element.hasType()) {
37161        composeCodeableConcept("type", element.getType());
37162      }
37163      if (element.hasDescription()) {
37164        openArray("description");
37165        for (CodeableConcept e : element.getDescription()) 
37166          composeCodeableConcept(null, e);
37167        closeArray();
37168      };
37169  }
37170
37171  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponent(String name, DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
37172    if (element != null) {
37173      open(name);
37174      composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(element);
37175      close();
37176    }
37177  }
37178
37179  protected void composeDeviceDefinitionDeviceDefinitionPropertyComponentInner(DeviceDefinition.DeviceDefinitionPropertyComponent element) throws IOException {
37180      composeBackbone(element);
37181      if (element.hasType()) {
37182        composeCodeableConcept("type", element.getType());
37183      }
37184      if (element.hasValueQuanity()) {
37185        openArray("valueQuanity");
37186        for (Quantity e : element.getValueQuanity()) 
37187          composeQuantity(null, e);
37188        closeArray();
37189      };
37190      if (element.hasValueCode()) {
37191        openArray("valueCode");
37192        for (CodeableConcept e : element.getValueCode()) 
37193          composeCodeableConcept(null, e);
37194        closeArray();
37195      };
37196  }
37197
37198  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponent(String name, DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
37199    if (element != null) {
37200      open(name);
37201      composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(element);
37202      close();
37203    }
37204  }
37205
37206  protected void composeDeviceDefinitionDeviceDefinitionMaterialComponentInner(DeviceDefinition.DeviceDefinitionMaterialComponent element) throws IOException {
37207      composeBackbone(element);
37208      if (element.hasSubstance()) {
37209        composeCodeableConcept("substance", element.getSubstance());
37210      }
37211      if (element.hasAlternateElement()) {
37212        composeBooleanCore("alternate", element.getAlternateElement(), false);
37213        composeBooleanExtras("alternate", element.getAlternateElement(), false);
37214      }
37215      if (element.hasAllergenicIndicatorElement()) {
37216        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
37217        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
37218      }
37219  }
37220
37221  protected void composeDeviceMetric(String name, DeviceMetric element) throws IOException {
37222    if (element != null) {
37223      prop("resourceType", name);
37224      composeDeviceMetricInner(element);
37225    }
37226  }
37227
37228  protected void composeDeviceMetricInner(DeviceMetric element) throws IOException {
37229      composeDomainResourceElements(element);
37230      if (element.hasIdentifier()) {
37231        openArray("identifier");
37232        for (Identifier e : element.getIdentifier()) 
37233          composeIdentifier(null, e);
37234        closeArray();
37235      };
37236      if (element.hasType()) {
37237        composeCodeableConcept("type", element.getType());
37238      }
37239      if (element.hasUnit()) {
37240        composeCodeableConcept("unit", element.getUnit());
37241      }
37242      if (element.hasSource()) {
37243        composeReference("source", element.getSource());
37244      }
37245      if (element.hasParent()) {
37246        composeReference("parent", element.getParent());
37247      }
37248      if (element.hasOperationalStatusElement()) {
37249        composeEnumerationCore("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
37250        composeEnumerationExtras("operationalStatus", element.getOperationalStatusElement(), new DeviceMetric.DeviceMetricOperationalStatusEnumFactory(), false);
37251      }
37252      if (element.hasColorElement()) {
37253        composeEnumerationCore("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
37254        composeEnumerationExtras("color", element.getColorElement(), new DeviceMetric.DeviceMetricColorEnumFactory(), false);
37255      }
37256      if (element.hasCategoryElement()) {
37257        composeEnumerationCore("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
37258        composeEnumerationExtras("category", element.getCategoryElement(), new DeviceMetric.DeviceMetricCategoryEnumFactory(), false);
37259      }
37260      if (element.hasMeasurementPeriod()) {
37261        composeTiming("measurementPeriod", element.getMeasurementPeriod());
37262      }
37263      if (element.hasCalibration()) {
37264        openArray("calibration");
37265        for (DeviceMetric.DeviceMetricCalibrationComponent e : element.getCalibration()) 
37266          composeDeviceMetricDeviceMetricCalibrationComponent(null, e);
37267        closeArray();
37268      };
37269  }
37270
37271  protected void composeDeviceMetricDeviceMetricCalibrationComponent(String name, DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
37272    if (element != null) {
37273      open(name);
37274      composeDeviceMetricDeviceMetricCalibrationComponentInner(element);
37275      close();
37276    }
37277  }
37278
37279  protected void composeDeviceMetricDeviceMetricCalibrationComponentInner(DeviceMetric.DeviceMetricCalibrationComponent element) throws IOException {
37280      composeBackbone(element);
37281      if (element.hasTypeElement()) {
37282        composeEnumerationCore("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
37283        composeEnumerationExtras("type", element.getTypeElement(), new DeviceMetric.DeviceMetricCalibrationTypeEnumFactory(), false);
37284      }
37285      if (element.hasStateElement()) {
37286        composeEnumerationCore("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
37287        composeEnumerationExtras("state", element.getStateElement(), new DeviceMetric.DeviceMetricCalibrationStateEnumFactory(), false);
37288      }
37289      if (element.hasTimeElement()) {
37290        composeInstantCore("time", element.getTimeElement(), false);
37291        composeInstantExtras("time", element.getTimeElement(), false);
37292      }
37293  }
37294
37295  protected void composeDeviceRequest(String name, DeviceRequest element) throws IOException {
37296    if (element != null) {
37297      prop("resourceType", name);
37298      composeDeviceRequestInner(element);
37299    }
37300  }
37301
37302  protected void composeDeviceRequestInner(DeviceRequest element) throws IOException {
37303      composeDomainResourceElements(element);
37304      if (element.hasIdentifier()) {
37305        openArray("identifier");
37306        for (Identifier e : element.getIdentifier()) 
37307          composeIdentifier(null, e);
37308        closeArray();
37309      };
37310      if (element.hasInstantiatesCanonical()) {
37311        openArray("instantiatesCanonical");
37312        for (CanonicalType e : element.getInstantiatesCanonical()) 
37313          composeCanonicalCore(null, e, true);
37314        closeArray();
37315        if (anyHasExtras(element.getInstantiatesCanonical())) {
37316          openArray("_instantiatesCanonical");
37317          for (CanonicalType e : element.getInstantiatesCanonical()) 
37318            composeCanonicalExtras(null, e, true);
37319          closeArray();
37320        }
37321      };
37322      if (element.hasInstantiatesUri()) {
37323        openArray("instantiatesUri");
37324        for (UriType e : element.getInstantiatesUri()) 
37325          composeUriCore(null, e, true);
37326        closeArray();
37327        if (anyHasExtras(element.getInstantiatesUri())) {
37328          openArray("_instantiatesUri");
37329          for (UriType e : element.getInstantiatesUri()) 
37330            composeUriExtras(null, e, true);
37331          closeArray();
37332        }
37333      };
37334      if (element.hasBasedOn()) {
37335        openArray("basedOn");
37336        for (Reference e : element.getBasedOn()) 
37337          composeReference(null, e);
37338        closeArray();
37339      };
37340      if (element.hasPriorRequest()) {
37341        openArray("priorRequest");
37342        for (Reference e : element.getPriorRequest()) 
37343          composeReference(null, e);
37344        closeArray();
37345      };
37346      if (element.hasGroupIdentifier()) {
37347        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
37348      }
37349      if (element.hasStatusElement()) {
37350        composeEnumerationCore("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
37351        composeEnumerationExtras("status", element.getStatusElement(), new DeviceRequest.DeviceRequestStatusEnumFactory(), false);
37352      }
37353      if (element.hasIntentElement()) {
37354        composeEnumerationCore("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
37355        composeEnumerationExtras("intent", element.getIntentElement(), new DeviceRequest.RequestIntentEnumFactory(), false);
37356      }
37357      if (element.hasPriorityElement()) {
37358        composeEnumerationCore("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
37359        composeEnumerationExtras("priority", element.getPriorityElement(), new DeviceRequest.RequestPriorityEnumFactory(), false);
37360      }
37361      if (element.hasCode()) {
37362        composeType("code", element.getCode());
37363      }
37364      if (element.hasParameter()) {
37365        openArray("parameter");
37366        for (DeviceRequest.DeviceRequestParameterComponent e : element.getParameter()) 
37367          composeDeviceRequestDeviceRequestParameterComponent(null, e);
37368        closeArray();
37369      };
37370      if (element.hasSubject()) {
37371        composeReference("subject", element.getSubject());
37372      }
37373      if (element.hasContext()) {
37374        composeReference("context", element.getContext());
37375      }
37376      if (element.hasOccurrence()) {
37377        composeType("occurrence", element.getOccurrence());
37378      }
37379      if (element.hasAuthoredOnElement()) {
37380        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
37381        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
37382      }
37383      if (element.hasRequester()) {
37384        composeReference("requester", element.getRequester());
37385      }
37386      if (element.hasPerformerType()) {
37387        composeCodeableConcept("performerType", element.getPerformerType());
37388      }
37389      if (element.hasPerformer()) {
37390        composeReference("performer", element.getPerformer());
37391      }
37392      if (element.hasReasonCode()) {
37393        openArray("reasonCode");
37394        for (CodeableConcept e : element.getReasonCode()) 
37395          composeCodeableConcept(null, e);
37396        closeArray();
37397      };
37398      if (element.hasReasonReference()) {
37399        openArray("reasonReference");
37400        for (Reference e : element.getReasonReference()) 
37401          composeReference(null, e);
37402        closeArray();
37403      };
37404      if (element.hasInsurance()) {
37405        openArray("insurance");
37406        for (Reference e : element.getInsurance()) 
37407          composeReference(null, e);
37408        closeArray();
37409      };
37410      if (element.hasSupportingInfo()) {
37411        openArray("supportingInfo");
37412        for (Reference e : element.getSupportingInfo()) 
37413          composeReference(null, e);
37414        closeArray();
37415      };
37416      if (element.hasNote()) {
37417        openArray("note");
37418        for (Annotation e : element.getNote()) 
37419          composeAnnotation(null, e);
37420        closeArray();
37421      };
37422      if (element.hasRelevantHistory()) {
37423        openArray("relevantHistory");
37424        for (Reference e : element.getRelevantHistory()) 
37425          composeReference(null, e);
37426        closeArray();
37427      };
37428  }
37429
37430  protected void composeDeviceRequestDeviceRequestParameterComponent(String name, DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
37431    if (element != null) {
37432      open(name);
37433      composeDeviceRequestDeviceRequestParameterComponentInner(element);
37434      close();
37435    }
37436  }
37437
37438  protected void composeDeviceRequestDeviceRequestParameterComponentInner(DeviceRequest.DeviceRequestParameterComponent element) throws IOException {
37439      composeBackbone(element);
37440      if (element.hasCode()) {
37441        composeCodeableConcept("code", element.getCode());
37442      }
37443      if (element.hasValue()) {
37444        composeType("value", element.getValue());
37445      }
37446  }
37447
37448  protected void composeDeviceUseStatement(String name, DeviceUseStatement element) throws IOException {
37449    if (element != null) {
37450      prop("resourceType", name);
37451      composeDeviceUseStatementInner(element);
37452    }
37453  }
37454
37455  protected void composeDeviceUseStatementInner(DeviceUseStatement element) throws IOException {
37456      composeDomainResourceElements(element);
37457      if (element.hasIdentifier()) {
37458        openArray("identifier");
37459        for (Identifier e : element.getIdentifier()) 
37460          composeIdentifier(null, e);
37461        closeArray();
37462      };
37463      if (element.hasBasedOn()) {
37464        openArray("basedOn");
37465        for (Reference e : element.getBasedOn()) 
37466          composeReference(null, e);
37467        closeArray();
37468      };
37469      if (element.hasStatusElement()) {
37470        composeEnumerationCore("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
37471        composeEnumerationExtras("status", element.getStatusElement(), new DeviceUseStatement.DeviceUseStatementStatusEnumFactory(), false);
37472      }
37473      if (element.hasSubject()) {
37474        composeReference("subject", element.getSubject());
37475      }
37476      if (element.hasDerivedFrom()) {
37477        openArray("derivedFrom");
37478        for (Reference e : element.getDerivedFrom()) 
37479          composeReference(null, e);
37480        closeArray();
37481      };
37482      if (element.hasTiming()) {
37483        composeType("timing", element.getTiming());
37484      }
37485      if (element.hasRecordedOnElement()) {
37486        composeDateTimeCore("recordedOn", element.getRecordedOnElement(), false);
37487        composeDateTimeExtras("recordedOn", element.getRecordedOnElement(), false);
37488      }
37489      if (element.hasSource()) {
37490        composeReference("source", element.getSource());
37491      }
37492      if (element.hasDevice()) {
37493        composeReference("device", element.getDevice());
37494      }
37495      if (element.hasReasonCode()) {
37496        openArray("reasonCode");
37497        for (CodeableConcept e : element.getReasonCode()) 
37498          composeCodeableConcept(null, e);
37499        closeArray();
37500      };
37501      if (element.hasReasonReference()) {
37502        openArray("reasonReference");
37503        for (Reference e : element.getReasonReference()) 
37504          composeReference(null, e);
37505        closeArray();
37506      };
37507      if (element.hasBodySite()) {
37508        composeCodeableConcept("bodySite", element.getBodySite());
37509      }
37510      if (element.hasNote()) {
37511        openArray("note");
37512        for (Annotation e : element.getNote()) 
37513          composeAnnotation(null, e);
37514        closeArray();
37515      };
37516  }
37517
37518  protected void composeDiagnosticReport(String name, DiagnosticReport element) throws IOException {
37519    if (element != null) {
37520      prop("resourceType", name);
37521      composeDiagnosticReportInner(element);
37522    }
37523  }
37524
37525  protected void composeDiagnosticReportInner(DiagnosticReport element) throws IOException {
37526      composeDomainResourceElements(element);
37527      if (element.hasIdentifier()) {
37528        openArray("identifier");
37529        for (Identifier e : element.getIdentifier()) 
37530          composeIdentifier(null, e);
37531        closeArray();
37532      };
37533      if (element.hasBasedOn()) {
37534        openArray("basedOn");
37535        for (Reference e : element.getBasedOn()) 
37536          composeReference(null, e);
37537        closeArray();
37538      };
37539      if (element.hasStatusElement()) {
37540        composeEnumerationCore("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
37541        composeEnumerationExtras("status", element.getStatusElement(), new DiagnosticReport.DiagnosticReportStatusEnumFactory(), false);
37542      }
37543      if (element.hasCategory()) {
37544        composeCodeableConcept("category", element.getCategory());
37545      }
37546      if (element.hasCode()) {
37547        composeCodeableConcept("code", element.getCode());
37548      }
37549      if (element.hasSubject()) {
37550        composeReference("subject", element.getSubject());
37551      }
37552      if (element.hasContext()) {
37553        composeReference("context", element.getContext());
37554      }
37555      if (element.hasEffective()) {
37556        composeType("effective", element.getEffective());
37557      }
37558      if (element.hasIssuedElement()) {
37559        composeInstantCore("issued", element.getIssuedElement(), false);
37560        composeInstantExtras("issued", element.getIssuedElement(), false);
37561      }
37562      if (element.hasPerformer()) {
37563        openArray("performer");
37564        for (Reference e : element.getPerformer()) 
37565          composeReference(null, e);
37566        closeArray();
37567      };
37568      if (element.hasResultsInterpreter()) {
37569        openArray("resultsInterpreter");
37570        for (Reference e : element.getResultsInterpreter()) 
37571          composeReference(null, e);
37572        closeArray();
37573      };
37574      if (element.hasSpecimen()) {
37575        openArray("specimen");
37576        for (Reference e : element.getSpecimen()) 
37577          composeReference(null, e);
37578        closeArray();
37579      };
37580      if (element.hasResult()) {
37581        openArray("result");
37582        for (Reference e : element.getResult()) 
37583          composeReference(null, e);
37584        closeArray();
37585      };
37586      if (element.hasImagingStudy()) {
37587        openArray("imagingStudy");
37588        for (Reference e : element.getImagingStudy()) 
37589          composeReference(null, e);
37590        closeArray();
37591      };
37592      if (element.hasMedia()) {
37593        openArray("media");
37594        for (DiagnosticReport.DiagnosticReportMediaComponent e : element.getMedia()) 
37595          composeDiagnosticReportDiagnosticReportMediaComponent(null, e);
37596        closeArray();
37597      };
37598      if (element.hasConclusionElement()) {
37599        composeStringCore("conclusion", element.getConclusionElement(), false);
37600        composeStringExtras("conclusion", element.getConclusionElement(), false);
37601      }
37602      if (element.hasConclusionCode()) {
37603        openArray("conclusionCode");
37604        for (CodeableConcept e : element.getConclusionCode()) 
37605          composeCodeableConcept(null, e);
37606        closeArray();
37607      };
37608      if (element.hasPresentedForm()) {
37609        openArray("presentedForm");
37610        for (Attachment e : element.getPresentedForm()) 
37611          composeAttachment(null, e);
37612        closeArray();
37613      };
37614  }
37615
37616  protected void composeDiagnosticReportDiagnosticReportMediaComponent(String name, DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
37617    if (element != null) {
37618      open(name);
37619      composeDiagnosticReportDiagnosticReportMediaComponentInner(element);
37620      close();
37621    }
37622  }
37623
37624  protected void composeDiagnosticReportDiagnosticReportMediaComponentInner(DiagnosticReport.DiagnosticReportMediaComponent element) throws IOException {
37625      composeBackbone(element);
37626      if (element.hasCommentElement()) {
37627        composeStringCore("comment", element.getCommentElement(), false);
37628        composeStringExtras("comment", element.getCommentElement(), false);
37629      }
37630      if (element.hasLink()) {
37631        composeReference("link", element.getLink());
37632      }
37633  }
37634
37635  protected void composeDocumentManifest(String name, DocumentManifest element) throws IOException {
37636    if (element != null) {
37637      prop("resourceType", name);
37638      composeDocumentManifestInner(element);
37639    }
37640  }
37641
37642  protected void composeDocumentManifestInner(DocumentManifest element) throws IOException {
37643      composeDomainResourceElements(element);
37644      if (element.hasMasterIdentifier()) {
37645        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
37646      }
37647      if (element.hasIdentifier()) {
37648        openArray("identifier");
37649        for (Identifier e : element.getIdentifier()) 
37650          composeIdentifier(null, e);
37651        closeArray();
37652      };
37653      if (element.hasStatusElement()) {
37654        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
37655        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
37656      }
37657      if (element.hasType()) {
37658        composeCodeableConcept("type", element.getType());
37659      }
37660      if (element.hasSubject()) {
37661        composeReference("subject", element.getSubject());
37662      }
37663      if (element.hasCreatedElement()) {
37664        composeDateTimeCore("created", element.getCreatedElement(), false);
37665        composeDateTimeExtras("created", element.getCreatedElement(), false);
37666      }
37667      if (element.hasAgent()) {
37668        openArray("agent");
37669        for (DocumentManifest.DocumentManifestAgentComponent e : element.getAgent()) 
37670          composeDocumentManifestDocumentManifestAgentComponent(null, e);
37671        closeArray();
37672      };
37673      if (element.hasRecipient()) {
37674        openArray("recipient");
37675        for (Reference e : element.getRecipient()) 
37676          composeReference(null, e);
37677        closeArray();
37678      };
37679      if (element.hasSourceElement()) {
37680        composeUriCore("source", element.getSourceElement(), false);
37681        composeUriExtras("source", element.getSourceElement(), false);
37682      }
37683      if (element.hasDescriptionElement()) {
37684        composeStringCore("description", element.getDescriptionElement(), false);
37685        composeStringExtras("description", element.getDescriptionElement(), false);
37686      }
37687      if (element.hasContent()) {
37688        openArray("content");
37689        for (Reference e : element.getContent()) 
37690          composeReference(null, e);
37691        closeArray();
37692      };
37693      if (element.hasRelated()) {
37694        openArray("related");
37695        for (DocumentManifest.DocumentManifestRelatedComponent e : element.getRelated()) 
37696          composeDocumentManifestDocumentManifestRelatedComponent(null, e);
37697        closeArray();
37698      };
37699  }
37700
37701  protected void composeDocumentManifestDocumentManifestAgentComponent(String name, DocumentManifest.DocumentManifestAgentComponent element) throws IOException {
37702    if (element != null) {
37703      open(name);
37704      composeDocumentManifestDocumentManifestAgentComponentInner(element);
37705      close();
37706    }
37707  }
37708
37709  protected void composeDocumentManifestDocumentManifestAgentComponentInner(DocumentManifest.DocumentManifestAgentComponent element) throws IOException {
37710      composeBackbone(element);
37711      if (element.hasType()) {
37712        composeCodeableConcept("type", element.getType());
37713      }
37714      if (element.hasWho()) {
37715        composeReference("who", element.getWho());
37716      }
37717  }
37718
37719  protected void composeDocumentManifestDocumentManifestRelatedComponent(String name, DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
37720    if (element != null) {
37721      open(name);
37722      composeDocumentManifestDocumentManifestRelatedComponentInner(element);
37723      close();
37724    }
37725  }
37726
37727  protected void composeDocumentManifestDocumentManifestRelatedComponentInner(DocumentManifest.DocumentManifestRelatedComponent element) throws IOException {
37728      composeBackbone(element);
37729      if (element.hasIdentifier()) {
37730        composeIdentifier("identifier", element.getIdentifier());
37731      }
37732      if (element.hasRef()) {
37733        composeReference("ref", element.getRef());
37734      }
37735  }
37736
37737  protected void composeDocumentReference(String name, DocumentReference element) throws IOException {
37738    if (element != null) {
37739      prop("resourceType", name);
37740      composeDocumentReferenceInner(element);
37741    }
37742  }
37743
37744  protected void composeDocumentReferenceInner(DocumentReference element) throws IOException {
37745      composeDomainResourceElements(element);
37746      if (element.hasMasterIdentifier()) {
37747        composeIdentifier("masterIdentifier", element.getMasterIdentifier());
37748      }
37749      if (element.hasIdentifier()) {
37750        openArray("identifier");
37751        for (Identifier e : element.getIdentifier()) 
37752          composeIdentifier(null, e);
37753        closeArray();
37754      };
37755      if (element.hasStatusElement()) {
37756        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
37757        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.DocumentReferenceStatusEnumFactory(), false);
37758      }
37759      if (element.hasDocStatusElement()) {
37760        composeEnumerationCore("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
37761        composeEnumerationExtras("docStatus", element.getDocStatusElement(), new DocumentReference.ReferredDocumentStatusEnumFactory(), false);
37762      }
37763      if (element.hasType()) {
37764        composeCodeableConcept("type", element.getType());
37765      }
37766      if (element.hasCategory()) {
37767        openArray("category");
37768        for (CodeableConcept e : element.getCategory()) 
37769          composeCodeableConcept(null, e);
37770        closeArray();
37771      };
37772      if (element.hasSubject()) {
37773        composeReference("subject", element.getSubject());
37774      }
37775      if (element.hasDateElement()) {
37776        composeInstantCore("date", element.getDateElement(), false);
37777        composeInstantExtras("date", element.getDateElement(), false);
37778      }
37779      if (element.hasAgent()) {
37780        openArray("agent");
37781        for (DocumentReference.DocumentReferenceAgentComponent e : element.getAgent()) 
37782          composeDocumentReferenceDocumentReferenceAgentComponent(null, e);
37783        closeArray();
37784      };
37785      if (element.hasAuthenticator()) {
37786        composeReference("authenticator", element.getAuthenticator());
37787      }
37788      if (element.hasCustodian()) {
37789        composeReference("custodian", element.getCustodian());
37790      }
37791      if (element.hasRelatesTo()) {
37792        openArray("relatesTo");
37793        for (DocumentReference.DocumentReferenceRelatesToComponent e : element.getRelatesTo()) 
37794          composeDocumentReferenceDocumentReferenceRelatesToComponent(null, e);
37795        closeArray();
37796      };
37797      if (element.hasDescriptionElement()) {
37798        composeStringCore("description", element.getDescriptionElement(), false);
37799        composeStringExtras("description", element.getDescriptionElement(), false);
37800      }
37801      if (element.hasSecurityLabel()) {
37802        openArray("securityLabel");
37803        for (CodeableConcept e : element.getSecurityLabel()) 
37804          composeCodeableConcept(null, e);
37805        closeArray();
37806      };
37807      if (element.hasContent()) {
37808        openArray("content");
37809        for (DocumentReference.DocumentReferenceContentComponent e : element.getContent()) 
37810          composeDocumentReferenceDocumentReferenceContentComponent(null, e);
37811        closeArray();
37812      };
37813      if (element.hasContext()) {
37814        composeDocumentReferenceDocumentReferenceContextComponent("context", element.getContext());
37815      }
37816  }
37817
37818  protected void composeDocumentReferenceDocumentReferenceAgentComponent(String name, DocumentReference.DocumentReferenceAgentComponent element) throws IOException {
37819    if (element != null) {
37820      open(name);
37821      composeDocumentReferenceDocumentReferenceAgentComponentInner(element);
37822      close();
37823    }
37824  }
37825
37826  protected void composeDocumentReferenceDocumentReferenceAgentComponentInner(DocumentReference.DocumentReferenceAgentComponent element) throws IOException {
37827      composeBackbone(element);
37828      if (element.hasType()) {
37829        composeCodeableConcept("type", element.getType());
37830      }
37831      if (element.hasWho()) {
37832        composeReference("who", element.getWho());
37833      }
37834  }
37835
37836  protected void composeDocumentReferenceDocumentReferenceRelatesToComponent(String name, DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
37837    if (element != null) {
37838      open(name);
37839      composeDocumentReferenceDocumentReferenceRelatesToComponentInner(element);
37840      close();
37841    }
37842  }
37843
37844  protected void composeDocumentReferenceDocumentReferenceRelatesToComponentInner(DocumentReference.DocumentReferenceRelatesToComponent element) throws IOException {
37845      composeBackbone(element);
37846      if (element.hasCodeElement()) {
37847        composeEnumerationCore("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
37848        composeEnumerationExtras("code", element.getCodeElement(), new DocumentReference.DocumentRelationshipTypeEnumFactory(), false);
37849      }
37850      if (element.hasTarget()) {
37851        composeReference("target", element.getTarget());
37852      }
37853  }
37854
37855  protected void composeDocumentReferenceDocumentReferenceContentComponent(String name, DocumentReference.DocumentReferenceContentComponent element) throws IOException {
37856    if (element != null) {
37857      open(name);
37858      composeDocumentReferenceDocumentReferenceContentComponentInner(element);
37859      close();
37860    }
37861  }
37862
37863  protected void composeDocumentReferenceDocumentReferenceContentComponentInner(DocumentReference.DocumentReferenceContentComponent element) throws IOException {
37864      composeBackbone(element);
37865      if (element.hasAttachment()) {
37866        composeAttachment("attachment", element.getAttachment());
37867      }
37868      if (element.hasFormat()) {
37869        composeCoding("format", element.getFormat());
37870      }
37871  }
37872
37873  protected void composeDocumentReferenceDocumentReferenceContextComponent(String name, DocumentReference.DocumentReferenceContextComponent element) throws IOException {
37874    if (element != null) {
37875      open(name);
37876      composeDocumentReferenceDocumentReferenceContextComponentInner(element);
37877      close();
37878    }
37879  }
37880
37881  protected void composeDocumentReferenceDocumentReferenceContextComponentInner(DocumentReference.DocumentReferenceContextComponent element) throws IOException {
37882      composeBackbone(element);
37883      if (element.hasEncounter()) {
37884        openArray("encounter");
37885        for (Reference e : element.getEncounter()) 
37886          composeReference(null, e);
37887        closeArray();
37888      };
37889      if (element.hasEvent()) {
37890        openArray("event");
37891        for (CodeableConcept e : element.getEvent()) 
37892          composeCodeableConcept(null, e);
37893        closeArray();
37894      };
37895      if (element.hasPeriod()) {
37896        composePeriod("period", element.getPeriod());
37897      }
37898      if (element.hasFacilityType()) {
37899        composeCodeableConcept("facilityType", element.getFacilityType());
37900      }
37901      if (element.hasPracticeSetting()) {
37902        composeCodeableConcept("practiceSetting", element.getPracticeSetting());
37903      }
37904      if (element.hasSourcePatientInfo()) {
37905        composeReference("sourcePatientInfo", element.getSourcePatientInfo());
37906      }
37907      if (element.hasRelated()) {
37908        openArray("related");
37909        for (Reference e : element.getRelated()) 
37910          composeReference(null, e);
37911        closeArray();
37912      };
37913  }
37914
37915  protected void composeEncounter(String name, Encounter element) throws IOException {
37916    if (element != null) {
37917      prop("resourceType", name);
37918      composeEncounterInner(element);
37919    }
37920  }
37921
37922  protected void composeEncounterInner(Encounter element) throws IOException {
37923      composeDomainResourceElements(element);
37924      if (element.hasIdentifier()) {
37925        openArray("identifier");
37926        for (Identifier e : element.getIdentifier()) 
37927          composeIdentifier(null, e);
37928        closeArray();
37929      };
37930      if (element.hasStatusElement()) {
37931        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
37932        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
37933      }
37934      if (element.hasStatusHistory()) {
37935        openArray("statusHistory");
37936        for (Encounter.StatusHistoryComponent e : element.getStatusHistory()) 
37937          composeEncounterStatusHistoryComponent(null, e);
37938        closeArray();
37939      };
37940      if (element.hasClass_()) {
37941        composeCoding("class", element.getClass_());
37942      }
37943      if (element.hasClassHistory()) {
37944        openArray("classHistory");
37945        for (Encounter.ClassHistoryComponent e : element.getClassHistory()) 
37946          composeEncounterClassHistoryComponent(null, e);
37947        closeArray();
37948      };
37949      if (element.hasType()) {
37950        openArray("type");
37951        for (CodeableConcept e : element.getType()) 
37952          composeCodeableConcept(null, e);
37953        closeArray();
37954      };
37955      if (element.hasServiceType()) {
37956        composeCodeableConcept("serviceType", element.getServiceType());
37957      }
37958      if (element.hasPriority()) {
37959        composeCodeableConcept("priority", element.getPriority());
37960      }
37961      if (element.hasSubject()) {
37962        composeReference("subject", element.getSubject());
37963      }
37964      if (element.hasEpisodeOfCare()) {
37965        openArray("episodeOfCare");
37966        for (Reference e : element.getEpisodeOfCare()) 
37967          composeReference(null, e);
37968        closeArray();
37969      };
37970      if (element.hasBasedOn()) {
37971        openArray("basedOn");
37972        for (Reference e : element.getBasedOn()) 
37973          composeReference(null, e);
37974        closeArray();
37975      };
37976      if (element.hasParticipant()) {
37977        openArray("participant");
37978        for (Encounter.EncounterParticipantComponent e : element.getParticipant()) 
37979          composeEncounterEncounterParticipantComponent(null, e);
37980        closeArray();
37981      };
37982      if (element.hasAppointment()) {
37983        composeReference("appointment", element.getAppointment());
37984      }
37985      if (element.hasPeriod()) {
37986        composePeriod("period", element.getPeriod());
37987      }
37988      if (element.hasLength()) {
37989        composeDuration("length", element.getLength());
37990      }
37991      if (element.hasReason()) {
37992        openArray("reason");
37993        for (CodeableConcept e : element.getReason()) 
37994          composeCodeableConcept(null, e);
37995        closeArray();
37996      };
37997      if (element.hasDiagnosis()) {
37998        openArray("diagnosis");
37999        for (Encounter.DiagnosisComponent e : element.getDiagnosis()) 
38000          composeEncounterDiagnosisComponent(null, e);
38001        closeArray();
38002      };
38003      if (element.hasAccount()) {
38004        openArray("account");
38005        for (Reference e : element.getAccount()) 
38006          composeReference(null, e);
38007        closeArray();
38008      };
38009      if (element.hasHospitalization()) {
38010        composeEncounterEncounterHospitalizationComponent("hospitalization", element.getHospitalization());
38011      }
38012      if (element.hasLocation()) {
38013        openArray("location");
38014        for (Encounter.EncounterLocationComponent e : element.getLocation()) 
38015          composeEncounterEncounterLocationComponent(null, e);
38016        closeArray();
38017      };
38018      if (element.hasServiceProvider()) {
38019        composeReference("serviceProvider", element.getServiceProvider());
38020      }
38021      if (element.hasPartOf()) {
38022        composeReference("partOf", element.getPartOf());
38023      }
38024  }
38025
38026  protected void composeEncounterStatusHistoryComponent(String name, Encounter.StatusHistoryComponent element) throws IOException {
38027    if (element != null) {
38028      open(name);
38029      composeEncounterStatusHistoryComponentInner(element);
38030      close();
38031    }
38032  }
38033
38034  protected void composeEncounterStatusHistoryComponentInner(Encounter.StatusHistoryComponent element) throws IOException {
38035      composeBackbone(element);
38036      if (element.hasStatusElement()) {
38037        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
38038        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterStatusEnumFactory(), false);
38039      }
38040      if (element.hasPeriod()) {
38041        composePeriod("period", element.getPeriod());
38042      }
38043  }
38044
38045  protected void composeEncounterClassHistoryComponent(String name, Encounter.ClassHistoryComponent element) throws IOException {
38046    if (element != null) {
38047      open(name);
38048      composeEncounterClassHistoryComponentInner(element);
38049      close();
38050    }
38051  }
38052
38053  protected void composeEncounterClassHistoryComponentInner(Encounter.ClassHistoryComponent element) throws IOException {
38054      composeBackbone(element);
38055      if (element.hasClass_()) {
38056        composeCoding("class", element.getClass_());
38057      }
38058      if (element.hasPeriod()) {
38059        composePeriod("period", element.getPeriod());
38060      }
38061  }
38062
38063  protected void composeEncounterEncounterParticipantComponent(String name, Encounter.EncounterParticipantComponent element) throws IOException {
38064    if (element != null) {
38065      open(name);
38066      composeEncounterEncounterParticipantComponentInner(element);
38067      close();
38068    }
38069  }
38070
38071  protected void composeEncounterEncounterParticipantComponentInner(Encounter.EncounterParticipantComponent element) throws IOException {
38072      composeBackbone(element);
38073      if (element.hasType()) {
38074        openArray("type");
38075        for (CodeableConcept e : element.getType()) 
38076          composeCodeableConcept(null, e);
38077        closeArray();
38078      };
38079      if (element.hasPeriod()) {
38080        composePeriod("period", element.getPeriod());
38081      }
38082      if (element.hasIndividual()) {
38083        composeReference("individual", element.getIndividual());
38084      }
38085  }
38086
38087  protected void composeEncounterDiagnosisComponent(String name, Encounter.DiagnosisComponent element) throws IOException {
38088    if (element != null) {
38089      open(name);
38090      composeEncounterDiagnosisComponentInner(element);
38091      close();
38092    }
38093  }
38094
38095  protected void composeEncounterDiagnosisComponentInner(Encounter.DiagnosisComponent element) throws IOException {
38096      composeBackbone(element);
38097      if (element.hasCondition()) {
38098        composeReference("condition", element.getCondition());
38099      }
38100      if (element.hasRole()) {
38101        composeCodeableConcept("role", element.getRole());
38102      }
38103      if (element.hasRankElement()) {
38104        composePositiveIntCore("rank", element.getRankElement(), false);
38105        composePositiveIntExtras("rank", element.getRankElement(), false);
38106      }
38107  }
38108
38109  protected void composeEncounterEncounterHospitalizationComponent(String name, Encounter.EncounterHospitalizationComponent element) throws IOException {
38110    if (element != null) {
38111      open(name);
38112      composeEncounterEncounterHospitalizationComponentInner(element);
38113      close();
38114    }
38115  }
38116
38117  protected void composeEncounterEncounterHospitalizationComponentInner(Encounter.EncounterHospitalizationComponent element) throws IOException {
38118      composeBackbone(element);
38119      if (element.hasPreAdmissionIdentifier()) {
38120        composeIdentifier("preAdmissionIdentifier", element.getPreAdmissionIdentifier());
38121      }
38122      if (element.hasOrigin()) {
38123        composeReference("origin", element.getOrigin());
38124      }
38125      if (element.hasAdmitSource()) {
38126        composeCodeableConcept("admitSource", element.getAdmitSource());
38127      }
38128      if (element.hasReAdmission()) {
38129        composeCodeableConcept("reAdmission", element.getReAdmission());
38130      }
38131      if (element.hasDietPreference()) {
38132        openArray("dietPreference");
38133        for (CodeableConcept e : element.getDietPreference()) 
38134          composeCodeableConcept(null, e);
38135        closeArray();
38136      };
38137      if (element.hasSpecialCourtesy()) {
38138        openArray("specialCourtesy");
38139        for (CodeableConcept e : element.getSpecialCourtesy()) 
38140          composeCodeableConcept(null, e);
38141        closeArray();
38142      };
38143      if (element.hasSpecialArrangement()) {
38144        openArray("specialArrangement");
38145        for (CodeableConcept e : element.getSpecialArrangement()) 
38146          composeCodeableConcept(null, e);
38147        closeArray();
38148      };
38149      if (element.hasDestination()) {
38150        composeReference("destination", element.getDestination());
38151      }
38152      if (element.hasDischargeDisposition()) {
38153        composeCodeableConcept("dischargeDisposition", element.getDischargeDisposition());
38154      }
38155  }
38156
38157  protected void composeEncounterEncounterLocationComponent(String name, Encounter.EncounterLocationComponent element) throws IOException {
38158    if (element != null) {
38159      open(name);
38160      composeEncounterEncounterLocationComponentInner(element);
38161      close();
38162    }
38163  }
38164
38165  protected void composeEncounterEncounterLocationComponentInner(Encounter.EncounterLocationComponent element) throws IOException {
38166      composeBackbone(element);
38167      if (element.hasLocation()) {
38168        composeReference("location", element.getLocation());
38169      }
38170      if (element.hasStatusElement()) {
38171        composeEnumerationCore("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
38172        composeEnumerationExtras("status", element.getStatusElement(), new Encounter.EncounterLocationStatusEnumFactory(), false);
38173      }
38174      if (element.hasPeriod()) {
38175        composePeriod("period", element.getPeriod());
38176      }
38177  }
38178
38179  protected void composeEndpoint(String name, Endpoint element) throws IOException {
38180    if (element != null) {
38181      prop("resourceType", name);
38182      composeEndpointInner(element);
38183    }
38184  }
38185
38186  protected void composeEndpointInner(Endpoint element) throws IOException {
38187      composeDomainResourceElements(element);
38188      if (element.hasIdentifier()) {
38189        openArray("identifier");
38190        for (Identifier e : element.getIdentifier()) 
38191          composeIdentifier(null, e);
38192        closeArray();
38193      };
38194      if (element.hasStatusElement()) {
38195        composeEnumerationCore("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
38196        composeEnumerationExtras("status", element.getStatusElement(), new Endpoint.EndpointStatusEnumFactory(), false);
38197      }
38198      if (element.hasConnectionType()) {
38199        composeCoding("connectionType", element.getConnectionType());
38200      }
38201      if (element.hasNameElement()) {
38202        composeStringCore("name", element.getNameElement(), false);
38203        composeStringExtras("name", element.getNameElement(), false);
38204      }
38205      if (element.hasManagingOrganization()) {
38206        composeReference("managingOrganization", element.getManagingOrganization());
38207      }
38208      if (element.hasContact()) {
38209        openArray("contact");
38210        for (ContactPoint e : element.getContact()) 
38211          composeContactPoint(null, e);
38212        closeArray();
38213      };
38214      if (element.hasPeriod()) {
38215        composePeriod("period", element.getPeriod());
38216      }
38217      if (element.hasPayloadType()) {
38218        openArray("payloadType");
38219        for (CodeableConcept e : element.getPayloadType()) 
38220          composeCodeableConcept(null, e);
38221        closeArray();
38222      };
38223      if (element.hasPayloadMimeType()) {
38224        openArray("payloadMimeType");
38225        for (CodeType e : element.getPayloadMimeType()) 
38226          composeCodeCore(null, e, true);
38227        closeArray();
38228        if (anyHasExtras(element.getPayloadMimeType())) {
38229          openArray("_payloadMimeType");
38230          for (CodeType e : element.getPayloadMimeType()) 
38231            composeCodeExtras(null, e, true);
38232          closeArray();
38233        }
38234      };
38235      if (element.hasAddressElement()) {
38236        composeUrlCore("address", element.getAddressElement(), false);
38237        composeUrlExtras("address", element.getAddressElement(), false);
38238      }
38239      if (element.hasHeader()) {
38240        openArray("header");
38241        for (StringType e : element.getHeader()) 
38242          composeStringCore(null, e, true);
38243        closeArray();
38244        if (anyHasExtras(element.getHeader())) {
38245          openArray("_header");
38246          for (StringType e : element.getHeader()) 
38247            composeStringExtras(null, e, true);
38248          closeArray();
38249        }
38250      };
38251  }
38252
38253  protected void composeEnrollmentRequest(String name, EnrollmentRequest element) throws IOException {
38254    if (element != null) {
38255      prop("resourceType", name);
38256      composeEnrollmentRequestInner(element);
38257    }
38258  }
38259
38260  protected void composeEnrollmentRequestInner(EnrollmentRequest element) throws IOException {
38261      composeDomainResourceElements(element);
38262      if (element.hasIdentifier()) {
38263        openArray("identifier");
38264        for (Identifier e : element.getIdentifier()) 
38265          composeIdentifier(null, e);
38266        closeArray();
38267      };
38268      if (element.hasStatusElement()) {
38269        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
38270        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentRequest.EnrollmentRequestStatusEnumFactory(), false);
38271      }
38272      if (element.hasCreatedElement()) {
38273        composeDateTimeCore("created", element.getCreatedElement(), false);
38274        composeDateTimeExtras("created", element.getCreatedElement(), false);
38275      }
38276      if (element.hasInsurer()) {
38277        composeReference("insurer", element.getInsurer());
38278      }
38279      if (element.hasProvider()) {
38280        composeReference("provider", element.getProvider());
38281      }
38282      if (element.hasCandidate()) {
38283        composeReference("candidate", element.getCandidate());
38284      }
38285      if (element.hasCoverage()) {
38286        composeReference("coverage", element.getCoverage());
38287      }
38288  }
38289
38290  protected void composeEnrollmentResponse(String name, EnrollmentResponse element) throws IOException {
38291    if (element != null) {
38292      prop("resourceType", name);
38293      composeEnrollmentResponseInner(element);
38294    }
38295  }
38296
38297  protected void composeEnrollmentResponseInner(EnrollmentResponse element) throws IOException {
38298      composeDomainResourceElements(element);
38299      if (element.hasIdentifier()) {
38300        openArray("identifier");
38301        for (Identifier e : element.getIdentifier()) 
38302          composeIdentifier(null, e);
38303        closeArray();
38304      };
38305      if (element.hasStatusElement()) {
38306        composeEnumerationCore("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
38307        composeEnumerationExtras("status", element.getStatusElement(), new EnrollmentResponse.EnrollmentResponseStatusEnumFactory(), false);
38308      }
38309      if (element.hasRequest()) {
38310        composeReference("request", element.getRequest());
38311      }
38312      if (element.hasOutcomeElement()) {
38313        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
38314        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
38315      }
38316      if (element.hasDispositionElement()) {
38317        composeStringCore("disposition", element.getDispositionElement(), false);
38318        composeStringExtras("disposition", element.getDispositionElement(), false);
38319      }
38320      if (element.hasCreatedElement()) {
38321        composeDateTimeCore("created", element.getCreatedElement(), false);
38322        composeDateTimeExtras("created", element.getCreatedElement(), false);
38323      }
38324      if (element.hasOrganization()) {
38325        composeReference("organization", element.getOrganization());
38326      }
38327      if (element.hasRequestProvider()) {
38328        composeReference("requestProvider", element.getRequestProvider());
38329      }
38330  }
38331
38332  protected void composeEpisodeOfCare(String name, EpisodeOfCare element) throws IOException {
38333    if (element != null) {
38334      prop("resourceType", name);
38335      composeEpisodeOfCareInner(element);
38336    }
38337  }
38338
38339  protected void composeEpisodeOfCareInner(EpisodeOfCare element) throws IOException {
38340      composeDomainResourceElements(element);
38341      if (element.hasIdentifier()) {
38342        openArray("identifier");
38343        for (Identifier e : element.getIdentifier()) 
38344          composeIdentifier(null, e);
38345        closeArray();
38346      };
38347      if (element.hasStatusElement()) {
38348        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
38349        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
38350      }
38351      if (element.hasStatusHistory()) {
38352        openArray("statusHistory");
38353        for (EpisodeOfCare.EpisodeOfCareStatusHistoryComponent e : element.getStatusHistory()) 
38354          composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(null, e);
38355        closeArray();
38356      };
38357      if (element.hasType()) {
38358        openArray("type");
38359        for (CodeableConcept e : element.getType()) 
38360          composeCodeableConcept(null, e);
38361        closeArray();
38362      };
38363      if (element.hasDiagnosis()) {
38364        openArray("diagnosis");
38365        for (EpisodeOfCare.DiagnosisComponent e : element.getDiagnosis()) 
38366          composeEpisodeOfCareDiagnosisComponent(null, e);
38367        closeArray();
38368      };
38369      if (element.hasPatient()) {
38370        composeReference("patient", element.getPatient());
38371      }
38372      if (element.hasManagingOrganization()) {
38373        composeReference("managingOrganization", element.getManagingOrganization());
38374      }
38375      if (element.hasPeriod()) {
38376        composePeriod("period", element.getPeriod());
38377      }
38378      if (element.hasReferralRequest()) {
38379        openArray("referralRequest");
38380        for (Reference e : element.getReferralRequest()) 
38381          composeReference(null, e);
38382        closeArray();
38383      };
38384      if (element.hasCareManager()) {
38385        composeReference("careManager", element.getCareManager());
38386      }
38387      if (element.hasTeam()) {
38388        openArray("team");
38389        for (Reference e : element.getTeam()) 
38390          composeReference(null, e);
38391        closeArray();
38392      };
38393      if (element.hasAccount()) {
38394        openArray("account");
38395        for (Reference e : element.getAccount()) 
38396          composeReference(null, e);
38397        closeArray();
38398      };
38399  }
38400
38401  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponent(String name, EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
38402    if (element != null) {
38403      open(name);
38404      composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(element);
38405      close();
38406    }
38407  }
38408
38409  protected void composeEpisodeOfCareEpisodeOfCareStatusHistoryComponentInner(EpisodeOfCare.EpisodeOfCareStatusHistoryComponent element) throws IOException {
38410      composeBackbone(element);
38411      if (element.hasStatusElement()) {
38412        composeEnumerationCore("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
38413        composeEnumerationExtras("status", element.getStatusElement(), new EpisodeOfCare.EpisodeOfCareStatusEnumFactory(), false);
38414      }
38415      if (element.hasPeriod()) {
38416        composePeriod("period", element.getPeriod());
38417      }
38418  }
38419
38420  protected void composeEpisodeOfCareDiagnosisComponent(String name, EpisodeOfCare.DiagnosisComponent element) throws IOException {
38421    if (element != null) {
38422      open(name);
38423      composeEpisodeOfCareDiagnosisComponentInner(element);
38424      close();
38425    }
38426  }
38427
38428  protected void composeEpisodeOfCareDiagnosisComponentInner(EpisodeOfCare.DiagnosisComponent element) throws IOException {
38429      composeBackbone(element);
38430      if (element.hasCondition()) {
38431        composeReference("condition", element.getCondition());
38432      }
38433      if (element.hasRole()) {
38434        composeCodeableConcept("role", element.getRole());
38435      }
38436      if (element.hasRankElement()) {
38437        composePositiveIntCore("rank", element.getRankElement(), false);
38438        composePositiveIntExtras("rank", element.getRankElement(), false);
38439      }
38440  }
38441
38442  protected void composeEventDefinition(String name, EventDefinition element) throws IOException {
38443    if (element != null) {
38444      prop("resourceType", name);
38445      composeEventDefinitionInner(element);
38446    }
38447  }
38448
38449  protected void composeEventDefinitionInner(EventDefinition element) throws IOException {
38450      composeDomainResourceElements(element);
38451      if (element.hasUrlElement()) {
38452        composeUriCore("url", element.getUrlElement(), false);
38453        composeUriExtras("url", element.getUrlElement(), false);
38454      }
38455      if (element.hasIdentifier()) {
38456        openArray("identifier");
38457        for (Identifier e : element.getIdentifier()) 
38458          composeIdentifier(null, e);
38459        closeArray();
38460      };
38461      if (element.hasVersionElement()) {
38462        composeStringCore("version", element.getVersionElement(), false);
38463        composeStringExtras("version", element.getVersionElement(), false);
38464      }
38465      if (element.hasNameElement()) {
38466        composeStringCore("name", element.getNameElement(), false);
38467        composeStringExtras("name", element.getNameElement(), false);
38468      }
38469      if (element.hasTitleElement()) {
38470        composeStringCore("title", element.getTitleElement(), false);
38471        composeStringExtras("title", element.getTitleElement(), false);
38472      }
38473      if (element.hasSubtitleElement()) {
38474        composeStringCore("subtitle", element.getSubtitleElement(), false);
38475        composeStringExtras("subtitle", element.getSubtitleElement(), false);
38476      }
38477      if (element.hasStatusElement()) {
38478        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38479        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38480      }
38481      if (element.hasExperimentalElement()) {
38482        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38483        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38484      }
38485      if (element.hasSubject()) {
38486        composeType("subject", element.getSubject());
38487      }
38488      if (element.hasDateElement()) {
38489        composeDateTimeCore("date", element.getDateElement(), false);
38490        composeDateTimeExtras("date", element.getDateElement(), false);
38491      }
38492      if (element.hasPublisherElement()) {
38493        composeStringCore("publisher", element.getPublisherElement(), false);
38494        composeStringExtras("publisher", element.getPublisherElement(), false);
38495      }
38496      if (element.hasContact()) {
38497        openArray("contact");
38498        for (ContactDetail e : element.getContact()) 
38499          composeContactDetail(null, e);
38500        closeArray();
38501      };
38502      if (element.hasDescriptionElement()) {
38503        composeMarkdownCore("description", element.getDescriptionElement(), false);
38504        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38505      }
38506      if (element.hasUseContext()) {
38507        openArray("useContext");
38508        for (UsageContext e : element.getUseContext()) 
38509          composeUsageContext(null, e);
38510        closeArray();
38511      };
38512      if (element.hasJurisdiction()) {
38513        openArray("jurisdiction");
38514        for (CodeableConcept e : element.getJurisdiction()) 
38515          composeCodeableConcept(null, e);
38516        closeArray();
38517      };
38518      if (element.hasPurposeElement()) {
38519        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38520        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38521      }
38522      if (element.hasUsageElement()) {
38523        composeStringCore("usage", element.getUsageElement(), false);
38524        composeStringExtras("usage", element.getUsageElement(), false);
38525      }
38526      if (element.hasCopyrightElement()) {
38527        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
38528        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
38529      }
38530      if (element.hasApprovalDateElement()) {
38531        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
38532        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
38533      }
38534      if (element.hasLastReviewDateElement()) {
38535        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
38536        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
38537      }
38538      if (element.hasEffectivePeriod()) {
38539        composePeriod("effectivePeriod", element.getEffectivePeriod());
38540      }
38541      if (element.hasTopic()) {
38542        openArray("topic");
38543        for (CodeableConcept e : element.getTopic()) 
38544          composeCodeableConcept(null, e);
38545        closeArray();
38546      };
38547      if (element.hasAuthor()) {
38548        openArray("author");
38549        for (ContactDetail e : element.getAuthor()) 
38550          composeContactDetail(null, e);
38551        closeArray();
38552      };
38553      if (element.hasEditor()) {
38554        openArray("editor");
38555        for (ContactDetail e : element.getEditor()) 
38556          composeContactDetail(null, e);
38557        closeArray();
38558      };
38559      if (element.hasReviewer()) {
38560        openArray("reviewer");
38561        for (ContactDetail e : element.getReviewer()) 
38562          composeContactDetail(null, e);
38563        closeArray();
38564      };
38565      if (element.hasEndorser()) {
38566        openArray("endorser");
38567        for (ContactDetail e : element.getEndorser()) 
38568          composeContactDetail(null, e);
38569        closeArray();
38570      };
38571      if (element.hasRelatedArtifact()) {
38572        openArray("relatedArtifact");
38573        for (RelatedArtifact e : element.getRelatedArtifact()) 
38574          composeRelatedArtifact(null, e);
38575        closeArray();
38576      };
38577      if (element.hasTrigger()) {
38578        composeTriggerDefinition("trigger", element.getTrigger());
38579      }
38580  }
38581
38582  protected void composeExampleScenario(String name, ExampleScenario element) throws IOException {
38583    if (element != null) {
38584      prop("resourceType", name);
38585      composeExampleScenarioInner(element);
38586    }
38587  }
38588
38589  protected void composeExampleScenarioInner(ExampleScenario element) throws IOException {
38590      composeDomainResourceElements(element);
38591      if (element.hasUrlElement()) {
38592        composeUriCore("url", element.getUrlElement(), false);
38593        composeUriExtras("url", element.getUrlElement(), false);
38594      }
38595      if (element.hasIdentifier()) {
38596        openArray("identifier");
38597        for (Identifier e : element.getIdentifier()) 
38598          composeIdentifier(null, e);
38599        closeArray();
38600      };
38601      if (element.hasVersionElement()) {
38602        composeStringCore("version", element.getVersionElement(), false);
38603        composeStringExtras("version", element.getVersionElement(), false);
38604      }
38605      if (element.hasNameElement()) {
38606        composeStringCore("name", element.getNameElement(), false);
38607        composeStringExtras("name", element.getNameElement(), false);
38608      }
38609      if (element.hasStatusElement()) {
38610        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38611        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
38612      }
38613      if (element.hasExperimentalElement()) {
38614        composeBooleanCore("experimental", element.getExperimentalElement(), false);
38615        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
38616      }
38617      if (element.hasDateElement()) {
38618        composeDateTimeCore("date", element.getDateElement(), false);
38619        composeDateTimeExtras("date", element.getDateElement(), false);
38620      }
38621      if (element.hasPublisherElement()) {
38622        composeStringCore("publisher", element.getPublisherElement(), false);
38623        composeStringExtras("publisher", element.getPublisherElement(), false);
38624      }
38625      if (element.hasContact()) {
38626        openArray("contact");
38627        for (ContactDetail e : element.getContact()) 
38628          composeContactDetail(null, e);
38629        closeArray();
38630      };
38631      if (element.hasUseContext()) {
38632        openArray("useContext");
38633        for (UsageContext e : element.getUseContext()) 
38634          composeUsageContext(null, e);
38635        closeArray();
38636      };
38637      if (element.hasJurisdiction()) {
38638        openArray("jurisdiction");
38639        for (CodeableConcept e : element.getJurisdiction()) 
38640          composeCodeableConcept(null, e);
38641        closeArray();
38642      };
38643      if (element.hasCopyrightElement()) {
38644        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
38645        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
38646      }
38647      if (element.hasPurposeElement()) {
38648        composeMarkdownCore("purpose", element.getPurposeElement(), false);
38649        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
38650      }
38651      if (element.hasActor()) {
38652        openArray("actor");
38653        for (ExampleScenario.ExampleScenarioActorComponent e : element.getActor()) 
38654          composeExampleScenarioExampleScenarioActorComponent(null, e);
38655        closeArray();
38656      };
38657      if (element.hasInstance()) {
38658        openArray("instance");
38659        for (ExampleScenario.ExampleScenarioInstanceComponent e : element.getInstance()) 
38660          composeExampleScenarioExampleScenarioInstanceComponent(null, e);
38661        closeArray();
38662      };
38663      if (element.hasProcess()) {
38664        openArray("process");
38665        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
38666          composeExampleScenarioExampleScenarioProcessComponent(null, e);
38667        closeArray();
38668      };
38669      if (element.hasWorkflow()) {
38670        openArray("workflow");
38671        for (CanonicalType e : element.getWorkflow()) 
38672          composeCanonicalCore(null, e, true);
38673        closeArray();
38674        if (anyHasExtras(element.getWorkflow())) {
38675          openArray("_workflow");
38676          for (CanonicalType e : element.getWorkflow()) 
38677            composeCanonicalExtras(null, e, true);
38678          closeArray();
38679        }
38680      };
38681  }
38682
38683  protected void composeExampleScenarioExampleScenarioActorComponent(String name, ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
38684    if (element != null) {
38685      open(name);
38686      composeExampleScenarioExampleScenarioActorComponentInner(element);
38687      close();
38688    }
38689  }
38690
38691  protected void composeExampleScenarioExampleScenarioActorComponentInner(ExampleScenario.ExampleScenarioActorComponent element) throws IOException {
38692      composeBackbone(element);
38693      if (element.hasActorIdElement()) {
38694        composeStringCore("actorId", element.getActorIdElement(), false);
38695        composeStringExtras("actorId", element.getActorIdElement(), false);
38696      }
38697      if (element.hasTypeElement()) {
38698        composeEnumerationCore("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
38699        composeEnumerationExtras("type", element.getTypeElement(), new ExampleScenario.ExampleScenarioActorTypeEnumFactory(), false);
38700      }
38701      if (element.hasNameElement()) {
38702        composeStringCore("name", element.getNameElement(), false);
38703        composeStringExtras("name", element.getNameElement(), false);
38704      }
38705      if (element.hasDescriptionElement()) {
38706        composeMarkdownCore("description", element.getDescriptionElement(), false);
38707        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38708      }
38709  }
38710
38711  protected void composeExampleScenarioExampleScenarioInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
38712    if (element != null) {
38713      open(name);
38714      composeExampleScenarioExampleScenarioInstanceComponentInner(element);
38715      close();
38716    }
38717  }
38718
38719  protected void composeExampleScenarioExampleScenarioInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceComponent element) throws IOException {
38720      composeBackbone(element);
38721      if (element.hasResourceIdElement()) {
38722        composeStringCore("resourceId", element.getResourceIdElement(), false);
38723        composeStringExtras("resourceId", element.getResourceIdElement(), false);
38724      }
38725      if (element.hasResourceTypeElement()) {
38726        composeEnumerationCore("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
38727        composeEnumerationExtras("resourceType", element.getResourceTypeElement(), new ExampleScenario.FHIRResourceTypeEnumFactory(), false);
38728      }
38729      if (element.hasNameElement()) {
38730        composeStringCore("name", element.getNameElement(), false);
38731        composeStringExtras("name", element.getNameElement(), false);
38732      }
38733      if (element.hasDescriptionElement()) {
38734        composeMarkdownCore("description", element.getDescriptionElement(), false);
38735        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38736      }
38737      if (element.hasVersion()) {
38738        openArray("version");
38739        for (ExampleScenario.ExampleScenarioInstanceVersionComponent e : element.getVersion()) 
38740          composeExampleScenarioExampleScenarioInstanceVersionComponent(null, e);
38741        closeArray();
38742      };
38743      if (element.hasContainedInstance()) {
38744        openArray("containedInstance");
38745        for (ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent e : element.getContainedInstance()) 
38746          composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(null, e);
38747        closeArray();
38748      };
38749  }
38750
38751  protected void composeExampleScenarioExampleScenarioInstanceVersionComponent(String name, ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
38752    if (element != null) {
38753      open(name);
38754      composeExampleScenarioExampleScenarioInstanceVersionComponentInner(element);
38755      close();
38756    }
38757  }
38758
38759  protected void composeExampleScenarioExampleScenarioInstanceVersionComponentInner(ExampleScenario.ExampleScenarioInstanceVersionComponent element) throws IOException {
38760      composeBackbone(element);
38761      if (element.hasVersionIdElement()) {
38762        composeStringCore("versionId", element.getVersionIdElement(), false);
38763        composeStringExtras("versionId", element.getVersionIdElement(), false);
38764      }
38765      if (element.hasDescriptionElement()) {
38766        composeMarkdownCore("description", element.getDescriptionElement(), false);
38767        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38768      }
38769  }
38770
38771  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent(String name, ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
38772    if (element != null) {
38773      open(name);
38774      composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(element);
38775      close();
38776    }
38777  }
38778
38779  protected void composeExampleScenarioExampleScenarioInstanceContainedInstanceComponentInner(ExampleScenario.ExampleScenarioInstanceContainedInstanceComponent element) throws IOException {
38780      composeBackbone(element);
38781      if (element.hasResourceIdElement()) {
38782        composeStringCore("resourceId", element.getResourceIdElement(), false);
38783        composeStringExtras("resourceId", element.getResourceIdElement(), false);
38784      }
38785      if (element.hasVersionIdElement()) {
38786        composeStringCore("versionId", element.getVersionIdElement(), false);
38787        composeStringExtras("versionId", element.getVersionIdElement(), false);
38788      }
38789  }
38790
38791  protected void composeExampleScenarioExampleScenarioProcessComponent(String name, ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
38792    if (element != null) {
38793      open(name);
38794      composeExampleScenarioExampleScenarioProcessComponentInner(element);
38795      close();
38796    }
38797  }
38798
38799  protected void composeExampleScenarioExampleScenarioProcessComponentInner(ExampleScenario.ExampleScenarioProcessComponent element) throws IOException {
38800      composeBackbone(element);
38801      if (element.hasTitleElement()) {
38802        composeStringCore("title", element.getTitleElement(), false);
38803        composeStringExtras("title", element.getTitleElement(), false);
38804      }
38805      if (element.hasDescriptionElement()) {
38806        composeMarkdownCore("description", element.getDescriptionElement(), false);
38807        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38808      }
38809      if (element.hasPreConditionsElement()) {
38810        composeMarkdownCore("preConditions", element.getPreConditionsElement(), false);
38811        composeMarkdownExtras("preConditions", element.getPreConditionsElement(), false);
38812      }
38813      if (element.hasPostConditionsElement()) {
38814        composeMarkdownCore("postConditions", element.getPostConditionsElement(), false);
38815        composeMarkdownExtras("postConditions", element.getPostConditionsElement(), false);
38816      }
38817      if (element.hasStep()) {
38818        openArray("step");
38819        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
38820          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
38821        closeArray();
38822      };
38823  }
38824
38825  protected void composeExampleScenarioExampleScenarioProcessStepComponent(String name, ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
38826    if (element != null) {
38827      open(name);
38828      composeExampleScenarioExampleScenarioProcessStepComponentInner(element);
38829      close();
38830    }
38831  }
38832
38833  protected void composeExampleScenarioExampleScenarioProcessStepComponentInner(ExampleScenario.ExampleScenarioProcessStepComponent element) throws IOException {
38834      composeBackbone(element);
38835      if (element.hasProcess()) {
38836        openArray("process");
38837        for (ExampleScenario.ExampleScenarioProcessComponent e : element.getProcess()) 
38838          composeExampleScenarioExampleScenarioProcessComponent(null, e);
38839        closeArray();
38840      };
38841      if (element.hasPauseElement()) {
38842        composeBooleanCore("pause", element.getPauseElement(), false);
38843        composeBooleanExtras("pause", element.getPauseElement(), false);
38844      }
38845      if (element.hasOperation()) {
38846        composeExampleScenarioExampleScenarioProcessStepOperationComponent("operation", element.getOperation());
38847      }
38848      if (element.hasAlternative()) {
38849        composeExampleScenarioExampleScenarioProcessStepAlternativeComponent("alternative", element.getAlternative());
38850      }
38851  }
38852
38853  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponent(String name, ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
38854    if (element != null) {
38855      open(name);
38856      composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(element);
38857      close();
38858    }
38859  }
38860
38861  protected void composeExampleScenarioExampleScenarioProcessStepOperationComponentInner(ExampleScenario.ExampleScenarioProcessStepOperationComponent element) throws IOException {
38862      composeBackbone(element);
38863      if (element.hasNumberElement()) {
38864        composeStringCore("number", element.getNumberElement(), false);
38865        composeStringExtras("number", element.getNumberElement(), false);
38866      }
38867      if (element.hasTypeElement()) {
38868        composeStringCore("type", element.getTypeElement(), false);
38869        composeStringExtras("type", element.getTypeElement(), false);
38870      }
38871      if (element.hasNameElement()) {
38872        composeStringCore("name", element.getNameElement(), false);
38873        composeStringExtras("name", element.getNameElement(), false);
38874      }
38875      if (element.hasInitiatorElement()) {
38876        composeStringCore("initiator", element.getInitiatorElement(), false);
38877        composeStringExtras("initiator", element.getInitiatorElement(), false);
38878      }
38879      if (element.hasReceiverElement()) {
38880        composeStringCore("receiver", element.getReceiverElement(), false);
38881        composeStringExtras("receiver", element.getReceiverElement(), false);
38882      }
38883      if (element.hasDescriptionElement()) {
38884        composeMarkdownCore("description", element.getDescriptionElement(), false);
38885        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38886      }
38887      if (element.hasInitiatorActiveElement()) {
38888        composeBooleanCore("initiatorActive", element.getInitiatorActiveElement(), false);
38889        composeBooleanExtras("initiatorActive", element.getInitiatorActiveElement(), false);
38890      }
38891      if (element.hasReceiverActiveElement()) {
38892        composeBooleanCore("receiverActive", element.getReceiverActiveElement(), false);
38893        composeBooleanExtras("receiverActive", element.getReceiverActiveElement(), false);
38894      }
38895      if (element.hasRequest()) {
38896        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("request", element.getRequest());
38897      }
38898      if (element.hasResponse()) {
38899        composeExampleScenarioExampleScenarioInstanceContainedInstanceComponent("response", element.getResponse());
38900      }
38901  }
38902
38903  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
38904    if (element != null) {
38905      open(name);
38906      composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(element);
38907      close();
38908    }
38909  }
38910
38911  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeComponentInner(ExampleScenario.ExampleScenarioProcessStepAlternativeComponent element) throws IOException {
38912      composeBackbone(element);
38913      if (element.hasNameElement()) {
38914        composeStringCore("name", element.getNameElement(), false);
38915        composeStringExtras("name", element.getNameElement(), false);
38916      }
38917      if (element.hasOption()) {
38918        openArray("option");
38919        for (ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent e : element.getOption()) 
38920          composeExampleScenarioExampleScenarioProcessStepAlternativeOptionComponent(null, e);
38921        closeArray();
38922      };
38923  }
38924
38925  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeOptionComponent(String name, ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent element) throws IOException {
38926    if (element != null) {
38927      open(name);
38928      composeExampleScenarioExampleScenarioProcessStepAlternativeOptionComponentInner(element);
38929      close();
38930    }
38931  }
38932
38933  protected void composeExampleScenarioExampleScenarioProcessStepAlternativeOptionComponentInner(ExampleScenario.ExampleScenarioProcessStepAlternativeOptionComponent element) throws IOException {
38934      composeBackbone(element);
38935      if (element.hasDescriptionElement()) {
38936        composeMarkdownCore("description", element.getDescriptionElement(), false);
38937        composeMarkdownExtras("description", element.getDescriptionElement(), false);
38938      }
38939      if (element.hasStep()) {
38940        openArray("step");
38941        for (ExampleScenario.ExampleScenarioProcessStepComponent e : element.getStep()) 
38942          composeExampleScenarioExampleScenarioProcessStepComponent(null, e);
38943        closeArray();
38944      };
38945      if (element.hasPause()) {
38946        openArray("pause");
38947        for (BooleanType e : element.getPause()) 
38948          composeBooleanCore(null, e, true);
38949        closeArray();
38950        if (anyHasExtras(element.getPause())) {
38951          openArray("_pause");
38952          for (BooleanType e : element.getPause()) 
38953            composeBooleanExtras(null, e, true);
38954          closeArray();
38955        }
38956      };
38957  }
38958
38959  protected void composeExplanationOfBenefit(String name, ExplanationOfBenefit element) throws IOException {
38960    if (element != null) {
38961      prop("resourceType", name);
38962      composeExplanationOfBenefitInner(element);
38963    }
38964  }
38965
38966  protected void composeExplanationOfBenefitInner(ExplanationOfBenefit element) throws IOException {
38967      composeDomainResourceElements(element);
38968      if (element.hasIdentifier()) {
38969        openArray("identifier");
38970        for (Identifier e : element.getIdentifier()) 
38971          composeIdentifier(null, e);
38972        closeArray();
38973      };
38974      if (element.hasStatusElement()) {
38975        composeEnumerationCore("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
38976        composeEnumerationExtras("status", element.getStatusElement(), new ExplanationOfBenefit.ExplanationOfBenefitStatusEnumFactory(), false);
38977      }
38978      if (element.hasType()) {
38979        composeCodeableConcept("type", element.getType());
38980      }
38981      if (element.hasSubType()) {
38982        composeCodeableConcept("subType", element.getSubType());
38983      }
38984      if (element.hasUseElement()) {
38985        composeEnumerationCore("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
38986        composeEnumerationExtras("use", element.getUseElement(), new ExplanationOfBenefit.UseEnumFactory(), false);
38987      }
38988      if (element.hasPatient()) {
38989        composeReference("patient", element.getPatient());
38990      }
38991      if (element.hasBillablePeriod()) {
38992        composePeriod("billablePeriod", element.getBillablePeriod());
38993      }
38994      if (element.hasCreatedElement()) {
38995        composeDateTimeCore("created", element.getCreatedElement(), false);
38996        composeDateTimeExtras("created", element.getCreatedElement(), false);
38997      }
38998      if (element.hasEnterer()) {
38999        composeReference("enterer", element.getEnterer());
39000      }
39001      if (element.hasInsurer()) {
39002        composeReference("insurer", element.getInsurer());
39003      }
39004      if (element.hasProvider()) {
39005        composeReference("provider", element.getProvider());
39006      }
39007      if (element.hasReferral()) {
39008        composeReference("referral", element.getReferral());
39009      }
39010      if (element.hasFacility()) {
39011        composeReference("facility", element.getFacility());
39012      }
39013      if (element.hasClaim()) {
39014        composeReference("claim", element.getClaim());
39015      }
39016      if (element.hasClaimResponse()) {
39017        composeReference("claimResponse", element.getClaimResponse());
39018      }
39019      if (element.hasOutcomeElement()) {
39020        composeEnumerationCore("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
39021        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ExplanationOfBenefit.RemittanceOutcomeEnumFactory(), false);
39022      }
39023      if (element.hasDispositionElement()) {
39024        composeStringCore("disposition", element.getDispositionElement(), false);
39025        composeStringExtras("disposition", element.getDispositionElement(), false);
39026      }
39027      if (element.hasRelated()) {
39028        openArray("related");
39029        for (ExplanationOfBenefit.RelatedClaimComponent e : element.getRelated()) 
39030          composeExplanationOfBenefitRelatedClaimComponent(null, e);
39031        closeArray();
39032      };
39033      if (element.hasPrescription()) {
39034        composeReference("prescription", element.getPrescription());
39035      }
39036      if (element.hasOriginalPrescription()) {
39037        composeReference("originalPrescription", element.getOriginalPrescription());
39038      }
39039      if (element.hasPayee()) {
39040        composeExplanationOfBenefitPayeeComponent("payee", element.getPayee());
39041      }
39042      if (element.hasInformation()) {
39043        openArray("information");
39044        for (ExplanationOfBenefit.SupportingInformationComponent e : element.getInformation()) 
39045          composeExplanationOfBenefitSupportingInformationComponent(null, e);
39046        closeArray();
39047      };
39048      if (element.hasCareTeam()) {
39049        openArray("careTeam");
39050        for (ExplanationOfBenefit.CareTeamComponent e : element.getCareTeam()) 
39051          composeExplanationOfBenefitCareTeamComponent(null, e);
39052        closeArray();
39053      };
39054      if (element.hasDiagnosis()) {
39055        openArray("diagnosis");
39056        for (ExplanationOfBenefit.DiagnosisComponent e : element.getDiagnosis()) 
39057          composeExplanationOfBenefitDiagnosisComponent(null, e);
39058        closeArray();
39059      };
39060      if (element.hasProcedure()) {
39061        openArray("procedure");
39062        for (ExplanationOfBenefit.ProcedureComponent e : element.getProcedure()) 
39063          composeExplanationOfBenefitProcedureComponent(null, e);
39064        closeArray();
39065      };
39066      if (element.hasPrecedenceElement()) {
39067        composePositiveIntCore("precedence", element.getPrecedenceElement(), false);
39068        composePositiveIntExtras("precedence", element.getPrecedenceElement(), false);
39069      }
39070      if (element.hasInsurance()) {
39071        openArray("insurance");
39072        for (ExplanationOfBenefit.InsuranceComponent e : element.getInsurance()) 
39073          composeExplanationOfBenefitInsuranceComponent(null, e);
39074        closeArray();
39075      };
39076      if (element.hasAccident()) {
39077        composeExplanationOfBenefitAccidentComponent("accident", element.getAccident());
39078      }
39079      if (element.hasItem()) {
39080        openArray("item");
39081        for (ExplanationOfBenefit.ItemComponent e : element.getItem()) 
39082          composeExplanationOfBenefitItemComponent(null, e);
39083        closeArray();
39084      };
39085      if (element.hasAddItem()) {
39086        openArray("addItem");
39087        for (ExplanationOfBenefit.AddedItemComponent e : element.getAddItem()) 
39088          composeExplanationOfBenefitAddedItemComponent(null, e);
39089        closeArray();
39090      };
39091      if (element.hasTotal()) {
39092        openArray("total");
39093        for (ExplanationOfBenefit.TotalComponent e : element.getTotal()) 
39094          composeExplanationOfBenefitTotalComponent(null, e);
39095        closeArray();
39096      };
39097      if (element.hasPayment()) {
39098        composeExplanationOfBenefitPaymentComponent("payment", element.getPayment());
39099      }
39100      if (element.hasForm()) {
39101        composeCodeableConcept("form", element.getForm());
39102      }
39103      if (element.hasProcessNote()) {
39104        openArray("processNote");
39105        for (ExplanationOfBenefit.NoteComponent e : element.getProcessNote()) 
39106          composeExplanationOfBenefitNoteComponent(null, e);
39107        closeArray();
39108      };
39109      if (element.hasBenefitBalance()) {
39110        openArray("benefitBalance");
39111        for (ExplanationOfBenefit.BenefitBalanceComponent e : element.getBenefitBalance()) 
39112          composeExplanationOfBenefitBenefitBalanceComponent(null, e);
39113        closeArray();
39114      };
39115  }
39116
39117  protected void composeExplanationOfBenefitRelatedClaimComponent(String name, ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
39118    if (element != null) {
39119      open(name);
39120      composeExplanationOfBenefitRelatedClaimComponentInner(element);
39121      close();
39122    }
39123  }
39124
39125  protected void composeExplanationOfBenefitRelatedClaimComponentInner(ExplanationOfBenefit.RelatedClaimComponent element) throws IOException {
39126      composeBackbone(element);
39127      if (element.hasClaim()) {
39128        composeReference("claim", element.getClaim());
39129      }
39130      if (element.hasRelationship()) {
39131        composeCodeableConcept("relationship", element.getRelationship());
39132      }
39133      if (element.hasReference()) {
39134        composeIdentifier("reference", element.getReference());
39135      }
39136  }
39137
39138  protected void composeExplanationOfBenefitPayeeComponent(String name, ExplanationOfBenefit.PayeeComponent element) throws IOException {
39139    if (element != null) {
39140      open(name);
39141      composeExplanationOfBenefitPayeeComponentInner(element);
39142      close();
39143    }
39144  }
39145
39146  protected void composeExplanationOfBenefitPayeeComponentInner(ExplanationOfBenefit.PayeeComponent element) throws IOException {
39147      composeBackbone(element);
39148      if (element.hasType()) {
39149        composeCodeableConcept("type", element.getType());
39150      }
39151      if (element.hasResource()) {
39152        composeCoding("resource", element.getResource());
39153      }
39154      if (element.hasParty()) {
39155        composeReference("party", element.getParty());
39156      }
39157  }
39158
39159  protected void composeExplanationOfBenefitSupportingInformationComponent(String name, ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
39160    if (element != null) {
39161      open(name);
39162      composeExplanationOfBenefitSupportingInformationComponentInner(element);
39163      close();
39164    }
39165  }
39166
39167  protected void composeExplanationOfBenefitSupportingInformationComponentInner(ExplanationOfBenefit.SupportingInformationComponent element) throws IOException {
39168      composeBackbone(element);
39169      if (element.hasSequenceElement()) {
39170        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39171        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39172      }
39173      if (element.hasCategory()) {
39174        composeCodeableConcept("category", element.getCategory());
39175      }
39176      if (element.hasCode()) {
39177        composeCodeableConcept("code", element.getCode());
39178      }
39179      if (element.hasTiming()) {
39180        composeType("timing", element.getTiming());
39181      }
39182      if (element.hasValue()) {
39183        composeType("value", element.getValue());
39184      }
39185      if (element.hasReason()) {
39186        composeCoding("reason", element.getReason());
39187      }
39188  }
39189
39190  protected void composeExplanationOfBenefitCareTeamComponent(String name, ExplanationOfBenefit.CareTeamComponent element) throws IOException {
39191    if (element != null) {
39192      open(name);
39193      composeExplanationOfBenefitCareTeamComponentInner(element);
39194      close();
39195    }
39196  }
39197
39198  protected void composeExplanationOfBenefitCareTeamComponentInner(ExplanationOfBenefit.CareTeamComponent element) throws IOException {
39199      composeBackbone(element);
39200      if (element.hasSequenceElement()) {
39201        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39202        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39203      }
39204      if (element.hasProvider()) {
39205        composeReference("provider", element.getProvider());
39206      }
39207      if (element.hasResponsibleElement()) {
39208        composeBooleanCore("responsible", element.getResponsibleElement(), false);
39209        composeBooleanExtras("responsible", element.getResponsibleElement(), false);
39210      }
39211      if (element.hasRole()) {
39212        composeCodeableConcept("role", element.getRole());
39213      }
39214      if (element.hasQualification()) {
39215        composeCodeableConcept("qualification", element.getQualification());
39216      }
39217  }
39218
39219  protected void composeExplanationOfBenefitDiagnosisComponent(String name, ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
39220    if (element != null) {
39221      open(name);
39222      composeExplanationOfBenefitDiagnosisComponentInner(element);
39223      close();
39224    }
39225  }
39226
39227  protected void composeExplanationOfBenefitDiagnosisComponentInner(ExplanationOfBenefit.DiagnosisComponent element) throws IOException {
39228      composeBackbone(element);
39229      if (element.hasSequenceElement()) {
39230        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39231        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39232      }
39233      if (element.hasDiagnosis()) {
39234        composeType("diagnosis", element.getDiagnosis());
39235      }
39236      if (element.hasType()) {
39237        openArray("type");
39238        for (CodeableConcept e : element.getType()) 
39239          composeCodeableConcept(null, e);
39240        closeArray();
39241      };
39242      if (element.hasOnAdmission()) {
39243        composeCodeableConcept("onAdmission", element.getOnAdmission());
39244      }
39245      if (element.hasPackageCode()) {
39246        composeCodeableConcept("packageCode", element.getPackageCode());
39247      }
39248  }
39249
39250  protected void composeExplanationOfBenefitProcedureComponent(String name, ExplanationOfBenefit.ProcedureComponent element) throws IOException {
39251    if (element != null) {
39252      open(name);
39253      composeExplanationOfBenefitProcedureComponentInner(element);
39254      close();
39255    }
39256  }
39257
39258  protected void composeExplanationOfBenefitProcedureComponentInner(ExplanationOfBenefit.ProcedureComponent element) throws IOException {
39259      composeBackbone(element);
39260      if (element.hasSequenceElement()) {
39261        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39262        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39263      }
39264      if (element.hasDateElement()) {
39265        composeDateTimeCore("date", element.getDateElement(), false);
39266        composeDateTimeExtras("date", element.getDateElement(), false);
39267      }
39268      if (element.hasProcedure()) {
39269        composeType("procedure", element.getProcedure());
39270      }
39271  }
39272
39273  protected void composeExplanationOfBenefitInsuranceComponent(String name, ExplanationOfBenefit.InsuranceComponent element) throws IOException {
39274    if (element != null) {
39275      open(name);
39276      composeExplanationOfBenefitInsuranceComponentInner(element);
39277      close();
39278    }
39279  }
39280
39281  protected void composeExplanationOfBenefitInsuranceComponentInner(ExplanationOfBenefit.InsuranceComponent element) throws IOException {
39282      composeBackbone(element);
39283      if (element.hasFocalElement()) {
39284        composeBooleanCore("focal", element.getFocalElement(), false);
39285        composeBooleanExtras("focal", element.getFocalElement(), false);
39286      }
39287      if (element.hasCoverage()) {
39288        composeReference("coverage", element.getCoverage());
39289      }
39290  }
39291
39292  protected void composeExplanationOfBenefitAccidentComponent(String name, ExplanationOfBenefit.AccidentComponent element) throws IOException {
39293    if (element != null) {
39294      open(name);
39295      composeExplanationOfBenefitAccidentComponentInner(element);
39296      close();
39297    }
39298  }
39299
39300  protected void composeExplanationOfBenefitAccidentComponentInner(ExplanationOfBenefit.AccidentComponent element) throws IOException {
39301      composeBackbone(element);
39302      if (element.hasDateElement()) {
39303        composeDateCore("date", element.getDateElement(), false);
39304        composeDateExtras("date", element.getDateElement(), false);
39305      }
39306      if (element.hasType()) {
39307        composeCodeableConcept("type", element.getType());
39308      }
39309      if (element.hasLocation()) {
39310        composeType("location", element.getLocation());
39311      }
39312  }
39313
39314  protected void composeExplanationOfBenefitItemComponent(String name, ExplanationOfBenefit.ItemComponent element) throws IOException {
39315    if (element != null) {
39316      open(name);
39317      composeExplanationOfBenefitItemComponentInner(element);
39318      close();
39319    }
39320  }
39321
39322  protected void composeExplanationOfBenefitItemComponentInner(ExplanationOfBenefit.ItemComponent element) throws IOException {
39323      composeBackbone(element);
39324      if (element.hasSequenceElement()) {
39325        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39326        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39327      }
39328      if (element.hasCareTeamSequence()) {
39329        openArray("careTeamSequence");
39330        for (PositiveIntType e : element.getCareTeamSequence()) 
39331          composePositiveIntCore(null, e, true);
39332        closeArray();
39333        if (anyHasExtras(element.getCareTeamSequence())) {
39334          openArray("_careTeamSequence");
39335          for (PositiveIntType e : element.getCareTeamSequence()) 
39336            composePositiveIntExtras(null, e, true);
39337          closeArray();
39338        }
39339      };
39340      if (element.hasDiagnosisSequence()) {
39341        openArray("diagnosisSequence");
39342        for (PositiveIntType e : element.getDiagnosisSequence()) 
39343          composePositiveIntCore(null, e, true);
39344        closeArray();
39345        if (anyHasExtras(element.getDiagnosisSequence())) {
39346          openArray("_diagnosisSequence");
39347          for (PositiveIntType e : element.getDiagnosisSequence()) 
39348            composePositiveIntExtras(null, e, true);
39349          closeArray();
39350        }
39351      };
39352      if (element.hasProcedureSequence()) {
39353        openArray("procedureSequence");
39354        for (PositiveIntType e : element.getProcedureSequence()) 
39355          composePositiveIntCore(null, e, true);
39356        closeArray();
39357        if (anyHasExtras(element.getProcedureSequence())) {
39358          openArray("_procedureSequence");
39359          for (PositiveIntType e : element.getProcedureSequence()) 
39360            composePositiveIntExtras(null, e, true);
39361          closeArray();
39362        }
39363      };
39364      if (element.hasInformationSequence()) {
39365        openArray("informationSequence");
39366        for (PositiveIntType e : element.getInformationSequence()) 
39367          composePositiveIntCore(null, e, true);
39368        closeArray();
39369        if (anyHasExtras(element.getInformationSequence())) {
39370          openArray("_informationSequence");
39371          for (PositiveIntType e : element.getInformationSequence()) 
39372            composePositiveIntExtras(null, e, true);
39373          closeArray();
39374        }
39375      };
39376      if (element.hasRevenue()) {
39377        composeCodeableConcept("revenue", element.getRevenue());
39378      }
39379      if (element.hasCategory()) {
39380        composeCodeableConcept("category", element.getCategory());
39381      }
39382      if (element.hasBillcode()) {
39383        composeCodeableConcept("billcode", element.getBillcode());
39384      }
39385      if (element.hasModifier()) {
39386        openArray("modifier");
39387        for (CodeableConcept e : element.getModifier()) 
39388          composeCodeableConcept(null, e);
39389        closeArray();
39390      };
39391      if (element.hasProgramCode()) {
39392        openArray("programCode");
39393        for (CodeableConcept e : element.getProgramCode()) 
39394          composeCodeableConcept(null, e);
39395        closeArray();
39396      };
39397      if (element.hasServiced()) {
39398        composeType("serviced", element.getServiced());
39399      }
39400      if (element.hasLocation()) {
39401        composeType("location", element.getLocation());
39402      }
39403      if (element.hasQuantity()) {
39404        composeQuantity("quantity", element.getQuantity());
39405      }
39406      if (element.hasUnitPrice()) {
39407        composeMoney("unitPrice", element.getUnitPrice());
39408      }
39409      if (element.hasFactorElement()) {
39410        composeDecimalCore("factor", element.getFactorElement(), false);
39411        composeDecimalExtras("factor", element.getFactorElement(), false);
39412      }
39413      if (element.hasNet()) {
39414        composeMoney("net", element.getNet());
39415      }
39416      if (element.hasUdi()) {
39417        openArray("udi");
39418        for (Reference e : element.getUdi()) 
39419          composeReference(null, e);
39420        closeArray();
39421      };
39422      if (element.hasBodySite()) {
39423        composeCodeableConcept("bodySite", element.getBodySite());
39424      }
39425      if (element.hasSubSite()) {
39426        openArray("subSite");
39427        for (CodeableConcept e : element.getSubSite()) 
39428          composeCodeableConcept(null, e);
39429        closeArray();
39430      };
39431      if (element.hasEncounter()) {
39432        openArray("encounter");
39433        for (Reference e : element.getEncounter()) 
39434          composeReference(null, e);
39435        closeArray();
39436      };
39437      if (element.hasNoteNumber()) {
39438        openArray("noteNumber");
39439        for (PositiveIntType e : element.getNoteNumber()) 
39440          composePositiveIntCore(null, e, true);
39441        closeArray();
39442        if (anyHasExtras(element.getNoteNumber())) {
39443          openArray("_noteNumber");
39444          for (PositiveIntType e : element.getNoteNumber()) 
39445            composePositiveIntExtras(null, e, true);
39446          closeArray();
39447        }
39448      };
39449      if (element.hasAdjudication()) {
39450        openArray("adjudication");
39451        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
39452          composeExplanationOfBenefitAdjudicationComponent(null, e);
39453        closeArray();
39454      };
39455      if (element.hasDetail()) {
39456        openArray("detail");
39457        for (ExplanationOfBenefit.DetailComponent e : element.getDetail()) 
39458          composeExplanationOfBenefitDetailComponent(null, e);
39459        closeArray();
39460      };
39461  }
39462
39463  protected void composeExplanationOfBenefitAdjudicationComponent(String name, ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
39464    if (element != null) {
39465      open(name);
39466      composeExplanationOfBenefitAdjudicationComponentInner(element);
39467      close();
39468    }
39469  }
39470
39471  protected void composeExplanationOfBenefitAdjudicationComponentInner(ExplanationOfBenefit.AdjudicationComponent element) throws IOException {
39472      composeBackbone(element);
39473      if (element.hasCategory()) {
39474        composeCodeableConcept("category", element.getCategory());
39475      }
39476      if (element.hasReason()) {
39477        composeCodeableConcept("reason", element.getReason());
39478      }
39479      if (element.hasAmount()) {
39480        composeMoney("amount", element.getAmount());
39481      }
39482      if (element.hasValueElement()) {
39483        composeDecimalCore("value", element.getValueElement(), false);
39484        composeDecimalExtras("value", element.getValueElement(), false);
39485      }
39486  }
39487
39488  protected void composeExplanationOfBenefitDetailComponent(String name, ExplanationOfBenefit.DetailComponent element) throws IOException {
39489    if (element != null) {
39490      open(name);
39491      composeExplanationOfBenefitDetailComponentInner(element);
39492      close();
39493    }
39494  }
39495
39496  protected void composeExplanationOfBenefitDetailComponentInner(ExplanationOfBenefit.DetailComponent element) throws IOException {
39497      composeBackbone(element);
39498      if (element.hasSequenceElement()) {
39499        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39500        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39501      }
39502      if (element.hasRevenue()) {
39503        composeCodeableConcept("revenue", element.getRevenue());
39504      }
39505      if (element.hasCategory()) {
39506        composeCodeableConcept("category", element.getCategory());
39507      }
39508      if (element.hasBillcode()) {
39509        composeCodeableConcept("billcode", element.getBillcode());
39510      }
39511      if (element.hasModifier()) {
39512        openArray("modifier");
39513        for (CodeableConcept e : element.getModifier()) 
39514          composeCodeableConcept(null, e);
39515        closeArray();
39516      };
39517      if (element.hasProgramCode()) {
39518        openArray("programCode");
39519        for (CodeableConcept e : element.getProgramCode()) 
39520          composeCodeableConcept(null, e);
39521        closeArray();
39522      };
39523      if (element.hasQuantity()) {
39524        composeQuantity("quantity", element.getQuantity());
39525      }
39526      if (element.hasUnitPrice()) {
39527        composeMoney("unitPrice", element.getUnitPrice());
39528      }
39529      if (element.hasFactorElement()) {
39530        composeDecimalCore("factor", element.getFactorElement(), false);
39531        composeDecimalExtras("factor", element.getFactorElement(), false);
39532      }
39533      if (element.hasNet()) {
39534        composeMoney("net", element.getNet());
39535      }
39536      if (element.hasUdi()) {
39537        openArray("udi");
39538        for (Reference e : element.getUdi()) 
39539          composeReference(null, e);
39540        closeArray();
39541      };
39542      if (element.hasNoteNumber()) {
39543        openArray("noteNumber");
39544        for (PositiveIntType e : element.getNoteNumber()) 
39545          composePositiveIntCore(null, e, true);
39546        closeArray();
39547        if (anyHasExtras(element.getNoteNumber())) {
39548          openArray("_noteNumber");
39549          for (PositiveIntType e : element.getNoteNumber()) 
39550            composePositiveIntExtras(null, e, true);
39551          closeArray();
39552        }
39553      };
39554      if (element.hasAdjudication()) {
39555        openArray("adjudication");
39556        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
39557          composeExplanationOfBenefitAdjudicationComponent(null, e);
39558        closeArray();
39559      };
39560      if (element.hasSubDetail()) {
39561        openArray("subDetail");
39562        for (ExplanationOfBenefit.SubDetailComponent e : element.getSubDetail()) 
39563          composeExplanationOfBenefitSubDetailComponent(null, e);
39564        closeArray();
39565      };
39566  }
39567
39568  protected void composeExplanationOfBenefitSubDetailComponent(String name, ExplanationOfBenefit.SubDetailComponent element) throws IOException {
39569    if (element != null) {
39570      open(name);
39571      composeExplanationOfBenefitSubDetailComponentInner(element);
39572      close();
39573    }
39574  }
39575
39576  protected void composeExplanationOfBenefitSubDetailComponentInner(ExplanationOfBenefit.SubDetailComponent element) throws IOException {
39577      composeBackbone(element);
39578      if (element.hasSequenceElement()) {
39579        composePositiveIntCore("sequence", element.getSequenceElement(), false);
39580        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
39581      }
39582      if (element.hasRevenue()) {
39583        composeCodeableConcept("revenue", element.getRevenue());
39584      }
39585      if (element.hasCategory()) {
39586        composeCodeableConcept("category", element.getCategory());
39587      }
39588      if (element.hasBillcode()) {
39589        composeCodeableConcept("billcode", element.getBillcode());
39590      }
39591      if (element.hasModifier()) {
39592        openArray("modifier");
39593        for (CodeableConcept e : element.getModifier()) 
39594          composeCodeableConcept(null, e);
39595        closeArray();
39596      };
39597      if (element.hasProgramCode()) {
39598        openArray("programCode");
39599        for (CodeableConcept e : element.getProgramCode()) 
39600          composeCodeableConcept(null, e);
39601        closeArray();
39602      };
39603      if (element.hasQuantity()) {
39604        composeQuantity("quantity", element.getQuantity());
39605      }
39606      if (element.hasUnitPrice()) {
39607        composeMoney("unitPrice", element.getUnitPrice());
39608      }
39609      if (element.hasFactorElement()) {
39610        composeDecimalCore("factor", element.getFactorElement(), false);
39611        composeDecimalExtras("factor", element.getFactorElement(), false);
39612      }
39613      if (element.hasNet()) {
39614        composeMoney("net", element.getNet());
39615      }
39616      if (element.hasUdi()) {
39617        openArray("udi");
39618        for (Reference e : element.getUdi()) 
39619          composeReference(null, e);
39620        closeArray();
39621      };
39622      if (element.hasNoteNumber()) {
39623        openArray("noteNumber");
39624        for (PositiveIntType e : element.getNoteNumber()) 
39625          composePositiveIntCore(null, e, true);
39626        closeArray();
39627        if (anyHasExtras(element.getNoteNumber())) {
39628          openArray("_noteNumber");
39629          for (PositiveIntType e : element.getNoteNumber()) 
39630            composePositiveIntExtras(null, e, true);
39631          closeArray();
39632        }
39633      };
39634      if (element.hasAdjudication()) {
39635        openArray("adjudication");
39636        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
39637          composeExplanationOfBenefitAdjudicationComponent(null, e);
39638        closeArray();
39639      };
39640  }
39641
39642  protected void composeExplanationOfBenefitAddedItemComponent(String name, ExplanationOfBenefit.AddedItemComponent element) throws IOException {
39643    if (element != null) {
39644      open(name);
39645      composeExplanationOfBenefitAddedItemComponentInner(element);
39646      close();
39647    }
39648  }
39649
39650  protected void composeExplanationOfBenefitAddedItemComponentInner(ExplanationOfBenefit.AddedItemComponent element) throws IOException {
39651      composeBackbone(element);
39652      if (element.hasItemSequence()) {
39653        openArray("itemSequence");
39654        for (PositiveIntType e : element.getItemSequence()) 
39655          composePositiveIntCore(null, e, true);
39656        closeArray();
39657        if (anyHasExtras(element.getItemSequence())) {
39658          openArray("_itemSequence");
39659          for (PositiveIntType e : element.getItemSequence()) 
39660            composePositiveIntExtras(null, e, true);
39661          closeArray();
39662        }
39663      };
39664      if (element.hasDetailSequence()) {
39665        openArray("detailSequence");
39666        for (PositiveIntType e : element.getDetailSequence()) 
39667          composePositiveIntCore(null, e, true);
39668        closeArray();
39669        if (anyHasExtras(element.getDetailSequence())) {
39670          openArray("_detailSequence");
39671          for (PositiveIntType e : element.getDetailSequence()) 
39672            composePositiveIntExtras(null, e, true);
39673          closeArray();
39674        }
39675      };
39676      if (element.hasSubDetailSequence()) {
39677        openArray("subDetailSequence");
39678        for (PositiveIntType e : element.getSubDetailSequence()) 
39679          composePositiveIntCore(null, e, true);
39680        closeArray();
39681        if (anyHasExtras(element.getSubDetailSequence())) {
39682          openArray("_subDetailSequence");
39683          for (PositiveIntType e : element.getSubDetailSequence()) 
39684            composePositiveIntExtras(null, e, true);
39685          closeArray();
39686        }
39687      };
39688      if (element.hasProvider()) {
39689        openArray("provider");
39690        for (Reference e : element.getProvider()) 
39691          composeReference(null, e);
39692        closeArray();
39693      };
39694      if (element.hasBillcode()) {
39695        composeCodeableConcept("billcode", element.getBillcode());
39696      }
39697      if (element.hasModifier()) {
39698        openArray("modifier");
39699        for (CodeableConcept e : element.getModifier()) 
39700          composeCodeableConcept(null, e);
39701        closeArray();
39702      };
39703      if (element.hasProgramCode()) {
39704        openArray("programCode");
39705        for (CodeableConcept e : element.getProgramCode()) 
39706          composeCodeableConcept(null, e);
39707        closeArray();
39708      };
39709      if (element.hasServiced()) {
39710        composeType("serviced", element.getServiced());
39711      }
39712      if (element.hasLocation()) {
39713        composeType("location", element.getLocation());
39714      }
39715      if (element.hasQuantity()) {
39716        composeQuantity("quantity", element.getQuantity());
39717      }
39718      if (element.hasUnitPrice()) {
39719        composeMoney("unitPrice", element.getUnitPrice());
39720      }
39721      if (element.hasFactorElement()) {
39722        composeDecimalCore("factor", element.getFactorElement(), false);
39723        composeDecimalExtras("factor", element.getFactorElement(), false);
39724      }
39725      if (element.hasNet()) {
39726        composeMoney("net", element.getNet());
39727      }
39728      if (element.hasBodySite()) {
39729        composeCodeableConcept("bodySite", element.getBodySite());
39730      }
39731      if (element.hasSubSite()) {
39732        openArray("subSite");
39733        for (CodeableConcept e : element.getSubSite()) 
39734          composeCodeableConcept(null, e);
39735        closeArray();
39736      };
39737      if (element.hasNoteNumber()) {
39738        openArray("noteNumber");
39739        for (PositiveIntType e : element.getNoteNumber()) 
39740          composePositiveIntCore(null, e, true);
39741        closeArray();
39742        if (anyHasExtras(element.getNoteNumber())) {
39743          openArray("_noteNumber");
39744          for (PositiveIntType e : element.getNoteNumber()) 
39745            composePositiveIntExtras(null, e, true);
39746          closeArray();
39747        }
39748      };
39749      if (element.hasAdjudication()) {
39750        openArray("adjudication");
39751        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
39752          composeExplanationOfBenefitAdjudicationComponent(null, e);
39753        closeArray();
39754      };
39755      if (element.hasDetail()) {
39756        openArray("detail");
39757        for (ExplanationOfBenefit.AddedItemDetailComponent e : element.getDetail()) 
39758          composeExplanationOfBenefitAddedItemDetailComponent(null, e);
39759        closeArray();
39760      };
39761  }
39762
39763  protected void composeExplanationOfBenefitAddedItemDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
39764    if (element != null) {
39765      open(name);
39766      composeExplanationOfBenefitAddedItemDetailComponentInner(element);
39767      close();
39768    }
39769  }
39770
39771  protected void composeExplanationOfBenefitAddedItemDetailComponentInner(ExplanationOfBenefit.AddedItemDetailComponent element) throws IOException {
39772      composeBackbone(element);
39773      if (element.hasBillcode()) {
39774        composeCodeableConcept("billcode", element.getBillcode());
39775      }
39776      if (element.hasModifier()) {
39777        openArray("modifier");
39778        for (CodeableConcept e : element.getModifier()) 
39779          composeCodeableConcept(null, e);
39780        closeArray();
39781      };
39782      if (element.hasQuantity()) {
39783        composeQuantity("quantity", element.getQuantity());
39784      }
39785      if (element.hasUnitPrice()) {
39786        composeMoney("unitPrice", element.getUnitPrice());
39787      }
39788      if (element.hasFactorElement()) {
39789        composeDecimalCore("factor", element.getFactorElement(), false);
39790        composeDecimalExtras("factor", element.getFactorElement(), false);
39791      }
39792      if (element.hasNet()) {
39793        composeMoney("net", element.getNet());
39794      }
39795      if (element.hasNoteNumber()) {
39796        openArray("noteNumber");
39797        for (PositiveIntType e : element.getNoteNumber()) 
39798          composePositiveIntCore(null, e, true);
39799        closeArray();
39800        if (anyHasExtras(element.getNoteNumber())) {
39801          openArray("_noteNumber");
39802          for (PositiveIntType e : element.getNoteNumber()) 
39803            composePositiveIntExtras(null, e, true);
39804          closeArray();
39805        }
39806      };
39807      if (element.hasAdjudication()) {
39808        openArray("adjudication");
39809        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
39810          composeExplanationOfBenefitAdjudicationComponent(null, e);
39811        closeArray();
39812      };
39813      if (element.hasSubDetail()) {
39814        openArray("subDetail");
39815        for (ExplanationOfBenefit.AddedItemDetailSubDetailComponent e : element.getSubDetail()) 
39816          composeExplanationOfBenefitAddedItemDetailSubDetailComponent(null, e);
39817        closeArray();
39818      };
39819  }
39820
39821  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponent(String name, ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
39822    if (element != null) {
39823      open(name);
39824      composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(element);
39825      close();
39826    }
39827  }
39828
39829  protected void composeExplanationOfBenefitAddedItemDetailSubDetailComponentInner(ExplanationOfBenefit.AddedItemDetailSubDetailComponent element) throws IOException {
39830      composeBackbone(element);
39831      if (element.hasBillcode()) {
39832        composeCodeableConcept("billcode", element.getBillcode());
39833      }
39834      if (element.hasModifier()) {
39835        openArray("modifier");
39836        for (CodeableConcept e : element.getModifier()) 
39837          composeCodeableConcept(null, e);
39838        closeArray();
39839      };
39840      if (element.hasQuantity()) {
39841        composeQuantity("quantity", element.getQuantity());
39842      }
39843      if (element.hasUnitPrice()) {
39844        composeMoney("unitPrice", element.getUnitPrice());
39845      }
39846      if (element.hasFactorElement()) {
39847        composeDecimalCore("factor", element.getFactorElement(), false);
39848        composeDecimalExtras("factor", element.getFactorElement(), false);
39849      }
39850      if (element.hasNet()) {
39851        composeMoney("net", element.getNet());
39852      }
39853      if (element.hasNoteNumber()) {
39854        openArray("noteNumber");
39855        for (PositiveIntType e : element.getNoteNumber()) 
39856          composePositiveIntCore(null, e, true);
39857        closeArray();
39858        if (anyHasExtras(element.getNoteNumber())) {
39859          openArray("_noteNumber");
39860          for (PositiveIntType e : element.getNoteNumber()) 
39861            composePositiveIntExtras(null, e, true);
39862          closeArray();
39863        }
39864      };
39865      if (element.hasAdjudication()) {
39866        openArray("adjudication");
39867        for (ExplanationOfBenefit.AdjudicationComponent e : element.getAdjudication()) 
39868          composeExplanationOfBenefitAdjudicationComponent(null, e);
39869        closeArray();
39870      };
39871  }
39872
39873  protected void composeExplanationOfBenefitTotalComponent(String name, ExplanationOfBenefit.TotalComponent element) throws IOException {
39874    if (element != null) {
39875      open(name);
39876      composeExplanationOfBenefitTotalComponentInner(element);
39877      close();
39878    }
39879  }
39880
39881  protected void composeExplanationOfBenefitTotalComponentInner(ExplanationOfBenefit.TotalComponent element) throws IOException {
39882      composeBackbone(element);
39883      if (element.hasCategory()) {
39884        composeCodeableConcept("category", element.getCategory());
39885      }
39886      if (element.hasAmount()) {
39887        composeMoney("amount", element.getAmount());
39888      }
39889  }
39890
39891  protected void composeExplanationOfBenefitPaymentComponent(String name, ExplanationOfBenefit.PaymentComponent element) throws IOException {
39892    if (element != null) {
39893      open(name);
39894      composeExplanationOfBenefitPaymentComponentInner(element);
39895      close();
39896    }
39897  }
39898
39899  protected void composeExplanationOfBenefitPaymentComponentInner(ExplanationOfBenefit.PaymentComponent element) throws IOException {
39900      composeBackbone(element);
39901      if (element.hasType()) {
39902        composeCodeableConcept("type", element.getType());
39903      }
39904      if (element.hasAdjustment()) {
39905        composeMoney("adjustment", element.getAdjustment());
39906      }
39907      if (element.hasAdjustmentReason()) {
39908        composeCodeableConcept("adjustmentReason", element.getAdjustmentReason());
39909      }
39910      if (element.hasDateElement()) {
39911        composeDateCore("date", element.getDateElement(), false);
39912        composeDateExtras("date", element.getDateElement(), false);
39913      }
39914      if (element.hasAmount()) {
39915        composeMoney("amount", element.getAmount());
39916      }
39917      if (element.hasIdentifier()) {
39918        composeIdentifier("identifier", element.getIdentifier());
39919      }
39920  }
39921
39922  protected void composeExplanationOfBenefitNoteComponent(String name, ExplanationOfBenefit.NoteComponent element) throws IOException {
39923    if (element != null) {
39924      open(name);
39925      composeExplanationOfBenefitNoteComponentInner(element);
39926      close();
39927    }
39928  }
39929
39930  protected void composeExplanationOfBenefitNoteComponentInner(ExplanationOfBenefit.NoteComponent element) throws IOException {
39931      composeBackbone(element);
39932      if (element.hasNumberElement()) {
39933        composePositiveIntCore("number", element.getNumberElement(), false);
39934        composePositiveIntExtras("number", element.getNumberElement(), false);
39935      }
39936      if (element.hasTypeElement()) {
39937        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
39938        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
39939      }
39940      if (element.hasTextElement()) {
39941        composeStringCore("text", element.getTextElement(), false);
39942        composeStringExtras("text", element.getTextElement(), false);
39943      }
39944      if (element.hasLanguage()) {
39945        composeCodeableConcept("language", element.getLanguage());
39946      }
39947  }
39948
39949  protected void composeExplanationOfBenefitBenefitBalanceComponent(String name, ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
39950    if (element != null) {
39951      open(name);
39952      composeExplanationOfBenefitBenefitBalanceComponentInner(element);
39953      close();
39954    }
39955  }
39956
39957  protected void composeExplanationOfBenefitBenefitBalanceComponentInner(ExplanationOfBenefit.BenefitBalanceComponent element) throws IOException {
39958      composeBackbone(element);
39959      if (element.hasCategory()) {
39960        composeCodeableConcept("category", element.getCategory());
39961      }
39962      if (element.hasExcludedElement()) {
39963        composeBooleanCore("excluded", element.getExcludedElement(), false);
39964        composeBooleanExtras("excluded", element.getExcludedElement(), false);
39965      }
39966      if (element.hasNameElement()) {
39967        composeStringCore("name", element.getNameElement(), false);
39968        composeStringExtras("name", element.getNameElement(), false);
39969      }
39970      if (element.hasDescriptionElement()) {
39971        composeStringCore("description", element.getDescriptionElement(), false);
39972        composeStringExtras("description", element.getDescriptionElement(), false);
39973      }
39974      if (element.hasNetwork()) {
39975        composeCodeableConcept("network", element.getNetwork());
39976      }
39977      if (element.hasUnit()) {
39978        composeCodeableConcept("unit", element.getUnit());
39979      }
39980      if (element.hasTerm()) {
39981        composeCodeableConcept("term", element.getTerm());
39982      }
39983      if (element.hasFinancial()) {
39984        openArray("financial");
39985        for (ExplanationOfBenefit.BenefitComponent e : element.getFinancial()) 
39986          composeExplanationOfBenefitBenefitComponent(null, e);
39987        closeArray();
39988      };
39989  }
39990
39991  protected void composeExplanationOfBenefitBenefitComponent(String name, ExplanationOfBenefit.BenefitComponent element) throws IOException {
39992    if (element != null) {
39993      open(name);
39994      composeExplanationOfBenefitBenefitComponentInner(element);
39995      close();
39996    }
39997  }
39998
39999  protected void composeExplanationOfBenefitBenefitComponentInner(ExplanationOfBenefit.BenefitComponent element) throws IOException {
40000      composeBackbone(element);
40001      if (element.hasType()) {
40002        composeCodeableConcept("type", element.getType());
40003      }
40004      if (element.hasAllowed()) {
40005        composeType("allowed", element.getAllowed());
40006      }
40007      if (element.hasUsed()) {
40008        composeType("used", element.getUsed());
40009      }
40010  }
40011
40012  protected void composeFamilyMemberHistory(String name, FamilyMemberHistory element) throws IOException {
40013    if (element != null) {
40014      prop("resourceType", name);
40015      composeFamilyMemberHistoryInner(element);
40016    }
40017  }
40018
40019  protected void composeFamilyMemberHistoryInner(FamilyMemberHistory element) throws IOException {
40020      composeDomainResourceElements(element);
40021      if (element.hasIdentifier()) {
40022        openArray("identifier");
40023        for (Identifier e : element.getIdentifier()) 
40024          composeIdentifier(null, e);
40025        closeArray();
40026      };
40027      if (element.hasInstantiatesCanonical()) {
40028        openArray("instantiatesCanonical");
40029        for (CanonicalType e : element.getInstantiatesCanonical()) 
40030          composeCanonicalCore(null, e, true);
40031        closeArray();
40032        if (anyHasExtras(element.getInstantiatesCanonical())) {
40033          openArray("_instantiatesCanonical");
40034          for (CanonicalType e : element.getInstantiatesCanonical()) 
40035            composeCanonicalExtras(null, e, true);
40036          closeArray();
40037        }
40038      };
40039      if (element.hasInstantiatesUri()) {
40040        openArray("instantiatesUri");
40041        for (UriType e : element.getInstantiatesUri()) 
40042          composeUriCore(null, e, true);
40043        closeArray();
40044        if (anyHasExtras(element.getInstantiatesUri())) {
40045          openArray("_instantiatesUri");
40046          for (UriType e : element.getInstantiatesUri()) 
40047            composeUriExtras(null, e, true);
40048          closeArray();
40049        }
40050      };
40051      if (element.hasStatusElement()) {
40052        composeEnumerationCore("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
40053        composeEnumerationExtras("status", element.getStatusElement(), new FamilyMemberHistory.FamilyHistoryStatusEnumFactory(), false);
40054      }
40055      if (element.hasDataAbsentReason()) {
40056        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
40057      }
40058      if (element.hasPatient()) {
40059        composeReference("patient", element.getPatient());
40060      }
40061      if (element.hasDateElement()) {
40062        composeDateTimeCore("date", element.getDateElement(), false);
40063        composeDateTimeExtras("date", element.getDateElement(), false);
40064      }
40065      if (element.hasNameElement()) {
40066        composeStringCore("name", element.getNameElement(), false);
40067        composeStringExtras("name", element.getNameElement(), false);
40068      }
40069      if (element.hasRelationship()) {
40070        composeCodeableConcept("relationship", element.getRelationship());
40071      }
40072      if (element.hasGender()) {
40073        composeCodeableConcept("gender", element.getGender());
40074      }
40075      if (element.hasBorn()) {
40076        composeType("born", element.getBorn());
40077      }
40078      if (element.hasAge()) {
40079        composeType("age", element.getAge());
40080      }
40081      if (element.hasEstimatedAgeElement()) {
40082        composeBooleanCore("estimatedAge", element.getEstimatedAgeElement(), false);
40083        composeBooleanExtras("estimatedAge", element.getEstimatedAgeElement(), false);
40084      }
40085      if (element.hasDeceased()) {
40086        composeType("deceased", element.getDeceased());
40087      }
40088      if (element.hasReasonCode()) {
40089        openArray("reasonCode");
40090        for (CodeableConcept e : element.getReasonCode()) 
40091          composeCodeableConcept(null, e);
40092        closeArray();
40093      };
40094      if (element.hasReasonReference()) {
40095        openArray("reasonReference");
40096        for (Reference e : element.getReasonReference()) 
40097          composeReference(null, e);
40098        closeArray();
40099      };
40100      if (element.hasNote()) {
40101        openArray("note");
40102        for (Annotation e : element.getNote()) 
40103          composeAnnotation(null, e);
40104        closeArray();
40105      };
40106      if (element.hasCondition()) {
40107        openArray("condition");
40108        for (FamilyMemberHistory.FamilyMemberHistoryConditionComponent e : element.getCondition()) 
40109          composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(null, e);
40110        closeArray();
40111      };
40112  }
40113
40114  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponent(String name, FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
40115    if (element != null) {
40116      open(name);
40117      composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(element);
40118      close();
40119    }
40120  }
40121
40122  protected void composeFamilyMemberHistoryFamilyMemberHistoryConditionComponentInner(FamilyMemberHistory.FamilyMemberHistoryConditionComponent element) throws IOException {
40123      composeBackbone(element);
40124      if (element.hasCode()) {
40125        composeCodeableConcept("code", element.getCode());
40126      }
40127      if (element.hasOutcome()) {
40128        composeCodeableConcept("outcome", element.getOutcome());
40129      }
40130      if (element.hasOnset()) {
40131        composeType("onset", element.getOnset());
40132      }
40133      if (element.hasNote()) {
40134        openArray("note");
40135        for (Annotation e : element.getNote()) 
40136          composeAnnotation(null, e);
40137        closeArray();
40138      };
40139  }
40140
40141  protected void composeFlag(String name, Flag element) throws IOException {
40142    if (element != null) {
40143      prop("resourceType", name);
40144      composeFlagInner(element);
40145    }
40146  }
40147
40148  protected void composeFlagInner(Flag element) throws IOException {
40149      composeDomainResourceElements(element);
40150      if (element.hasIdentifier()) {
40151        openArray("identifier");
40152        for (Identifier e : element.getIdentifier()) 
40153          composeIdentifier(null, e);
40154        closeArray();
40155      };
40156      if (element.hasStatusElement()) {
40157        composeEnumerationCore("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
40158        composeEnumerationExtras("status", element.getStatusElement(), new Flag.FlagStatusEnumFactory(), false);
40159      }
40160      if (element.hasCategory()) {
40161        openArray("category");
40162        for (CodeableConcept e : element.getCategory()) 
40163          composeCodeableConcept(null, e);
40164        closeArray();
40165      };
40166      if (element.hasCode()) {
40167        composeCodeableConcept("code", element.getCode());
40168      }
40169      if (element.hasSubject()) {
40170        composeReference("subject", element.getSubject());
40171      }
40172      if (element.hasPeriod()) {
40173        composePeriod("period", element.getPeriod());
40174      }
40175      if (element.hasEncounter()) {
40176        composeReference("encounter", element.getEncounter());
40177      }
40178      if (element.hasAuthor()) {
40179        composeReference("author", element.getAuthor());
40180      }
40181  }
40182
40183  protected void composeGoal(String name, Goal element) throws IOException {
40184    if (element != null) {
40185      prop("resourceType", name);
40186      composeGoalInner(element);
40187    }
40188  }
40189
40190  protected void composeGoalInner(Goal element) throws IOException {
40191      composeDomainResourceElements(element);
40192      if (element.hasIdentifier()) {
40193        openArray("identifier");
40194        for (Identifier e : element.getIdentifier()) 
40195          composeIdentifier(null, e);
40196        closeArray();
40197      };
40198      if (element.hasStatusElement()) {
40199        composeEnumerationCore("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
40200        composeEnumerationExtras("status", element.getStatusElement(), new Goal.GoalStatusEnumFactory(), false);
40201      }
40202      if (element.hasCategory()) {
40203        openArray("category");
40204        for (CodeableConcept e : element.getCategory()) 
40205          composeCodeableConcept(null, e);
40206        closeArray();
40207      };
40208      if (element.hasPriority()) {
40209        composeCodeableConcept("priority", element.getPriority());
40210      }
40211      if (element.hasDescription()) {
40212        composeCodeableConcept("description", element.getDescription());
40213      }
40214      if (element.hasSubject()) {
40215        composeReference("subject", element.getSubject());
40216      }
40217      if (element.hasStart()) {
40218        composeType("start", element.getStart());
40219      }
40220      if (element.hasTarget()) {
40221        composeGoalGoalTargetComponent("target", element.getTarget());
40222      }
40223      if (element.hasStatusDateElement()) {
40224        composeDateCore("statusDate", element.getStatusDateElement(), false);
40225        composeDateExtras("statusDate", element.getStatusDateElement(), false);
40226      }
40227      if (element.hasStatusReasonElement()) {
40228        composeStringCore("statusReason", element.getStatusReasonElement(), false);
40229        composeStringExtras("statusReason", element.getStatusReasonElement(), false);
40230      }
40231      if (element.hasExpressedBy()) {
40232        composeReference("expressedBy", element.getExpressedBy());
40233      }
40234      if (element.hasAddresses()) {
40235        openArray("addresses");
40236        for (Reference e : element.getAddresses()) 
40237          composeReference(null, e);
40238        closeArray();
40239      };
40240      if (element.hasNote()) {
40241        openArray("note");
40242        for (Annotation e : element.getNote()) 
40243          composeAnnotation(null, e);
40244        closeArray();
40245      };
40246      if (element.hasOutcomeCode()) {
40247        openArray("outcomeCode");
40248        for (CodeableConcept e : element.getOutcomeCode()) 
40249          composeCodeableConcept(null, e);
40250        closeArray();
40251      };
40252      if (element.hasOutcomeReference()) {
40253        openArray("outcomeReference");
40254        for (Reference e : element.getOutcomeReference()) 
40255          composeReference(null, e);
40256        closeArray();
40257      };
40258  }
40259
40260  protected void composeGoalGoalTargetComponent(String name, Goal.GoalTargetComponent element) throws IOException {
40261    if (element != null) {
40262      open(name);
40263      composeGoalGoalTargetComponentInner(element);
40264      close();
40265    }
40266  }
40267
40268  protected void composeGoalGoalTargetComponentInner(Goal.GoalTargetComponent element) throws IOException {
40269      composeBackbone(element);
40270      if (element.hasMeasure()) {
40271        composeCodeableConcept("measure", element.getMeasure());
40272      }
40273      if (element.hasDetail()) {
40274        composeType("detail", element.getDetail());
40275      }
40276      if (element.hasDue()) {
40277        composeType("due", element.getDue());
40278      }
40279  }
40280
40281  protected void composeGraphDefinition(String name, GraphDefinition element) throws IOException {
40282    if (element != null) {
40283      prop("resourceType", name);
40284      composeGraphDefinitionInner(element);
40285    }
40286  }
40287
40288  protected void composeGraphDefinitionInner(GraphDefinition element) throws IOException {
40289      composeDomainResourceElements(element);
40290      if (element.hasUrlElement()) {
40291        composeUriCore("url", element.getUrlElement(), false);
40292        composeUriExtras("url", element.getUrlElement(), false);
40293      }
40294      if (element.hasVersionElement()) {
40295        composeStringCore("version", element.getVersionElement(), false);
40296        composeStringExtras("version", element.getVersionElement(), false);
40297      }
40298      if (element.hasNameElement()) {
40299        composeStringCore("name", element.getNameElement(), false);
40300        composeStringExtras("name", element.getNameElement(), false);
40301      }
40302      if (element.hasStatusElement()) {
40303        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40304        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
40305      }
40306      if (element.hasExperimentalElement()) {
40307        composeBooleanCore("experimental", element.getExperimentalElement(), false);
40308        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
40309      }
40310      if (element.hasDateElement()) {
40311        composeDateTimeCore("date", element.getDateElement(), false);
40312        composeDateTimeExtras("date", element.getDateElement(), false);
40313      }
40314      if (element.hasPublisherElement()) {
40315        composeStringCore("publisher", element.getPublisherElement(), false);
40316        composeStringExtras("publisher", element.getPublisherElement(), false);
40317      }
40318      if (element.hasContact()) {
40319        openArray("contact");
40320        for (ContactDetail e : element.getContact()) 
40321          composeContactDetail(null, e);
40322        closeArray();
40323      };
40324      if (element.hasDescriptionElement()) {
40325        composeMarkdownCore("description", element.getDescriptionElement(), false);
40326        composeMarkdownExtras("description", element.getDescriptionElement(), false);
40327      }
40328      if (element.hasUseContext()) {
40329        openArray("useContext");
40330        for (UsageContext e : element.getUseContext()) 
40331          composeUsageContext(null, e);
40332        closeArray();
40333      };
40334      if (element.hasJurisdiction()) {
40335        openArray("jurisdiction");
40336        for (CodeableConcept e : element.getJurisdiction()) 
40337          composeCodeableConcept(null, e);
40338        closeArray();
40339      };
40340      if (element.hasPurposeElement()) {
40341        composeMarkdownCore("purpose", element.getPurposeElement(), false);
40342        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
40343      }
40344      if (element.hasStartElement()) {
40345        composeCodeCore("start", element.getStartElement(), false);
40346        composeCodeExtras("start", element.getStartElement(), false);
40347      }
40348      if (element.hasProfileElement()) {
40349        composeCanonicalCore("profile", element.getProfileElement(), false);
40350        composeCanonicalExtras("profile", element.getProfileElement(), false);
40351      }
40352      if (element.hasLink()) {
40353        openArray("link");
40354        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
40355          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
40356        closeArray();
40357      };
40358  }
40359
40360  protected void composeGraphDefinitionGraphDefinitionLinkComponent(String name, GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
40361    if (element != null) {
40362      open(name);
40363      composeGraphDefinitionGraphDefinitionLinkComponentInner(element);
40364      close();
40365    }
40366  }
40367
40368  protected void composeGraphDefinitionGraphDefinitionLinkComponentInner(GraphDefinition.GraphDefinitionLinkComponent element) throws IOException {
40369      composeBackbone(element);
40370      if (element.hasPathElement()) {
40371        composeStringCore("path", element.getPathElement(), false);
40372        composeStringExtras("path", element.getPathElement(), false);
40373      }
40374      if (element.hasSliceNameElement()) {
40375        composeStringCore("sliceName", element.getSliceNameElement(), false);
40376        composeStringExtras("sliceName", element.getSliceNameElement(), false);
40377      }
40378      if (element.hasMinElement()) {
40379        composeIntegerCore("min", element.getMinElement(), false);
40380        composeIntegerExtras("min", element.getMinElement(), false);
40381      }
40382      if (element.hasMaxElement()) {
40383        composeStringCore("max", element.getMaxElement(), false);
40384        composeStringExtras("max", element.getMaxElement(), false);
40385      }
40386      if (element.hasDescriptionElement()) {
40387        composeStringCore("description", element.getDescriptionElement(), false);
40388        composeStringExtras("description", element.getDescriptionElement(), false);
40389      }
40390      if (element.hasTarget()) {
40391        openArray("target");
40392        for (GraphDefinition.GraphDefinitionLinkTargetComponent e : element.getTarget()) 
40393          composeGraphDefinitionGraphDefinitionLinkTargetComponent(null, e);
40394        closeArray();
40395      };
40396  }
40397
40398  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponent(String name, GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
40399    if (element != null) {
40400      open(name);
40401      composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(element);
40402      close();
40403    }
40404  }
40405
40406  protected void composeGraphDefinitionGraphDefinitionLinkTargetComponentInner(GraphDefinition.GraphDefinitionLinkTargetComponent element) throws IOException {
40407      composeBackbone(element);
40408      if (element.hasTypeElement()) {
40409        composeCodeCore("type", element.getTypeElement(), false);
40410        composeCodeExtras("type", element.getTypeElement(), false);
40411      }
40412      if (element.hasParamsElement()) {
40413        composeStringCore("params", element.getParamsElement(), false);
40414        composeStringExtras("params", element.getParamsElement(), false);
40415      }
40416      if (element.hasProfileElement()) {
40417        composeCanonicalCore("profile", element.getProfileElement(), false);
40418        composeCanonicalExtras("profile", element.getProfileElement(), false);
40419      }
40420      if (element.hasCompartment()) {
40421        openArray("compartment");
40422        for (GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent e : element.getCompartment()) 
40423          composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(null, e);
40424        closeArray();
40425      };
40426      if (element.hasLink()) {
40427        openArray("link");
40428        for (GraphDefinition.GraphDefinitionLinkComponent e : element.getLink()) 
40429          composeGraphDefinitionGraphDefinitionLinkComponent(null, e);
40430        closeArray();
40431      };
40432  }
40433
40434  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponent(String name, GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
40435    if (element != null) {
40436      open(name);
40437      composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(element);
40438      close();
40439    }
40440  }
40441
40442  protected void composeGraphDefinitionGraphDefinitionLinkTargetCompartmentComponentInner(GraphDefinition.GraphDefinitionLinkTargetCompartmentComponent element) throws IOException {
40443      composeBackbone(element);
40444      if (element.hasUseElement()) {
40445        composeEnumerationCore("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
40446        composeEnumerationExtras("use", element.getUseElement(), new GraphDefinition.GraphCompartmentUseEnumFactory(), false);
40447      }
40448      if (element.hasCodeElement()) {
40449        composeEnumerationCore("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
40450        composeEnumerationExtras("code", element.getCodeElement(), new GraphDefinition.CompartmentCodeEnumFactory(), false);
40451      }
40452      if (element.hasRuleElement()) {
40453        composeEnumerationCore("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
40454        composeEnumerationExtras("rule", element.getRuleElement(), new GraphDefinition.GraphCompartmentRuleEnumFactory(), false);
40455      }
40456      if (element.hasExpressionElement()) {
40457        composeStringCore("expression", element.getExpressionElement(), false);
40458        composeStringExtras("expression", element.getExpressionElement(), false);
40459      }
40460      if (element.hasDescriptionElement()) {
40461        composeStringCore("description", element.getDescriptionElement(), false);
40462        composeStringExtras("description", element.getDescriptionElement(), false);
40463      }
40464  }
40465
40466  protected void composeGroup(String name, Group element) throws IOException {
40467    if (element != null) {
40468      prop("resourceType", name);
40469      composeGroupInner(element);
40470    }
40471  }
40472
40473  protected void composeGroupInner(Group element) throws IOException {
40474      composeDomainResourceElements(element);
40475      if (element.hasIdentifier()) {
40476        openArray("identifier");
40477        for (Identifier e : element.getIdentifier()) 
40478          composeIdentifier(null, e);
40479        closeArray();
40480      };
40481      if (element.hasActiveElement()) {
40482        composeBooleanCore("active", element.getActiveElement(), false);
40483        composeBooleanExtras("active", element.getActiveElement(), false);
40484      }
40485      if (element.hasTypeElement()) {
40486        composeEnumerationCore("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
40487        composeEnumerationExtras("type", element.getTypeElement(), new Group.GroupTypeEnumFactory(), false);
40488      }
40489      if (element.hasActualElement()) {
40490        composeBooleanCore("actual", element.getActualElement(), false);
40491        composeBooleanExtras("actual", element.getActualElement(), false);
40492      }
40493      if (element.hasCode()) {
40494        composeCodeableConcept("code", element.getCode());
40495      }
40496      if (element.hasNameElement()) {
40497        composeStringCore("name", element.getNameElement(), false);
40498        composeStringExtras("name", element.getNameElement(), false);
40499      }
40500      if (element.hasQuantityElement()) {
40501        composeUnsignedIntCore("quantity", element.getQuantityElement(), false);
40502        composeUnsignedIntExtras("quantity", element.getQuantityElement(), false);
40503      }
40504      if (element.hasCharacteristic()) {
40505        openArray("characteristic");
40506        for (Group.GroupCharacteristicComponent e : element.getCharacteristic()) 
40507          composeGroupGroupCharacteristicComponent(null, e);
40508        closeArray();
40509      };
40510      if (element.hasMember()) {
40511        openArray("member");
40512        for (Group.GroupMemberComponent e : element.getMember()) 
40513          composeGroupGroupMemberComponent(null, e);
40514        closeArray();
40515      };
40516  }
40517
40518  protected void composeGroupGroupCharacteristicComponent(String name, Group.GroupCharacteristicComponent element) throws IOException {
40519    if (element != null) {
40520      open(name);
40521      composeGroupGroupCharacteristicComponentInner(element);
40522      close();
40523    }
40524  }
40525
40526  protected void composeGroupGroupCharacteristicComponentInner(Group.GroupCharacteristicComponent element) throws IOException {
40527      composeBackbone(element);
40528      if (element.hasCode()) {
40529        composeCodeableConcept("code", element.getCode());
40530      }
40531      if (element.hasValue()) {
40532        composeType("value", element.getValue());
40533      }
40534      if (element.hasExcludeElement()) {
40535        composeBooleanCore("exclude", element.getExcludeElement(), false);
40536        composeBooleanExtras("exclude", element.getExcludeElement(), false);
40537      }
40538      if (element.hasPeriod()) {
40539        composePeriod("period", element.getPeriod());
40540      }
40541  }
40542
40543  protected void composeGroupGroupMemberComponent(String name, Group.GroupMemberComponent element) throws IOException {
40544    if (element != null) {
40545      open(name);
40546      composeGroupGroupMemberComponentInner(element);
40547      close();
40548    }
40549  }
40550
40551  protected void composeGroupGroupMemberComponentInner(Group.GroupMemberComponent element) throws IOException {
40552      composeBackbone(element);
40553      if (element.hasEntity()) {
40554        composeReference("entity", element.getEntity());
40555      }
40556      if (element.hasPeriod()) {
40557        composePeriod("period", element.getPeriod());
40558      }
40559      if (element.hasInactiveElement()) {
40560        composeBooleanCore("inactive", element.getInactiveElement(), false);
40561        composeBooleanExtras("inactive", element.getInactiveElement(), false);
40562      }
40563  }
40564
40565  protected void composeGuidanceResponse(String name, GuidanceResponse element) throws IOException {
40566    if (element != null) {
40567      prop("resourceType", name);
40568      composeGuidanceResponseInner(element);
40569    }
40570  }
40571
40572  protected void composeGuidanceResponseInner(GuidanceResponse element) throws IOException {
40573      composeDomainResourceElements(element);
40574      if (element.hasRequestIdentifier()) {
40575        composeIdentifier("requestIdentifier", element.getRequestIdentifier());
40576      }
40577      if (element.hasIdentifier()) {
40578        openArray("identifier");
40579        for (Identifier e : element.getIdentifier()) 
40580          composeIdentifier(null, e);
40581        closeArray();
40582      };
40583      if (element.hasModule()) {
40584        composeType("module", element.getModule());
40585      }
40586      if (element.hasStatusElement()) {
40587        composeEnumerationCore("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
40588        composeEnumerationExtras("status", element.getStatusElement(), new GuidanceResponse.GuidanceResponseStatusEnumFactory(), false);
40589      }
40590      if (element.hasSubject()) {
40591        composeReference("subject", element.getSubject());
40592      }
40593      if (element.hasContext()) {
40594        composeReference("context", element.getContext());
40595      }
40596      if (element.hasOccurrenceDateTimeElement()) {
40597        composeDateTimeCore("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
40598        composeDateTimeExtras("occurrenceDateTime", element.getOccurrenceDateTimeElement(), false);
40599      }
40600      if (element.hasPerformer()) {
40601        composeReference("performer", element.getPerformer());
40602      }
40603      if (element.hasReasonCode()) {
40604        openArray("reasonCode");
40605        for (CodeableConcept e : element.getReasonCode()) 
40606          composeCodeableConcept(null, e);
40607        closeArray();
40608      };
40609      if (element.hasReasonReference()) {
40610        openArray("reasonReference");
40611        for (Reference e : element.getReasonReference()) 
40612          composeReference(null, e);
40613        closeArray();
40614      };
40615      if (element.hasNote()) {
40616        openArray("note");
40617        for (Annotation e : element.getNote()) 
40618          composeAnnotation(null, e);
40619        closeArray();
40620      };
40621      if (element.hasEvaluationMessage()) {
40622        openArray("evaluationMessage");
40623        for (Reference e : element.getEvaluationMessage()) 
40624          composeReference(null, e);
40625        closeArray();
40626      };
40627      if (element.hasOutputParameters()) {
40628        composeReference("outputParameters", element.getOutputParameters());
40629      }
40630      if (element.hasResult()) {
40631        composeReference("result", element.getResult());
40632      }
40633      if (element.hasDataRequirement()) {
40634        openArray("dataRequirement");
40635        for (DataRequirement e : element.getDataRequirement()) 
40636          composeDataRequirement(null, e);
40637        closeArray();
40638      };
40639  }
40640
40641  protected void composeHealthcareService(String name, HealthcareService element) throws IOException {
40642    if (element != null) {
40643      prop("resourceType", name);
40644      composeHealthcareServiceInner(element);
40645    }
40646  }
40647
40648  protected void composeHealthcareServiceInner(HealthcareService element) throws IOException {
40649      composeDomainResourceElements(element);
40650      if (element.hasIdentifier()) {
40651        openArray("identifier");
40652        for (Identifier e : element.getIdentifier()) 
40653          composeIdentifier(null, e);
40654        closeArray();
40655      };
40656      if (element.hasActiveElement()) {
40657        composeBooleanCore("active", element.getActiveElement(), false);
40658        composeBooleanExtras("active", element.getActiveElement(), false);
40659      }
40660      if (element.hasProvidedBy()) {
40661        composeReference("providedBy", element.getProvidedBy());
40662      }
40663      if (element.hasCategory()) {
40664        openArray("category");
40665        for (CodeableConcept e : element.getCategory()) 
40666          composeCodeableConcept(null, e);
40667        closeArray();
40668      };
40669      if (element.hasType()) {
40670        openArray("type");
40671        for (CodeableConcept e : element.getType()) 
40672          composeCodeableConcept(null, e);
40673        closeArray();
40674      };
40675      if (element.hasSpecialty()) {
40676        openArray("specialty");
40677        for (CodeableConcept e : element.getSpecialty()) 
40678          composeCodeableConcept(null, e);
40679        closeArray();
40680      };
40681      if (element.hasLocation()) {
40682        openArray("location");
40683        for (Reference e : element.getLocation()) 
40684          composeReference(null, e);
40685        closeArray();
40686      };
40687      if (element.hasNameElement()) {
40688        composeStringCore("name", element.getNameElement(), false);
40689        composeStringExtras("name", element.getNameElement(), false);
40690      }
40691      if (element.hasCommentElement()) {
40692        composeStringCore("comment", element.getCommentElement(), false);
40693        composeStringExtras("comment", element.getCommentElement(), false);
40694      }
40695      if (element.hasExtraDetailsElement()) {
40696        composeStringCore("extraDetails", element.getExtraDetailsElement(), false);
40697        composeStringExtras("extraDetails", element.getExtraDetailsElement(), false);
40698      }
40699      if (element.hasPhoto()) {
40700        composeAttachment("photo", element.getPhoto());
40701      }
40702      if (element.hasTelecom()) {
40703        openArray("telecom");
40704        for (ContactPoint e : element.getTelecom()) 
40705          composeContactPoint(null, e);
40706        closeArray();
40707      };
40708      if (element.hasCoverageArea()) {
40709        openArray("coverageArea");
40710        for (Reference e : element.getCoverageArea()) 
40711          composeReference(null, e);
40712        closeArray();
40713      };
40714      if (element.hasServiceProvisionCode()) {
40715        openArray("serviceProvisionCode");
40716        for (CodeableConcept e : element.getServiceProvisionCode()) 
40717          composeCodeableConcept(null, e);
40718        closeArray();
40719      };
40720      if (element.hasEligibility()) {
40721        composeCodeableConcept("eligibility", element.getEligibility());
40722      }
40723      if (element.hasEligibilityNoteElement()) {
40724        composeStringCore("eligibilityNote", element.getEligibilityNoteElement(), false);
40725        composeStringExtras("eligibilityNote", element.getEligibilityNoteElement(), false);
40726      }
40727      if (element.hasProgramName()) {
40728        openArray("programName");
40729        for (StringType e : element.getProgramName()) 
40730          composeStringCore(null, e, true);
40731        closeArray();
40732        if (anyHasExtras(element.getProgramName())) {
40733          openArray("_programName");
40734          for (StringType e : element.getProgramName()) 
40735            composeStringExtras(null, e, true);
40736          closeArray();
40737        }
40738      };
40739      if (element.hasCharacteristic()) {
40740        openArray("characteristic");
40741        for (CodeableConcept e : element.getCharacteristic()) 
40742          composeCodeableConcept(null, e);
40743        closeArray();
40744      };
40745      if (element.hasReferralMethod()) {
40746        openArray("referralMethod");
40747        for (CodeableConcept e : element.getReferralMethod()) 
40748          composeCodeableConcept(null, e);
40749        closeArray();
40750      };
40751      if (element.hasAppointmentRequiredElement()) {
40752        composeBooleanCore("appointmentRequired", element.getAppointmentRequiredElement(), false);
40753        composeBooleanExtras("appointmentRequired", element.getAppointmentRequiredElement(), false);
40754      }
40755      if (element.hasAvailableTime()) {
40756        openArray("availableTime");
40757        for (HealthcareService.HealthcareServiceAvailableTimeComponent e : element.getAvailableTime()) 
40758          composeHealthcareServiceHealthcareServiceAvailableTimeComponent(null, e);
40759        closeArray();
40760      };
40761      if (element.hasNotAvailable()) {
40762        openArray("notAvailable");
40763        for (HealthcareService.HealthcareServiceNotAvailableComponent e : element.getNotAvailable()) 
40764          composeHealthcareServiceHealthcareServiceNotAvailableComponent(null, e);
40765        closeArray();
40766      };
40767      if (element.hasAvailabilityExceptionsElement()) {
40768        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
40769        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
40770      }
40771      if (element.hasEndpoint()) {
40772        openArray("endpoint");
40773        for (Reference e : element.getEndpoint()) 
40774          composeReference(null, e);
40775        closeArray();
40776      };
40777  }
40778
40779  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponent(String name, HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
40780    if (element != null) {
40781      open(name);
40782      composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(element);
40783      close();
40784    }
40785  }
40786
40787  protected void composeHealthcareServiceHealthcareServiceAvailableTimeComponentInner(HealthcareService.HealthcareServiceAvailableTimeComponent element) throws IOException {
40788      composeBackbone(element);
40789      if (element.hasDaysOfWeek()) {
40790        openArray("daysOfWeek");
40791        for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
40792          composeEnumerationCore(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
40793        closeArray();
40794        if (anyHasExtras(element.getDaysOfWeek())) {
40795          openArray("_daysOfWeek");
40796          for (Enumeration<HealthcareService.DaysOfWeek> e : element.getDaysOfWeek()) 
40797            composeEnumerationExtras(null, e, new HealthcareService.DaysOfWeekEnumFactory(), true);
40798          closeArray();
40799        }
40800      };
40801      if (element.hasAllDayElement()) {
40802        composeBooleanCore("allDay", element.getAllDayElement(), false);
40803        composeBooleanExtras("allDay", element.getAllDayElement(), false);
40804      }
40805      if (element.hasAvailableStartTimeElement()) {
40806        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
40807        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
40808      }
40809      if (element.hasAvailableEndTimeElement()) {
40810        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
40811        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
40812      }
40813  }
40814
40815  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponent(String name, HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
40816    if (element != null) {
40817      open(name);
40818      composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(element);
40819      close();
40820    }
40821  }
40822
40823  protected void composeHealthcareServiceHealthcareServiceNotAvailableComponentInner(HealthcareService.HealthcareServiceNotAvailableComponent element) throws IOException {
40824      composeBackbone(element);
40825      if (element.hasDescriptionElement()) {
40826        composeStringCore("description", element.getDescriptionElement(), false);
40827        composeStringExtras("description", element.getDescriptionElement(), false);
40828      }
40829      if (element.hasDuring()) {
40830        composePeriod("during", element.getDuring());
40831      }
40832  }
40833
40834  protected void composeImagingStudy(String name, ImagingStudy element) throws IOException {
40835    if (element != null) {
40836      prop("resourceType", name);
40837      composeImagingStudyInner(element);
40838    }
40839  }
40840
40841  protected void composeImagingStudyInner(ImagingStudy element) throws IOException {
40842      composeDomainResourceElements(element);
40843      if (element.hasIdentifier()) {
40844        openArray("identifier");
40845        for (Identifier e : element.getIdentifier()) 
40846          composeIdentifier(null, e);
40847        closeArray();
40848      };
40849      if (element.hasStatusElement()) {
40850        composeEnumerationCore("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
40851        composeEnumerationExtras("status", element.getStatusElement(), new ImagingStudy.ImagingStudyStatusEnumFactory(), false);
40852      }
40853      if (element.hasModality()) {
40854        openArray("modality");
40855        for (Coding e : element.getModality()) 
40856          composeCoding(null, e);
40857        closeArray();
40858      };
40859      if (element.hasSubject()) {
40860        composeReference("subject", element.getSubject());
40861      }
40862      if (element.hasContext()) {
40863        composeReference("context", element.getContext());
40864      }
40865      if (element.hasStartedElement()) {
40866        composeDateTimeCore("started", element.getStartedElement(), false);
40867        composeDateTimeExtras("started", element.getStartedElement(), false);
40868      }
40869      if (element.hasBasedOn()) {
40870        openArray("basedOn");
40871        for (Reference e : element.getBasedOn()) 
40872          composeReference(null, e);
40873        closeArray();
40874      };
40875      if (element.hasReferrer()) {
40876        composeReference("referrer", element.getReferrer());
40877      }
40878      if (element.hasInterpreter()) {
40879        openArray("interpreter");
40880        for (Reference e : element.getInterpreter()) 
40881          composeReference(null, e);
40882        closeArray();
40883      };
40884      if (element.hasEndpoint()) {
40885        openArray("endpoint");
40886        for (Reference e : element.getEndpoint()) 
40887          composeReference(null, e);
40888        closeArray();
40889      };
40890      if (element.hasNumberOfSeriesElement()) {
40891        composeUnsignedIntCore("numberOfSeries", element.getNumberOfSeriesElement(), false);
40892        composeUnsignedIntExtras("numberOfSeries", element.getNumberOfSeriesElement(), false);
40893      }
40894      if (element.hasNumberOfInstancesElement()) {
40895        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
40896        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
40897      }
40898      if (element.hasProcedureReference()) {
40899        composeReference("procedureReference", element.getProcedureReference());
40900      }
40901      if (element.hasProcedureCode()) {
40902        openArray("procedureCode");
40903        for (CodeableConcept e : element.getProcedureCode()) 
40904          composeCodeableConcept(null, e);
40905        closeArray();
40906      };
40907      if (element.hasLocation()) {
40908        composeReference("location", element.getLocation());
40909      }
40910      if (element.hasReasonCode()) {
40911        openArray("reasonCode");
40912        for (CodeableConcept e : element.getReasonCode()) 
40913          composeCodeableConcept(null, e);
40914        closeArray();
40915      };
40916      if (element.hasReasonReference()) {
40917        openArray("reasonReference");
40918        for (Reference e : element.getReasonReference()) 
40919          composeReference(null, e);
40920        closeArray();
40921      };
40922      if (element.hasNote()) {
40923        openArray("note");
40924        for (Annotation e : element.getNote()) 
40925          composeAnnotation(null, e);
40926        closeArray();
40927      };
40928      if (element.hasDescriptionElement()) {
40929        composeStringCore("description", element.getDescriptionElement(), false);
40930        composeStringExtras("description", element.getDescriptionElement(), false);
40931      }
40932      if (element.hasSeries()) {
40933        openArray("series");
40934        for (ImagingStudy.ImagingStudySeriesComponent e : element.getSeries()) 
40935          composeImagingStudyImagingStudySeriesComponent(null, e);
40936        closeArray();
40937      };
40938  }
40939
40940  protected void composeImagingStudyImagingStudySeriesComponent(String name, ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
40941    if (element != null) {
40942      open(name);
40943      composeImagingStudyImagingStudySeriesComponentInner(element);
40944      close();
40945    }
40946  }
40947
40948  protected void composeImagingStudyImagingStudySeriesComponentInner(ImagingStudy.ImagingStudySeriesComponent element) throws IOException {
40949      composeBackbone(element);
40950      if (element.hasIdentifier()) {
40951        composeIdentifier("identifier", element.getIdentifier());
40952      }
40953      if (element.hasNumberElement()) {
40954        composeUnsignedIntCore("number", element.getNumberElement(), false);
40955        composeUnsignedIntExtras("number", element.getNumberElement(), false);
40956      }
40957      if (element.hasModality()) {
40958        composeCoding("modality", element.getModality());
40959      }
40960      if (element.hasDescriptionElement()) {
40961        composeStringCore("description", element.getDescriptionElement(), false);
40962        composeStringExtras("description", element.getDescriptionElement(), false);
40963      }
40964      if (element.hasNumberOfInstancesElement()) {
40965        composeUnsignedIntCore("numberOfInstances", element.getNumberOfInstancesElement(), false);
40966        composeUnsignedIntExtras("numberOfInstances", element.getNumberOfInstancesElement(), false);
40967      }
40968      if (element.hasEndpoint()) {
40969        openArray("endpoint");
40970        for (Reference e : element.getEndpoint()) 
40971          composeReference(null, e);
40972        closeArray();
40973      };
40974      if (element.hasBodySite()) {
40975        composeCoding("bodySite", element.getBodySite());
40976      }
40977      if (element.hasLaterality()) {
40978        composeCoding("laterality", element.getLaterality());
40979      }
40980      if (element.hasSpecimen()) {
40981        openArray("specimen");
40982        for (Reference e : element.getSpecimen()) 
40983          composeReference(null, e);
40984        closeArray();
40985      };
40986      if (element.hasStartedElement()) {
40987        composeDateTimeCore("started", element.getStartedElement(), false);
40988        composeDateTimeExtras("started", element.getStartedElement(), false);
40989      }
40990      if (element.hasPerformer()) {
40991        openArray("performer");
40992        for (ImagingStudy.ImagingStudySeriesPerformerComponent e : element.getPerformer()) 
40993          composeImagingStudyImagingStudySeriesPerformerComponent(null, e);
40994        closeArray();
40995      };
40996      if (element.hasInstance()) {
40997        openArray("instance");
40998        for (ImagingStudy.ImagingStudySeriesInstanceComponent e : element.getInstance()) 
40999          composeImagingStudyImagingStudySeriesInstanceComponent(null, e);
41000        closeArray();
41001      };
41002  }
41003
41004  protected void composeImagingStudyImagingStudySeriesPerformerComponent(String name, ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
41005    if (element != null) {
41006      open(name);
41007      composeImagingStudyImagingStudySeriesPerformerComponentInner(element);
41008      close();
41009    }
41010  }
41011
41012  protected void composeImagingStudyImagingStudySeriesPerformerComponentInner(ImagingStudy.ImagingStudySeriesPerformerComponent element) throws IOException {
41013      composeBackbone(element);
41014      if (element.hasFunction()) {
41015        composeCodeableConcept("function", element.getFunction());
41016      }
41017      if (element.hasActor()) {
41018        composeReference("actor", element.getActor());
41019      }
41020  }
41021
41022  protected void composeImagingStudyImagingStudySeriesInstanceComponent(String name, ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
41023    if (element != null) {
41024      open(name);
41025      composeImagingStudyImagingStudySeriesInstanceComponentInner(element);
41026      close();
41027    }
41028  }
41029
41030  protected void composeImagingStudyImagingStudySeriesInstanceComponentInner(ImagingStudy.ImagingStudySeriesInstanceComponent element) throws IOException {
41031      composeBackbone(element);
41032      if (element.hasIdentifier()) {
41033        composeIdentifier("identifier", element.getIdentifier());
41034      }
41035      if (element.hasNumberElement()) {
41036        composeUnsignedIntCore("number", element.getNumberElement(), false);
41037        composeUnsignedIntExtras("number", element.getNumberElement(), false);
41038      }
41039      if (element.hasSopClass()) {
41040        composeCoding("sopClass", element.getSopClass());
41041      }
41042      if (element.hasTitleElement()) {
41043        composeStringCore("title", element.getTitleElement(), false);
41044        composeStringExtras("title", element.getTitleElement(), false);
41045      }
41046  }
41047
41048  protected void composeImmunization(String name, Immunization element) throws IOException {
41049    if (element != null) {
41050      prop("resourceType", name);
41051      composeImmunizationInner(element);
41052    }
41053  }
41054
41055  protected void composeImmunizationInner(Immunization element) throws IOException {
41056      composeDomainResourceElements(element);
41057      if (element.hasIdentifier()) {
41058        openArray("identifier");
41059        for (Identifier e : element.getIdentifier()) 
41060          composeIdentifier(null, e);
41061        closeArray();
41062      };
41063      if (element.hasStatusElement()) {
41064        composeEnumerationCore("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
41065        composeEnumerationExtras("status", element.getStatusElement(), new Immunization.ImmunizationStatusEnumFactory(), false);
41066      }
41067      if (element.hasStatusReason()) {
41068        composeCodeableConcept("statusReason", element.getStatusReason());
41069      }
41070      if (element.hasVaccineCode()) {
41071        composeCodeableConcept("vaccineCode", element.getVaccineCode());
41072      }
41073      if (element.hasPatient()) {
41074        composeReference("patient", element.getPatient());
41075      }
41076      if (element.hasEncounter()) {
41077        composeReference("encounter", element.getEncounter());
41078      }
41079      if (element.hasOccurrence()) {
41080        composeType("occurrence", element.getOccurrence());
41081      }
41082      if (element.hasRecordedElement()) {
41083        composeDateTimeCore("recorded", element.getRecordedElement(), false);
41084        composeDateTimeExtras("recorded", element.getRecordedElement(), false);
41085      }
41086      if (element.hasPrimarySourceElement()) {
41087        composeBooleanCore("primarySource", element.getPrimarySourceElement(), false);
41088        composeBooleanExtras("primarySource", element.getPrimarySourceElement(), false);
41089      }
41090      if (element.hasReportOrigin()) {
41091        composeCodeableConcept("reportOrigin", element.getReportOrigin());
41092      }
41093      if (element.hasLocation()) {
41094        composeReference("location", element.getLocation());
41095      }
41096      if (element.hasManufacturer()) {
41097        composeReference("manufacturer", element.getManufacturer());
41098      }
41099      if (element.hasLotNumberElement()) {
41100        composeStringCore("lotNumber", element.getLotNumberElement(), false);
41101        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
41102      }
41103      if (element.hasExpirationDateElement()) {
41104        composeDateCore("expirationDate", element.getExpirationDateElement(), false);
41105        composeDateExtras("expirationDate", element.getExpirationDateElement(), false);
41106      }
41107      if (element.hasSite()) {
41108        composeCodeableConcept("site", element.getSite());
41109      }
41110      if (element.hasRoute()) {
41111        composeCodeableConcept("route", element.getRoute());
41112      }
41113      if (element.hasDoseQuantity()) {
41114        composeQuantity("doseQuantity", element.getDoseQuantity());
41115      }
41116      if (element.hasPerformer()) {
41117        openArray("performer");
41118        for (Immunization.ImmunizationPerformerComponent e : element.getPerformer()) 
41119          composeImmunizationImmunizationPerformerComponent(null, e);
41120        closeArray();
41121      };
41122      if (element.hasNote()) {
41123        openArray("note");
41124        for (Annotation e : element.getNote()) 
41125          composeAnnotation(null, e);
41126        closeArray();
41127      };
41128      if (element.hasReasonCode()) {
41129        openArray("reasonCode");
41130        for (CodeableConcept e : element.getReasonCode()) 
41131          composeCodeableConcept(null, e);
41132        closeArray();
41133      };
41134      if (element.hasReasonReference()) {
41135        openArray("reasonReference");
41136        for (Reference e : element.getReasonReference()) 
41137          composeReference(null, e);
41138        closeArray();
41139      };
41140      if (element.hasIsSubpotentElement()) {
41141        composeBooleanCore("isSubpotent", element.getIsSubpotentElement(), false);
41142        composeBooleanExtras("isSubpotent", element.getIsSubpotentElement(), false);
41143      }
41144      if (element.hasSubpotentReason()) {
41145        openArray("subpotentReason");
41146        for (CodeableConcept e : element.getSubpotentReason()) 
41147          composeCodeableConcept(null, e);
41148        closeArray();
41149      };
41150      if (element.hasEducation()) {
41151        openArray("education");
41152        for (Immunization.ImmunizationEducationComponent e : element.getEducation()) 
41153          composeImmunizationImmunizationEducationComponent(null, e);
41154        closeArray();
41155      };
41156      if (element.hasProgramEligibility()) {
41157        openArray("programEligibility");
41158        for (CodeableConcept e : element.getProgramEligibility()) 
41159          composeCodeableConcept(null, e);
41160        closeArray();
41161      };
41162      if (element.hasFundingSource()) {
41163        composeCodeableConcept("fundingSource", element.getFundingSource());
41164      }
41165      if (element.hasProtocolApplied()) {
41166        openArray("protocolApplied");
41167        for (Immunization.ImmunizationProtocolAppliedComponent e : element.getProtocolApplied()) 
41168          composeImmunizationImmunizationProtocolAppliedComponent(null, e);
41169        closeArray();
41170      };
41171  }
41172
41173  protected void composeImmunizationImmunizationPerformerComponent(String name, Immunization.ImmunizationPerformerComponent element) throws IOException {
41174    if (element != null) {
41175      open(name);
41176      composeImmunizationImmunizationPerformerComponentInner(element);
41177      close();
41178    }
41179  }
41180
41181  protected void composeImmunizationImmunizationPerformerComponentInner(Immunization.ImmunizationPerformerComponent element) throws IOException {
41182      composeBackbone(element);
41183      if (element.hasFunction()) {
41184        composeCodeableConcept("function", element.getFunction());
41185      }
41186      if (element.hasActor()) {
41187        composeReference("actor", element.getActor());
41188      }
41189  }
41190
41191  protected void composeImmunizationImmunizationEducationComponent(String name, Immunization.ImmunizationEducationComponent element) throws IOException {
41192    if (element != null) {
41193      open(name);
41194      composeImmunizationImmunizationEducationComponentInner(element);
41195      close();
41196    }
41197  }
41198
41199  protected void composeImmunizationImmunizationEducationComponentInner(Immunization.ImmunizationEducationComponent element) throws IOException {
41200      composeBackbone(element);
41201      if (element.hasDocumentTypeElement()) {
41202        composeStringCore("documentType", element.getDocumentTypeElement(), false);
41203        composeStringExtras("documentType", element.getDocumentTypeElement(), false);
41204      }
41205      if (element.hasReferenceElement()) {
41206        composeUriCore("reference", element.getReferenceElement(), false);
41207        composeUriExtras("reference", element.getReferenceElement(), false);
41208      }
41209      if (element.hasPublicationDateElement()) {
41210        composeDateTimeCore("publicationDate", element.getPublicationDateElement(), false);
41211        composeDateTimeExtras("publicationDate", element.getPublicationDateElement(), false);
41212      }
41213      if (element.hasPresentationDateElement()) {
41214        composeDateTimeCore("presentationDate", element.getPresentationDateElement(), false);
41215        composeDateTimeExtras("presentationDate", element.getPresentationDateElement(), false);
41216      }
41217  }
41218
41219  protected void composeImmunizationImmunizationProtocolAppliedComponent(String name, Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
41220    if (element != null) {
41221      open(name);
41222      composeImmunizationImmunizationProtocolAppliedComponentInner(element);
41223      close();
41224    }
41225  }
41226
41227  protected void composeImmunizationImmunizationProtocolAppliedComponentInner(Immunization.ImmunizationProtocolAppliedComponent element) throws IOException {
41228      composeBackbone(element);
41229      if (element.hasSeriesElement()) {
41230        composeStringCore("series", element.getSeriesElement(), false);
41231        composeStringExtras("series", element.getSeriesElement(), false);
41232      }
41233      if (element.hasAuthority()) {
41234        composeReference("authority", element.getAuthority());
41235      }
41236      if (element.hasTargetDisease()) {
41237        composeCodeableConcept("targetDisease", element.getTargetDisease());
41238      }
41239      if (element.hasDoseNumber()) {
41240        composeType("doseNumber", element.getDoseNumber());
41241      }
41242  }
41243
41244  protected void composeImmunizationEvaluation(String name, ImmunizationEvaluation element) throws IOException {
41245    if (element != null) {
41246      prop("resourceType", name);
41247      composeImmunizationEvaluationInner(element);
41248    }
41249  }
41250
41251  protected void composeImmunizationEvaluationInner(ImmunizationEvaluation element) throws IOException {
41252      composeDomainResourceElements(element);
41253      if (element.hasIdentifier()) {
41254        openArray("identifier");
41255        for (Identifier e : element.getIdentifier()) 
41256          composeIdentifier(null, e);
41257        closeArray();
41258      };
41259      if (element.hasStatusElement()) {
41260        composeEnumerationCore("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
41261        composeEnumerationExtras("status", element.getStatusElement(), new ImmunizationEvaluation.ImmunizationEvaluationStatusEnumFactory(), false);
41262      }
41263      if (element.hasPatient()) {
41264        composeReference("patient", element.getPatient());
41265      }
41266      if (element.hasDateElement()) {
41267        composeDateTimeCore("date", element.getDateElement(), false);
41268        composeDateTimeExtras("date", element.getDateElement(), false);
41269      }
41270      if (element.hasAuthority()) {
41271        composeReference("authority", element.getAuthority());
41272      }
41273      if (element.hasTargetDisease()) {
41274        composeCodeableConcept("targetDisease", element.getTargetDisease());
41275      }
41276      if (element.hasImmunizationEvent()) {
41277        composeReference("immunizationEvent", element.getImmunizationEvent());
41278      }
41279      if (element.hasDoseStatus()) {
41280        composeCodeableConcept("doseStatus", element.getDoseStatus());
41281      }
41282      if (element.hasDoseStatusReason()) {
41283        openArray("doseStatusReason");
41284        for (CodeableConcept e : element.getDoseStatusReason()) 
41285          composeCodeableConcept(null, e);
41286        closeArray();
41287      };
41288      if (element.hasDescriptionElement()) {
41289        composeStringCore("description", element.getDescriptionElement(), false);
41290        composeStringExtras("description", element.getDescriptionElement(), false);
41291      }
41292      if (element.hasSeriesElement()) {
41293        composeStringCore("series", element.getSeriesElement(), false);
41294        composeStringExtras("series", element.getSeriesElement(), false);
41295      }
41296      if (element.hasDoseNumber()) {
41297        composeType("doseNumber", element.getDoseNumber());
41298      }
41299      if (element.hasSeriesDoses()) {
41300        composeType("seriesDoses", element.getSeriesDoses());
41301      }
41302  }
41303
41304  protected void composeImmunizationRecommendation(String name, ImmunizationRecommendation element) throws IOException {
41305    if (element != null) {
41306      prop("resourceType", name);
41307      composeImmunizationRecommendationInner(element);
41308    }
41309  }
41310
41311  protected void composeImmunizationRecommendationInner(ImmunizationRecommendation element) throws IOException {
41312      composeDomainResourceElements(element);
41313      if (element.hasIdentifier()) {
41314        openArray("identifier");
41315        for (Identifier e : element.getIdentifier()) 
41316          composeIdentifier(null, e);
41317        closeArray();
41318      };
41319      if (element.hasPatient()) {
41320        composeReference("patient", element.getPatient());
41321      }
41322      if (element.hasDateElement()) {
41323        composeDateTimeCore("date", element.getDateElement(), false);
41324        composeDateTimeExtras("date", element.getDateElement(), false);
41325      }
41326      if (element.hasAuthority()) {
41327        composeReference("authority", element.getAuthority());
41328      }
41329      if (element.hasRecommendation()) {
41330        openArray("recommendation");
41331        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent e : element.getRecommendation()) 
41332          composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(null, e);
41333        closeArray();
41334      };
41335  }
41336
41337  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
41338    if (element != null) {
41339      open(name);
41340      composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(element);
41341      close();
41342    }
41343  }
41344
41345  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationComponent element) throws IOException {
41346      composeBackbone(element);
41347      if (element.hasVaccineCode()) {
41348        openArray("vaccineCode");
41349        for (CodeableConcept e : element.getVaccineCode()) 
41350          composeCodeableConcept(null, e);
41351        closeArray();
41352      };
41353      if (element.hasTargetDisease()) {
41354        composeCodeableConcept("targetDisease", element.getTargetDisease());
41355      }
41356      if (element.hasContraindicatedVaccineCode()) {
41357        openArray("contraindicatedVaccineCode");
41358        for (CodeableConcept e : element.getContraindicatedVaccineCode()) 
41359          composeCodeableConcept(null, e);
41360        closeArray();
41361      };
41362      if (element.hasForecastStatus()) {
41363        composeCodeableConcept("forecastStatus", element.getForecastStatus());
41364      }
41365      if (element.hasForecastReason()) {
41366        openArray("forecastReason");
41367        for (CodeableConcept e : element.getForecastReason()) 
41368          composeCodeableConcept(null, e);
41369        closeArray();
41370      };
41371      if (element.hasDateCriterion()) {
41372        openArray("dateCriterion");
41373        for (ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent e : element.getDateCriterion()) 
41374          composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(null, e);
41375        closeArray();
41376      };
41377      if (element.hasDescriptionElement()) {
41378        composeStringCore("description", element.getDescriptionElement(), false);
41379        composeStringExtras("description", element.getDescriptionElement(), false);
41380      }
41381      if (element.hasSeriesElement()) {
41382        composeStringCore("series", element.getSeriesElement(), false);
41383        composeStringExtras("series", element.getSeriesElement(), false);
41384      }
41385      if (element.hasDoseNumber()) {
41386        composeType("doseNumber", element.getDoseNumber());
41387      }
41388      if (element.hasSeriesDoses()) {
41389        composeType("seriesDoses", element.getSeriesDoses());
41390      }
41391      if (element.hasSupportingImmunization()) {
41392        openArray("supportingImmunization");
41393        for (Reference e : element.getSupportingImmunization()) 
41394          composeReference(null, e);
41395        closeArray();
41396      };
41397      if (element.hasSupportingPatientInformation()) {
41398        openArray("supportingPatientInformation");
41399        for (Reference e : element.getSupportingPatientInformation()) 
41400          composeReference(null, e);
41401        closeArray();
41402      };
41403  }
41404
41405  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponent(String name, ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
41406    if (element != null) {
41407      open(name);
41408      composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(element);
41409      close();
41410    }
41411  }
41412
41413  protected void composeImmunizationRecommendationImmunizationRecommendationRecommendationDateCriterionComponentInner(ImmunizationRecommendation.ImmunizationRecommendationRecommendationDateCriterionComponent element) throws IOException {
41414      composeBackbone(element);
41415      if (element.hasCode()) {
41416        composeCodeableConcept("code", element.getCode());
41417      }
41418      if (element.hasValueElement()) {
41419        composeDateTimeCore("value", element.getValueElement(), false);
41420        composeDateTimeExtras("value", element.getValueElement(), false);
41421      }
41422  }
41423
41424  protected void composeImplementationGuide(String name, ImplementationGuide element) throws IOException {
41425    if (element != null) {
41426      prop("resourceType", name);
41427      composeImplementationGuideInner(element);
41428    }
41429  }
41430
41431  protected void composeImplementationGuideInner(ImplementationGuide element) throws IOException {
41432      composeDomainResourceElements(element);
41433      if (element.hasUrlElement()) {
41434        composeUriCore("url", element.getUrlElement(), false);
41435        composeUriExtras("url", element.getUrlElement(), false);
41436      }
41437      if (element.hasVersionElement()) {
41438        composeStringCore("version", element.getVersionElement(), false);
41439        composeStringExtras("version", element.getVersionElement(), false);
41440      }
41441      if (element.hasNameElement()) {
41442        composeStringCore("name", element.getNameElement(), false);
41443        composeStringExtras("name", element.getNameElement(), false);
41444      }
41445      if (element.hasTitleElement()) {
41446        composeStringCore("title", element.getTitleElement(), false);
41447        composeStringExtras("title", element.getTitleElement(), false);
41448      }
41449      if (element.hasStatusElement()) {
41450        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41451        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41452      }
41453      if (element.hasExperimentalElement()) {
41454        composeBooleanCore("experimental", element.getExperimentalElement(), false);
41455        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
41456      }
41457      if (element.hasDateElement()) {
41458        composeDateTimeCore("date", element.getDateElement(), false);
41459        composeDateTimeExtras("date", element.getDateElement(), false);
41460      }
41461      if (element.hasPublisherElement()) {
41462        composeStringCore("publisher", element.getPublisherElement(), false);
41463        composeStringExtras("publisher", element.getPublisherElement(), false);
41464      }
41465      if (element.hasContact()) {
41466        openArray("contact");
41467        for (ContactDetail e : element.getContact()) 
41468          composeContactDetail(null, e);
41469        closeArray();
41470      };
41471      if (element.hasDescriptionElement()) {
41472        composeMarkdownCore("description", element.getDescriptionElement(), false);
41473        composeMarkdownExtras("description", element.getDescriptionElement(), false);
41474      }
41475      if (element.hasUseContext()) {
41476        openArray("useContext");
41477        for (UsageContext e : element.getUseContext()) 
41478          composeUsageContext(null, e);
41479        closeArray();
41480      };
41481      if (element.hasJurisdiction()) {
41482        openArray("jurisdiction");
41483        for (CodeableConcept e : element.getJurisdiction()) 
41484          composeCodeableConcept(null, e);
41485        closeArray();
41486      };
41487      if (element.hasCopyrightElement()) {
41488        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
41489        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
41490      }
41491      if (element.hasPackageIdElement()) {
41492        composeIdCore("packageId", element.getPackageIdElement(), false);
41493        composeIdExtras("packageId", element.getPackageIdElement(), false);
41494      }
41495      if (element.hasLicenseElement()) {
41496        composeEnumerationCore("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
41497        composeEnumerationExtras("license", element.getLicenseElement(), new ImplementationGuide.SPDXLicenseEnumFactory(), false);
41498      }
41499      if (element.hasFhirVersionElement()) {
41500        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
41501        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
41502      }
41503      if (element.hasDependsOn()) {
41504        openArray("dependsOn");
41505        for (ImplementationGuide.ImplementationGuideDependsOnComponent e : element.getDependsOn()) 
41506          composeImplementationGuideImplementationGuideDependsOnComponent(null, e);
41507        closeArray();
41508      };
41509      if (element.hasGlobal()) {
41510        openArray("global");
41511        for (ImplementationGuide.ImplementationGuideGlobalComponent e : element.getGlobal()) 
41512          composeImplementationGuideImplementationGuideGlobalComponent(null, e);
41513        closeArray();
41514      };
41515      if (element.hasDefinition()) {
41516        composeImplementationGuideImplementationGuideDefinitionComponent("definition", element.getDefinition());
41517      }
41518      if (element.hasManifest()) {
41519        composeImplementationGuideImplementationGuideManifestComponent("manifest", element.getManifest());
41520      }
41521  }
41522
41523  protected void composeImplementationGuideImplementationGuideDependsOnComponent(String name, ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
41524    if (element != null) {
41525      open(name);
41526      composeImplementationGuideImplementationGuideDependsOnComponentInner(element);
41527      close();
41528    }
41529  }
41530
41531  protected void composeImplementationGuideImplementationGuideDependsOnComponentInner(ImplementationGuide.ImplementationGuideDependsOnComponent element) throws IOException {
41532      composeBackbone(element);
41533      if (element.hasUriElement()) {
41534        composeCanonicalCore("uri", element.getUriElement(), false);
41535        composeCanonicalExtras("uri", element.getUriElement(), false);
41536      }
41537      if (element.hasPackageIdElement()) {
41538        composeIdCore("packageId", element.getPackageIdElement(), false);
41539        composeIdExtras("packageId", element.getPackageIdElement(), false);
41540      }
41541      if (element.hasVersionElement()) {
41542        composeStringCore("version", element.getVersionElement(), false);
41543        composeStringExtras("version", element.getVersionElement(), false);
41544      }
41545  }
41546
41547  protected void composeImplementationGuideImplementationGuideGlobalComponent(String name, ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
41548    if (element != null) {
41549      open(name);
41550      composeImplementationGuideImplementationGuideGlobalComponentInner(element);
41551      close();
41552    }
41553  }
41554
41555  protected void composeImplementationGuideImplementationGuideGlobalComponentInner(ImplementationGuide.ImplementationGuideGlobalComponent element) throws IOException {
41556      composeBackbone(element);
41557      if (element.hasTypeElement()) {
41558        composeCodeCore("type", element.getTypeElement(), false);
41559        composeCodeExtras("type", element.getTypeElement(), false);
41560      }
41561      if (element.hasProfileElement()) {
41562        composeCanonicalCore("profile", element.getProfileElement(), false);
41563        composeCanonicalExtras("profile", element.getProfileElement(), false);
41564      }
41565  }
41566
41567  protected void composeImplementationGuideImplementationGuideDefinitionComponent(String name, ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
41568    if (element != null) {
41569      open(name);
41570      composeImplementationGuideImplementationGuideDefinitionComponentInner(element);
41571      close();
41572    }
41573  }
41574
41575  protected void composeImplementationGuideImplementationGuideDefinitionComponentInner(ImplementationGuide.ImplementationGuideDefinitionComponent element) throws IOException {
41576      composeBackbone(element);
41577      if (element.hasPackage()) {
41578        openArray("package");
41579        for (ImplementationGuide.ImplementationGuideDefinitionPackageComponent e : element.getPackage()) 
41580          composeImplementationGuideImplementationGuideDefinitionPackageComponent(null, e);
41581        closeArray();
41582      };
41583      if (element.hasResource()) {
41584        openArray("resource");
41585        for (ImplementationGuide.ImplementationGuideDefinitionResourceComponent e : element.getResource()) 
41586          composeImplementationGuideImplementationGuideDefinitionResourceComponent(null, e);
41587        closeArray();
41588      };
41589      if (element.hasPage()) {
41590        composeImplementationGuideImplementationGuideDefinitionPageComponent("page", element.getPage());
41591      }
41592      if (element.hasParameter()) {
41593        openArray("parameter");
41594        for (ImplementationGuide.ImplementationGuideDefinitionParameterComponent e : element.getParameter()) 
41595          composeImplementationGuideImplementationGuideDefinitionParameterComponent(null, e);
41596        closeArray();
41597      };
41598      if (element.hasTemplate()) {
41599        openArray("template");
41600        for (ImplementationGuide.ImplementationGuideDefinitionTemplateComponent e : element.getTemplate()) 
41601          composeImplementationGuideImplementationGuideDefinitionTemplateComponent(null, e);
41602        closeArray();
41603      };
41604  }
41605
41606  protected void composeImplementationGuideImplementationGuideDefinitionPackageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPackageComponent element) throws IOException {
41607    if (element != null) {
41608      open(name);
41609      composeImplementationGuideImplementationGuideDefinitionPackageComponentInner(element);
41610      close();
41611    }
41612  }
41613
41614  protected void composeImplementationGuideImplementationGuideDefinitionPackageComponentInner(ImplementationGuide.ImplementationGuideDefinitionPackageComponent element) throws IOException {
41615      composeBackbone(element);
41616      if (element.hasNameElement()) {
41617        composeStringCore("name", element.getNameElement(), false);
41618        composeStringExtras("name", element.getNameElement(), false);
41619      }
41620      if (element.hasDescriptionElement()) {
41621        composeStringCore("description", element.getDescriptionElement(), false);
41622        composeStringExtras("description", element.getDescriptionElement(), false);
41623      }
41624  }
41625
41626  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponent(String name, ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
41627    if (element != null) {
41628      open(name);
41629      composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(element);
41630      close();
41631    }
41632  }
41633
41634  protected void composeImplementationGuideImplementationGuideDefinitionResourceComponentInner(ImplementationGuide.ImplementationGuideDefinitionResourceComponent element) throws IOException {
41635      composeBackbone(element);
41636      if (element.hasReference()) {
41637        composeReference("reference", element.getReference());
41638      }
41639      if (element.hasNameElement()) {
41640        composeStringCore("name", element.getNameElement(), false);
41641        composeStringExtras("name", element.getNameElement(), false);
41642      }
41643      if (element.hasDescriptionElement()) {
41644        composeStringCore("description", element.getDescriptionElement(), false);
41645        composeStringExtras("description", element.getDescriptionElement(), false);
41646      }
41647      if (element.hasExample()) {
41648        composeType("example", element.getExample());
41649      }
41650      if (element.hasPackageElement()) {
41651        composeIdCore("package", element.getPackageElement(), false);
41652        composeIdExtras("package", element.getPackageElement(), false);
41653      }
41654  }
41655
41656  protected void composeImplementationGuideImplementationGuideDefinitionPageComponent(String name, ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
41657    if (element != null) {
41658      open(name);
41659      composeImplementationGuideImplementationGuideDefinitionPageComponentInner(element);
41660      close();
41661    }
41662  }
41663
41664  protected void composeImplementationGuideImplementationGuideDefinitionPageComponentInner(ImplementationGuide.ImplementationGuideDefinitionPageComponent element) throws IOException {
41665      composeBackbone(element);
41666      if (element.hasName()) {
41667        composeType("name", element.getName());
41668      }
41669      if (element.hasTitleElement()) {
41670        composeStringCore("title", element.getTitleElement(), false);
41671        composeStringExtras("title", element.getTitleElement(), false);
41672      }
41673      if (element.hasGenerationElement()) {
41674        composeEnumerationCore("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
41675        composeEnumerationExtras("generation", element.getGenerationElement(), new ImplementationGuide.GuidePageGenerationEnumFactory(), false);
41676      }
41677      if (element.hasPage()) {
41678        openArray("page");
41679        for (ImplementationGuide.ImplementationGuideDefinitionPageComponent e : element.getPage()) 
41680          composeImplementationGuideImplementationGuideDefinitionPageComponent(null, e);
41681        closeArray();
41682      };
41683  }
41684
41685  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponent(String name, ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
41686    if (element != null) {
41687      open(name);
41688      composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(element);
41689      close();
41690    }
41691  }
41692
41693  protected void composeImplementationGuideImplementationGuideDefinitionParameterComponentInner(ImplementationGuide.ImplementationGuideDefinitionParameterComponent element) throws IOException {
41694      composeBackbone(element);
41695      if (element.hasCodeElement()) {
41696        composeEnumerationCore("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false);
41697        composeEnumerationExtras("code", element.getCodeElement(), new ImplementationGuide.GuideParameterCodeEnumFactory(), false);
41698      }
41699      if (element.hasValueElement()) {
41700        composeStringCore("value", element.getValueElement(), false);
41701        composeStringExtras("value", element.getValueElement(), false);
41702      }
41703  }
41704
41705  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponent(String name, ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
41706    if (element != null) {
41707      open(name);
41708      composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(element);
41709      close();
41710    }
41711  }
41712
41713  protected void composeImplementationGuideImplementationGuideDefinitionTemplateComponentInner(ImplementationGuide.ImplementationGuideDefinitionTemplateComponent element) throws IOException {
41714      composeBackbone(element);
41715      if (element.hasCodeElement()) {
41716        composeCodeCore("code", element.getCodeElement(), false);
41717        composeCodeExtras("code", element.getCodeElement(), false);
41718      }
41719      if (element.hasSourceElement()) {
41720        composeStringCore("source", element.getSourceElement(), false);
41721        composeStringExtras("source", element.getSourceElement(), false);
41722      }
41723      if (element.hasScopeElement()) {
41724        composeStringCore("scope", element.getScopeElement(), false);
41725        composeStringExtras("scope", element.getScopeElement(), false);
41726      }
41727  }
41728
41729  protected void composeImplementationGuideImplementationGuideManifestComponent(String name, ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
41730    if (element != null) {
41731      open(name);
41732      composeImplementationGuideImplementationGuideManifestComponentInner(element);
41733      close();
41734    }
41735  }
41736
41737  protected void composeImplementationGuideImplementationGuideManifestComponentInner(ImplementationGuide.ImplementationGuideManifestComponent element) throws IOException {
41738      composeBackbone(element);
41739      if (element.hasRenderingElement()) {
41740        composeUrlCore("rendering", element.getRenderingElement(), false);
41741        composeUrlExtras("rendering", element.getRenderingElement(), false);
41742      }
41743      if (element.hasResource()) {
41744        openArray("resource");
41745        for (ImplementationGuide.ManifestResourceComponent e : element.getResource()) 
41746          composeImplementationGuideManifestResourceComponent(null, e);
41747        closeArray();
41748      };
41749      if (element.hasPage()) {
41750        openArray("page");
41751        for (ImplementationGuide.ManifestPageComponent e : element.getPage()) 
41752          composeImplementationGuideManifestPageComponent(null, e);
41753        closeArray();
41754      };
41755      if (element.hasImage()) {
41756        openArray("image");
41757        for (StringType e : element.getImage()) 
41758          composeStringCore(null, e, true);
41759        closeArray();
41760        if (anyHasExtras(element.getImage())) {
41761          openArray("_image");
41762          for (StringType e : element.getImage()) 
41763            composeStringExtras(null, e, true);
41764          closeArray();
41765        }
41766      };
41767      if (element.hasOther()) {
41768        openArray("other");
41769        for (StringType e : element.getOther()) 
41770          composeStringCore(null, e, true);
41771        closeArray();
41772        if (anyHasExtras(element.getOther())) {
41773          openArray("_other");
41774          for (StringType e : element.getOther()) 
41775            composeStringExtras(null, e, true);
41776          closeArray();
41777        }
41778      };
41779  }
41780
41781  protected void composeImplementationGuideManifestResourceComponent(String name, ImplementationGuide.ManifestResourceComponent element) throws IOException {
41782    if (element != null) {
41783      open(name);
41784      composeImplementationGuideManifestResourceComponentInner(element);
41785      close();
41786    }
41787  }
41788
41789  protected void composeImplementationGuideManifestResourceComponentInner(ImplementationGuide.ManifestResourceComponent element) throws IOException {
41790      composeBackbone(element);
41791      if (element.hasReference()) {
41792        composeReference("reference", element.getReference());
41793      }
41794      if (element.hasExample()) {
41795        composeType("example", element.getExample());
41796      }
41797      if (element.hasRelativePathElement()) {
41798        composeUrlCore("relativePath", element.getRelativePathElement(), false);
41799        composeUrlExtras("relativePath", element.getRelativePathElement(), false);
41800      }
41801  }
41802
41803  protected void composeImplementationGuideManifestPageComponent(String name, ImplementationGuide.ManifestPageComponent element) throws IOException {
41804    if (element != null) {
41805      open(name);
41806      composeImplementationGuideManifestPageComponentInner(element);
41807      close();
41808    }
41809  }
41810
41811  protected void composeImplementationGuideManifestPageComponentInner(ImplementationGuide.ManifestPageComponent element) throws IOException {
41812      composeBackbone(element);
41813      if (element.hasNameElement()) {
41814        composeStringCore("name", element.getNameElement(), false);
41815        composeStringExtras("name", element.getNameElement(), false);
41816      }
41817      if (element.hasTitleElement()) {
41818        composeStringCore("title", element.getTitleElement(), false);
41819        composeStringExtras("title", element.getTitleElement(), false);
41820      }
41821      if (element.hasAnchor()) {
41822        openArray("anchor");
41823        for (StringType e : element.getAnchor()) 
41824          composeStringCore(null, e, true);
41825        closeArray();
41826        if (anyHasExtras(element.getAnchor())) {
41827          openArray("_anchor");
41828          for (StringType e : element.getAnchor()) 
41829            composeStringExtras(null, e, true);
41830          closeArray();
41831        }
41832      };
41833  }
41834
41835  protected void composeInsurancePlan(String name, InsurancePlan element) throws IOException {
41836    if (element != null) {
41837      prop("resourceType", name);
41838      composeInsurancePlanInner(element);
41839    }
41840  }
41841
41842  protected void composeInsurancePlanInner(InsurancePlan element) throws IOException {
41843      composeDomainResourceElements(element);
41844      if (element.hasIdentifier()) {
41845        openArray("identifier");
41846        for (Identifier e : element.getIdentifier()) 
41847          composeIdentifier(null, e);
41848        closeArray();
41849      };
41850      if (element.hasStatusElement()) {
41851        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41852        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
41853      }
41854      if (element.hasType()) {
41855        openArray("type");
41856        for (CodeableConcept e : element.getType()) 
41857          composeCodeableConcept(null, e);
41858        closeArray();
41859      };
41860      if (element.hasNameElement()) {
41861        composeStringCore("name", element.getNameElement(), false);
41862        composeStringExtras("name", element.getNameElement(), false);
41863      }
41864      if (element.hasAlias()) {
41865        openArray("alias");
41866        for (StringType e : element.getAlias()) 
41867          composeStringCore(null, e, true);
41868        closeArray();
41869        if (anyHasExtras(element.getAlias())) {
41870          openArray("_alias");
41871          for (StringType e : element.getAlias()) 
41872            composeStringExtras(null, e, true);
41873          closeArray();
41874        }
41875      };
41876      if (element.hasPeriod()) {
41877        composePeriod("period", element.getPeriod());
41878      }
41879      if (element.hasOwnedBy()) {
41880        composeReference("ownedBy", element.getOwnedBy());
41881      }
41882      if (element.hasAdministeredBy()) {
41883        composeReference("administeredBy", element.getAdministeredBy());
41884      }
41885      if (element.hasCoverageArea()) {
41886        openArray("coverageArea");
41887        for (Reference e : element.getCoverageArea()) 
41888          composeReference(null, e);
41889        closeArray();
41890      };
41891      if (element.hasContact()) {
41892        openArray("contact");
41893        for (InsurancePlan.InsurancePlanContactComponent e : element.getContact()) 
41894          composeInsurancePlanInsurancePlanContactComponent(null, e);
41895        closeArray();
41896      };
41897      if (element.hasEndpoint()) {
41898        openArray("endpoint");
41899        for (Reference e : element.getEndpoint()) 
41900          composeReference(null, e);
41901        closeArray();
41902      };
41903      if (element.hasNetwork()) {
41904        openArray("network");
41905        for (Reference e : element.getNetwork()) 
41906          composeReference(null, e);
41907        closeArray();
41908      };
41909      if (element.hasCoverage()) {
41910        openArray("coverage");
41911        for (InsurancePlan.InsurancePlanCoverageComponent e : element.getCoverage()) 
41912          composeInsurancePlanInsurancePlanCoverageComponent(null, e);
41913        closeArray();
41914      };
41915      if (element.hasPlan()) {
41916        openArray("plan");
41917        for (InsurancePlan.InsurancePlanPlanComponent e : element.getPlan()) 
41918          composeInsurancePlanInsurancePlanPlanComponent(null, e);
41919        closeArray();
41920      };
41921  }
41922
41923  protected void composeInsurancePlanInsurancePlanContactComponent(String name, InsurancePlan.InsurancePlanContactComponent element) throws IOException {
41924    if (element != null) {
41925      open(name);
41926      composeInsurancePlanInsurancePlanContactComponentInner(element);
41927      close();
41928    }
41929  }
41930
41931  protected void composeInsurancePlanInsurancePlanContactComponentInner(InsurancePlan.InsurancePlanContactComponent element) throws IOException {
41932      composeBackbone(element);
41933      if (element.hasPurpose()) {
41934        composeCodeableConcept("purpose", element.getPurpose());
41935      }
41936      if (element.hasName()) {
41937        composeHumanName("name", element.getName());
41938      }
41939      if (element.hasTelecom()) {
41940        openArray("telecom");
41941        for (ContactPoint e : element.getTelecom()) 
41942          composeContactPoint(null, e);
41943        closeArray();
41944      };
41945      if (element.hasAddress()) {
41946        composeAddress("address", element.getAddress());
41947      }
41948  }
41949
41950  protected void composeInsurancePlanInsurancePlanCoverageComponent(String name, InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
41951    if (element != null) {
41952      open(name);
41953      composeInsurancePlanInsurancePlanCoverageComponentInner(element);
41954      close();
41955    }
41956  }
41957
41958  protected void composeInsurancePlanInsurancePlanCoverageComponentInner(InsurancePlan.InsurancePlanCoverageComponent element) throws IOException {
41959      composeBackbone(element);
41960      if (element.hasType()) {
41961        composeCodeableConcept("type", element.getType());
41962      }
41963      if (element.hasNetwork()) {
41964        openArray("network");
41965        for (Reference e : element.getNetwork()) 
41966          composeReference(null, e);
41967        closeArray();
41968      };
41969      if (element.hasBenefit()) {
41970        openArray("benefit");
41971        for (InsurancePlan.CoverageBenefitComponent e : element.getBenefit()) 
41972          composeInsurancePlanCoverageBenefitComponent(null, e);
41973        closeArray();
41974      };
41975  }
41976
41977  protected void composeInsurancePlanCoverageBenefitComponent(String name, InsurancePlan.CoverageBenefitComponent element) throws IOException {
41978    if (element != null) {
41979      open(name);
41980      composeInsurancePlanCoverageBenefitComponentInner(element);
41981      close();
41982    }
41983  }
41984
41985  protected void composeInsurancePlanCoverageBenefitComponentInner(InsurancePlan.CoverageBenefitComponent element) throws IOException {
41986      composeBackbone(element);
41987      if (element.hasType()) {
41988        composeCodeableConcept("type", element.getType());
41989      }
41990      if (element.hasRequirementElement()) {
41991        composeStringCore("requirement", element.getRequirementElement(), false);
41992        composeStringExtras("requirement", element.getRequirementElement(), false);
41993      }
41994      if (element.hasLimit()) {
41995        openArray("limit");
41996        for (InsurancePlan.CoverageBenefitLimitComponent e : element.getLimit()) 
41997          composeInsurancePlanCoverageBenefitLimitComponent(null, e);
41998        closeArray();
41999      };
42000  }
42001
42002  protected void composeInsurancePlanCoverageBenefitLimitComponent(String name, InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
42003    if (element != null) {
42004      open(name);
42005      composeInsurancePlanCoverageBenefitLimitComponentInner(element);
42006      close();
42007    }
42008  }
42009
42010  protected void composeInsurancePlanCoverageBenefitLimitComponentInner(InsurancePlan.CoverageBenefitLimitComponent element) throws IOException {
42011      composeBackbone(element);
42012      if (element.hasValue()) {
42013        composeQuantity("value", element.getValue());
42014      }
42015      if (element.hasCode()) {
42016        composeCodeableConcept("code", element.getCode());
42017      }
42018  }
42019
42020  protected void composeInsurancePlanInsurancePlanPlanComponent(String name, InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
42021    if (element != null) {
42022      open(name);
42023      composeInsurancePlanInsurancePlanPlanComponentInner(element);
42024      close();
42025    }
42026  }
42027
42028  protected void composeInsurancePlanInsurancePlanPlanComponentInner(InsurancePlan.InsurancePlanPlanComponent element) throws IOException {
42029      composeBackbone(element);
42030      if (element.hasIdentifier()) {
42031        openArray("identifier");
42032        for (Identifier e : element.getIdentifier()) 
42033          composeIdentifier(null, e);
42034        closeArray();
42035      };
42036      if (element.hasType()) {
42037        composeCodeableConcept("type", element.getType());
42038      }
42039      if (element.hasCoverageArea()) {
42040        openArray("coverageArea");
42041        for (Reference e : element.getCoverageArea()) 
42042          composeReference(null, e);
42043        closeArray();
42044      };
42045      if (element.hasNetwork()) {
42046        openArray("network");
42047        for (Reference e : element.getNetwork()) 
42048          composeReference(null, e);
42049        closeArray();
42050      };
42051      if (element.hasGeneralCost()) {
42052        openArray("generalCost");
42053        for (InsurancePlan.InsurancePlanPlanGeneralCostComponent e : element.getGeneralCost()) 
42054          composeInsurancePlanInsurancePlanPlanGeneralCostComponent(null, e);
42055        closeArray();
42056      };
42057      if (element.hasSpecificCost()) {
42058        openArray("specificCost");
42059        for (InsurancePlan.InsurancePlanPlanSpecificCostComponent e : element.getSpecificCost()) 
42060          composeInsurancePlanInsurancePlanPlanSpecificCostComponent(null, e);
42061        closeArray();
42062      };
42063  }
42064
42065  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponent(String name, InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
42066    if (element != null) {
42067      open(name);
42068      composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(element);
42069      close();
42070    }
42071  }
42072
42073  protected void composeInsurancePlanInsurancePlanPlanGeneralCostComponentInner(InsurancePlan.InsurancePlanPlanGeneralCostComponent element) throws IOException {
42074      composeBackbone(element);
42075      if (element.hasType()) {
42076        composeCodeableConcept("type", element.getType());
42077      }
42078      if (element.hasGroupSizeElement()) {
42079        composePositiveIntCore("groupSize", element.getGroupSizeElement(), false);
42080        composePositiveIntExtras("groupSize", element.getGroupSizeElement(), false);
42081      }
42082      if (element.hasCost()) {
42083        composeMoney("cost", element.getCost());
42084      }
42085      if (element.hasCommentElement()) {
42086        composeStringCore("comment", element.getCommentElement(), false);
42087        composeStringExtras("comment", element.getCommentElement(), false);
42088      }
42089  }
42090
42091  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponent(String name, InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
42092    if (element != null) {
42093      open(name);
42094      composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(element);
42095      close();
42096    }
42097  }
42098
42099  protected void composeInsurancePlanInsurancePlanPlanSpecificCostComponentInner(InsurancePlan.InsurancePlanPlanSpecificCostComponent element) throws IOException {
42100      composeBackbone(element);
42101      if (element.hasCategory()) {
42102        composeCodeableConcept("category", element.getCategory());
42103      }
42104      if (element.hasBenefit()) {
42105        openArray("benefit");
42106        for (InsurancePlan.PlanBenefitComponent e : element.getBenefit()) 
42107          composeInsurancePlanPlanBenefitComponent(null, e);
42108        closeArray();
42109      };
42110  }
42111
42112  protected void composeInsurancePlanPlanBenefitComponent(String name, InsurancePlan.PlanBenefitComponent element) throws IOException {
42113    if (element != null) {
42114      open(name);
42115      composeInsurancePlanPlanBenefitComponentInner(element);
42116      close();
42117    }
42118  }
42119
42120  protected void composeInsurancePlanPlanBenefitComponentInner(InsurancePlan.PlanBenefitComponent element) throws IOException {
42121      composeBackbone(element);
42122      if (element.hasType()) {
42123        composeCodeableConcept("type", element.getType());
42124      }
42125      if (element.hasCost()) {
42126        openArray("cost");
42127        for (InsurancePlan.PlanBenefitCostComponent e : element.getCost()) 
42128          composeInsurancePlanPlanBenefitCostComponent(null, e);
42129        closeArray();
42130      };
42131  }
42132
42133  protected void composeInsurancePlanPlanBenefitCostComponent(String name, InsurancePlan.PlanBenefitCostComponent element) throws IOException {
42134    if (element != null) {
42135      open(name);
42136      composeInsurancePlanPlanBenefitCostComponentInner(element);
42137      close();
42138    }
42139  }
42140
42141  protected void composeInsurancePlanPlanBenefitCostComponentInner(InsurancePlan.PlanBenefitCostComponent element) throws IOException {
42142      composeBackbone(element);
42143      if (element.hasType()) {
42144        composeCodeableConcept("type", element.getType());
42145      }
42146      if (element.hasApplicability()) {
42147        composeCodeableConcept("applicability", element.getApplicability());
42148      }
42149      if (element.hasQualifiers()) {
42150        openArray("qualifiers");
42151        for (CodeableConcept e : element.getQualifiers()) 
42152          composeCodeableConcept(null, e);
42153        closeArray();
42154      };
42155      if (element.hasValue()) {
42156        composeQuantity("value", element.getValue());
42157      }
42158  }
42159
42160  protected void composeInvoice(String name, Invoice element) throws IOException {
42161    if (element != null) {
42162      prop("resourceType", name);
42163      composeInvoiceInner(element);
42164    }
42165  }
42166
42167  protected void composeInvoiceInner(Invoice element) throws IOException {
42168      composeDomainResourceElements(element);
42169      if (element.hasIdentifier()) {
42170        openArray("identifier");
42171        for (Identifier e : element.getIdentifier()) 
42172          composeIdentifier(null, e);
42173        closeArray();
42174      };
42175      if (element.hasStatusElement()) {
42176        composeEnumerationCore("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
42177        composeEnumerationExtras("status", element.getStatusElement(), new Invoice.InvoiceStatusEnumFactory(), false);
42178      }
42179      if (element.hasCancelledReasonElement()) {
42180        composeStringCore("cancelledReason", element.getCancelledReasonElement(), false);
42181        composeStringExtras("cancelledReason", element.getCancelledReasonElement(), false);
42182      }
42183      if (element.hasType()) {
42184        composeCodeableConcept("type", element.getType());
42185      }
42186      if (element.hasSubject()) {
42187        composeReference("subject", element.getSubject());
42188      }
42189      if (element.hasRecipient()) {
42190        composeReference("recipient", element.getRecipient());
42191      }
42192      if (element.hasDateElement()) {
42193        composeDateTimeCore("date", element.getDateElement(), false);
42194        composeDateTimeExtras("date", element.getDateElement(), false);
42195      }
42196      if (element.hasParticipant()) {
42197        openArray("participant");
42198        for (Invoice.InvoiceParticipantComponent e : element.getParticipant()) 
42199          composeInvoiceInvoiceParticipantComponent(null, e);
42200        closeArray();
42201      };
42202      if (element.hasIssuer()) {
42203        composeReference("issuer", element.getIssuer());
42204      }
42205      if (element.hasAccount()) {
42206        composeReference("account", element.getAccount());
42207      }
42208      if (element.hasLineItem()) {
42209        openArray("lineItem");
42210        for (Invoice.InvoiceLineItemComponent e : element.getLineItem()) 
42211          composeInvoiceInvoiceLineItemComponent(null, e);
42212        closeArray();
42213      };
42214      if (element.hasTotalPriceComponent()) {
42215        openArray("totalPriceComponent");
42216        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getTotalPriceComponent()) 
42217          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
42218        closeArray();
42219      };
42220      if (element.hasTotalNet()) {
42221        composeMoney("totalNet", element.getTotalNet());
42222      }
42223      if (element.hasTotalGross()) {
42224        composeMoney("totalGross", element.getTotalGross());
42225      }
42226      if (element.hasPaymentTermsElement()) {
42227        composeMarkdownCore("paymentTerms", element.getPaymentTermsElement(), false);
42228        composeMarkdownExtras("paymentTerms", element.getPaymentTermsElement(), false);
42229      }
42230      if (element.hasNote()) {
42231        openArray("note");
42232        for (Annotation e : element.getNote()) 
42233          composeAnnotation(null, e);
42234        closeArray();
42235      };
42236  }
42237
42238  protected void composeInvoiceInvoiceParticipantComponent(String name, Invoice.InvoiceParticipantComponent element) throws IOException {
42239    if (element != null) {
42240      open(name);
42241      composeInvoiceInvoiceParticipantComponentInner(element);
42242      close();
42243    }
42244  }
42245
42246  protected void composeInvoiceInvoiceParticipantComponentInner(Invoice.InvoiceParticipantComponent element) throws IOException {
42247      composeBackbone(element);
42248      if (element.hasRole()) {
42249        composeCodeableConcept("role", element.getRole());
42250      }
42251      if (element.hasActor()) {
42252        composeReference("actor", element.getActor());
42253      }
42254  }
42255
42256  protected void composeInvoiceInvoiceLineItemComponent(String name, Invoice.InvoiceLineItemComponent element) throws IOException {
42257    if (element != null) {
42258      open(name);
42259      composeInvoiceInvoiceLineItemComponentInner(element);
42260      close();
42261    }
42262  }
42263
42264  protected void composeInvoiceInvoiceLineItemComponentInner(Invoice.InvoiceLineItemComponent element) throws IOException {
42265      composeBackbone(element);
42266      if (element.hasSequenceElement()) {
42267        composePositiveIntCore("sequence", element.getSequenceElement(), false);
42268        composePositiveIntExtras("sequence", element.getSequenceElement(), false);
42269      }
42270      if (element.hasChargeItem()) {
42271        composeType("chargeItem", element.getChargeItem());
42272      }
42273      if (element.hasPriceComponent()) {
42274        openArray("priceComponent");
42275        for (Invoice.InvoiceLineItemPriceComponentComponent e : element.getPriceComponent()) 
42276          composeInvoiceInvoiceLineItemPriceComponentComponent(null, e);
42277        closeArray();
42278      };
42279  }
42280
42281  protected void composeInvoiceInvoiceLineItemPriceComponentComponent(String name, Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
42282    if (element != null) {
42283      open(name);
42284      composeInvoiceInvoiceLineItemPriceComponentComponentInner(element);
42285      close();
42286    }
42287  }
42288
42289  protected void composeInvoiceInvoiceLineItemPriceComponentComponentInner(Invoice.InvoiceLineItemPriceComponentComponent element) throws IOException {
42290      composeBackbone(element);
42291      if (element.hasTypeElement()) {
42292        composeEnumerationCore("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
42293        composeEnumerationExtras("type", element.getTypeElement(), new Invoice.InvoicePriceComponentTypeEnumFactory(), false);
42294      }
42295      if (element.hasCode()) {
42296        composeCodeableConcept("code", element.getCode());
42297      }
42298      if (element.hasFactorElement()) {
42299        composeDecimalCore("factor", element.getFactorElement(), false);
42300        composeDecimalExtras("factor", element.getFactorElement(), false);
42301      }
42302      if (element.hasAmount()) {
42303        composeMoney("amount", element.getAmount());
42304      }
42305  }
42306
42307  protected void composeItemInstance(String name, ItemInstance element) throws IOException {
42308    if (element != null) {
42309      prop("resourceType", name);
42310      composeItemInstanceInner(element);
42311    }
42312  }
42313
42314  protected void composeItemInstanceInner(ItemInstance element) throws IOException {
42315      composeDomainResourceElements(element);
42316      if (element.hasCountElement()) {
42317        composeIntegerCore("count", element.getCountElement(), false);
42318        composeIntegerExtras("count", element.getCountElement(), false);
42319      }
42320      if (element.hasLocation()) {
42321        composeReference("location", element.getLocation());
42322      }
42323      if (element.hasSubject()) {
42324        composeReference("subject", element.getSubject());
42325      }
42326      if (element.hasManufactureDateElement()) {
42327        composeDateTimeCore("manufactureDate", element.getManufactureDateElement(), false);
42328        composeDateTimeExtras("manufactureDate", element.getManufactureDateElement(), false);
42329      }
42330      if (element.hasExpiryDateElement()) {
42331        composeDateTimeCore("expiryDate", element.getExpiryDateElement(), false);
42332        composeDateTimeExtras("expiryDate", element.getExpiryDateElement(), false);
42333      }
42334      if (element.hasCurrentSWVersionElement()) {
42335        composeStringCore("currentSWVersion", element.getCurrentSWVersionElement(), false);
42336        composeStringExtras("currentSWVersion", element.getCurrentSWVersionElement(), false);
42337      }
42338      if (element.hasLotNumberElement()) {
42339        composeStringCore("lotNumber", element.getLotNumberElement(), false);
42340        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
42341      }
42342      if (element.hasSerialNumberElement()) {
42343        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
42344        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
42345      }
42346      if (element.hasCarrierAIDCElement()) {
42347        composeStringCore("carrierAIDC", element.getCarrierAIDCElement(), false);
42348        composeStringExtras("carrierAIDC", element.getCarrierAIDCElement(), false);
42349      }
42350      if (element.hasCarrierHRFElement()) {
42351        composeStringCore("carrierHRF", element.getCarrierHRFElement(), false);
42352        composeStringExtras("carrierHRF", element.getCarrierHRFElement(), false);
42353      }
42354  }
42355
42356  protected void composeLibrary(String name, Library element) throws IOException {
42357    if (element != null) {
42358      prop("resourceType", name);
42359      composeLibraryInner(element);
42360    }
42361  }
42362
42363  protected void composeLibraryInner(Library element) throws IOException {
42364      composeDomainResourceElements(element);
42365      if (element.hasUrlElement()) {
42366        composeUriCore("url", element.getUrlElement(), false);
42367        composeUriExtras("url", element.getUrlElement(), false);
42368      }
42369      if (element.hasIdentifier()) {
42370        openArray("identifier");
42371        for (Identifier e : element.getIdentifier()) 
42372          composeIdentifier(null, e);
42373        closeArray();
42374      };
42375      if (element.hasVersionElement()) {
42376        composeStringCore("version", element.getVersionElement(), false);
42377        composeStringExtras("version", element.getVersionElement(), false);
42378      }
42379      if (element.hasNameElement()) {
42380        composeStringCore("name", element.getNameElement(), false);
42381        composeStringExtras("name", element.getNameElement(), false);
42382      }
42383      if (element.hasTitleElement()) {
42384        composeStringCore("title", element.getTitleElement(), false);
42385        composeStringExtras("title", element.getTitleElement(), false);
42386      }
42387      if (element.hasSubtitleElement()) {
42388        composeStringCore("subtitle", element.getSubtitleElement(), false);
42389        composeStringExtras("subtitle", element.getSubtitleElement(), false);
42390      }
42391      if (element.hasStatusElement()) {
42392        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42393        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42394      }
42395      if (element.hasExperimentalElement()) {
42396        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42397        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42398      }
42399      if (element.hasType()) {
42400        composeCodeableConcept("type", element.getType());
42401      }
42402      if (element.hasSubject()) {
42403        composeType("subject", element.getSubject());
42404      }
42405      if (element.hasDateElement()) {
42406        composeDateTimeCore("date", element.getDateElement(), false);
42407        composeDateTimeExtras("date", element.getDateElement(), false);
42408      }
42409      if (element.hasPublisherElement()) {
42410        composeStringCore("publisher", element.getPublisherElement(), false);
42411        composeStringExtras("publisher", element.getPublisherElement(), false);
42412      }
42413      if (element.hasContact()) {
42414        openArray("contact");
42415        for (ContactDetail e : element.getContact()) 
42416          composeContactDetail(null, e);
42417        closeArray();
42418      };
42419      if (element.hasDescriptionElement()) {
42420        composeMarkdownCore("description", element.getDescriptionElement(), false);
42421        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42422      }
42423      if (element.hasUseContext()) {
42424        openArray("useContext");
42425        for (UsageContext e : element.getUseContext()) 
42426          composeUsageContext(null, e);
42427        closeArray();
42428      };
42429      if (element.hasJurisdiction()) {
42430        openArray("jurisdiction");
42431        for (CodeableConcept e : element.getJurisdiction()) 
42432          composeCodeableConcept(null, e);
42433        closeArray();
42434      };
42435      if (element.hasPurposeElement()) {
42436        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42437        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42438      }
42439      if (element.hasUsageElement()) {
42440        composeStringCore("usage", element.getUsageElement(), false);
42441        composeStringExtras("usage", element.getUsageElement(), false);
42442      }
42443      if (element.hasCopyrightElement()) {
42444        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
42445        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
42446      }
42447      if (element.hasApprovalDateElement()) {
42448        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42449        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42450      }
42451      if (element.hasLastReviewDateElement()) {
42452        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42453        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42454      }
42455      if (element.hasEffectivePeriod()) {
42456        composePeriod("effectivePeriod", element.getEffectivePeriod());
42457      }
42458      if (element.hasTopic()) {
42459        openArray("topic");
42460        for (CodeableConcept e : element.getTopic()) 
42461          composeCodeableConcept(null, e);
42462        closeArray();
42463      };
42464      if (element.hasAuthor()) {
42465        openArray("author");
42466        for (ContactDetail e : element.getAuthor()) 
42467          composeContactDetail(null, e);
42468        closeArray();
42469      };
42470      if (element.hasEditor()) {
42471        openArray("editor");
42472        for (ContactDetail e : element.getEditor()) 
42473          composeContactDetail(null, e);
42474        closeArray();
42475      };
42476      if (element.hasReviewer()) {
42477        openArray("reviewer");
42478        for (ContactDetail e : element.getReviewer()) 
42479          composeContactDetail(null, e);
42480        closeArray();
42481      };
42482      if (element.hasEndorser()) {
42483        openArray("endorser");
42484        for (ContactDetail e : element.getEndorser()) 
42485          composeContactDetail(null, e);
42486        closeArray();
42487      };
42488      if (element.hasRelatedArtifact()) {
42489        openArray("relatedArtifact");
42490        for (RelatedArtifact e : element.getRelatedArtifact()) 
42491          composeRelatedArtifact(null, e);
42492        closeArray();
42493      };
42494      if (element.hasParameter()) {
42495        openArray("parameter");
42496        for (ParameterDefinition e : element.getParameter()) 
42497          composeParameterDefinition(null, e);
42498        closeArray();
42499      };
42500      if (element.hasDataRequirement()) {
42501        openArray("dataRequirement");
42502        for (DataRequirement e : element.getDataRequirement()) 
42503          composeDataRequirement(null, e);
42504        closeArray();
42505      };
42506      if (element.hasContent()) {
42507        openArray("content");
42508        for (Attachment e : element.getContent()) 
42509          composeAttachment(null, e);
42510        closeArray();
42511      };
42512  }
42513
42514  protected void composeLinkage(String name, Linkage element) throws IOException {
42515    if (element != null) {
42516      prop("resourceType", name);
42517      composeLinkageInner(element);
42518    }
42519  }
42520
42521  protected void composeLinkageInner(Linkage element) throws IOException {
42522      composeDomainResourceElements(element);
42523      if (element.hasActiveElement()) {
42524        composeBooleanCore("active", element.getActiveElement(), false);
42525        composeBooleanExtras("active", element.getActiveElement(), false);
42526      }
42527      if (element.hasAuthor()) {
42528        composeReference("author", element.getAuthor());
42529      }
42530      if (element.hasItem()) {
42531        openArray("item");
42532        for (Linkage.LinkageItemComponent e : element.getItem()) 
42533          composeLinkageLinkageItemComponent(null, e);
42534        closeArray();
42535      };
42536  }
42537
42538  protected void composeLinkageLinkageItemComponent(String name, Linkage.LinkageItemComponent element) throws IOException {
42539    if (element != null) {
42540      open(name);
42541      composeLinkageLinkageItemComponentInner(element);
42542      close();
42543    }
42544  }
42545
42546  protected void composeLinkageLinkageItemComponentInner(Linkage.LinkageItemComponent element) throws IOException {
42547      composeBackbone(element);
42548      if (element.hasTypeElement()) {
42549        composeEnumerationCore("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
42550        composeEnumerationExtras("type", element.getTypeElement(), new Linkage.LinkageTypeEnumFactory(), false);
42551      }
42552      if (element.hasResource()) {
42553        composeReference("resource", element.getResource());
42554      }
42555  }
42556
42557  protected void composeListResource(String name, ListResource element) throws IOException {
42558    if (element != null) {
42559      prop("resourceType", name);
42560      composeListResourceInner(element);
42561    }
42562  }
42563
42564  protected void composeListResourceInner(ListResource element) throws IOException {
42565      composeDomainResourceElements(element);
42566      if (element.hasIdentifier()) {
42567        openArray("identifier");
42568        for (Identifier e : element.getIdentifier()) 
42569          composeIdentifier(null, e);
42570        closeArray();
42571      };
42572      if (element.hasStatusElement()) {
42573        composeEnumerationCore("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
42574        composeEnumerationExtras("status", element.getStatusElement(), new ListResource.ListStatusEnumFactory(), false);
42575      }
42576      if (element.hasModeElement()) {
42577        composeEnumerationCore("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
42578        composeEnumerationExtras("mode", element.getModeElement(), new ListResource.ListModeEnumFactory(), false);
42579      }
42580      if (element.hasTitleElement()) {
42581        composeStringCore("title", element.getTitleElement(), false);
42582        composeStringExtras("title", element.getTitleElement(), false);
42583      }
42584      if (element.hasCode()) {
42585        composeCodeableConcept("code", element.getCode());
42586      }
42587      if (element.hasSubject()) {
42588        composeReference("subject", element.getSubject());
42589      }
42590      if (element.hasEncounter()) {
42591        composeReference("encounter", element.getEncounter());
42592      }
42593      if (element.hasDateElement()) {
42594        composeDateTimeCore("date", element.getDateElement(), false);
42595        composeDateTimeExtras("date", element.getDateElement(), false);
42596      }
42597      if (element.hasSource()) {
42598        composeReference("source", element.getSource());
42599      }
42600      if (element.hasOrderedBy()) {
42601        composeCodeableConcept("orderedBy", element.getOrderedBy());
42602      }
42603      if (element.hasNote()) {
42604        openArray("note");
42605        for (Annotation e : element.getNote()) 
42606          composeAnnotation(null, e);
42607        closeArray();
42608      };
42609      if (element.hasEntry()) {
42610        openArray("entry");
42611        for (ListResource.ListEntryComponent e : element.getEntry()) 
42612          composeListResourceListEntryComponent(null, e);
42613        closeArray();
42614      };
42615      if (element.hasEmptyReason()) {
42616        composeCodeableConcept("emptyReason", element.getEmptyReason());
42617      }
42618  }
42619
42620  protected void composeListResourceListEntryComponent(String name, ListResource.ListEntryComponent element) throws IOException {
42621    if (element != null) {
42622      open(name);
42623      composeListResourceListEntryComponentInner(element);
42624      close();
42625    }
42626  }
42627
42628  protected void composeListResourceListEntryComponentInner(ListResource.ListEntryComponent element) throws IOException {
42629      composeBackbone(element);
42630      if (element.hasFlag()) {
42631        composeCodeableConcept("flag", element.getFlag());
42632      }
42633      if (element.hasDeletedElement()) {
42634        composeBooleanCore("deleted", element.getDeletedElement(), false);
42635        composeBooleanExtras("deleted", element.getDeletedElement(), false);
42636      }
42637      if (element.hasDateElement()) {
42638        composeDateTimeCore("date", element.getDateElement(), false);
42639        composeDateTimeExtras("date", element.getDateElement(), false);
42640      }
42641      if (element.hasItem()) {
42642        composeReference("item", element.getItem());
42643      }
42644  }
42645
42646  protected void composeLocation(String name, Location element) throws IOException {
42647    if (element != null) {
42648      prop("resourceType", name);
42649      composeLocationInner(element);
42650    }
42651  }
42652
42653  protected void composeLocationInner(Location element) throws IOException {
42654      composeDomainResourceElements(element);
42655      if (element.hasIdentifier()) {
42656        openArray("identifier");
42657        for (Identifier e : element.getIdentifier()) 
42658          composeIdentifier(null, e);
42659        closeArray();
42660      };
42661      if (element.hasStatusElement()) {
42662        composeEnumerationCore("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
42663        composeEnumerationExtras("status", element.getStatusElement(), new Location.LocationStatusEnumFactory(), false);
42664      }
42665      if (element.hasOperationalStatus()) {
42666        composeCoding("operationalStatus", element.getOperationalStatus());
42667      }
42668      if (element.hasNameElement()) {
42669        composeStringCore("name", element.getNameElement(), false);
42670        composeStringExtras("name", element.getNameElement(), false);
42671      }
42672      if (element.hasAlias()) {
42673        openArray("alias");
42674        for (StringType e : element.getAlias()) 
42675          composeStringCore(null, e, true);
42676        closeArray();
42677        if (anyHasExtras(element.getAlias())) {
42678          openArray("_alias");
42679          for (StringType e : element.getAlias()) 
42680            composeStringExtras(null, e, true);
42681          closeArray();
42682        }
42683      };
42684      if (element.hasDescriptionElement()) {
42685        composeStringCore("description", element.getDescriptionElement(), false);
42686        composeStringExtras("description", element.getDescriptionElement(), false);
42687      }
42688      if (element.hasModeElement()) {
42689        composeEnumerationCore("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
42690        composeEnumerationExtras("mode", element.getModeElement(), new Location.LocationModeEnumFactory(), false);
42691      }
42692      if (element.hasType()) {
42693        openArray("type");
42694        for (CodeableConcept e : element.getType()) 
42695          composeCodeableConcept(null, e);
42696        closeArray();
42697      };
42698      if (element.hasTelecom()) {
42699        openArray("telecom");
42700        for (ContactPoint e : element.getTelecom()) 
42701          composeContactPoint(null, e);
42702        closeArray();
42703      };
42704      if (element.hasAddress()) {
42705        composeAddress("address", element.getAddress());
42706      }
42707      if (element.hasPhysicalType()) {
42708        composeCodeableConcept("physicalType", element.getPhysicalType());
42709      }
42710      if (element.hasPosition()) {
42711        composeLocationLocationPositionComponent("position", element.getPosition());
42712      }
42713      if (element.hasManagingOrganization()) {
42714        composeReference("managingOrganization", element.getManagingOrganization());
42715      }
42716      if (element.hasPartOf()) {
42717        composeReference("partOf", element.getPartOf());
42718      }
42719      if (element.hasHoursOfOperation()) {
42720        openArray("hoursOfOperation");
42721        for (Location.LocationHoursOfOperationComponent e : element.getHoursOfOperation()) 
42722          composeLocationLocationHoursOfOperationComponent(null, e);
42723        closeArray();
42724      };
42725      if (element.hasAvailabilityExceptionsElement()) {
42726        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
42727        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
42728      }
42729      if (element.hasEndpoint()) {
42730        openArray("endpoint");
42731        for (Reference e : element.getEndpoint()) 
42732          composeReference(null, e);
42733        closeArray();
42734      };
42735  }
42736
42737  protected void composeLocationLocationPositionComponent(String name, Location.LocationPositionComponent element) throws IOException {
42738    if (element != null) {
42739      open(name);
42740      composeLocationLocationPositionComponentInner(element);
42741      close();
42742    }
42743  }
42744
42745  protected void composeLocationLocationPositionComponentInner(Location.LocationPositionComponent element) throws IOException {
42746      composeBackbone(element);
42747      if (element.hasLongitudeElement()) {
42748        composeDecimalCore("longitude", element.getLongitudeElement(), false);
42749        composeDecimalExtras("longitude", element.getLongitudeElement(), false);
42750      }
42751      if (element.hasLatitudeElement()) {
42752        composeDecimalCore("latitude", element.getLatitudeElement(), false);
42753        composeDecimalExtras("latitude", element.getLatitudeElement(), false);
42754      }
42755      if (element.hasAltitudeElement()) {
42756        composeDecimalCore("altitude", element.getAltitudeElement(), false);
42757        composeDecimalExtras("altitude", element.getAltitudeElement(), false);
42758      }
42759  }
42760
42761  protected void composeLocationLocationHoursOfOperationComponent(String name, Location.LocationHoursOfOperationComponent element) throws IOException {
42762    if (element != null) {
42763      open(name);
42764      composeLocationLocationHoursOfOperationComponentInner(element);
42765      close();
42766    }
42767  }
42768
42769  protected void composeLocationLocationHoursOfOperationComponentInner(Location.LocationHoursOfOperationComponent element) throws IOException {
42770      composeBackbone(element);
42771      if (element.hasDaysOfWeek()) {
42772        openArray("daysOfWeek");
42773        for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
42774          composeEnumerationCore(null, e, new Location.DaysOfWeekEnumFactory(), true);
42775        closeArray();
42776        if (anyHasExtras(element.getDaysOfWeek())) {
42777          openArray("_daysOfWeek");
42778          for (Enumeration<Location.DaysOfWeek> e : element.getDaysOfWeek()) 
42779            composeEnumerationExtras(null, e, new Location.DaysOfWeekEnumFactory(), true);
42780          closeArray();
42781        }
42782      };
42783      if (element.hasAllDayElement()) {
42784        composeBooleanCore("allDay", element.getAllDayElement(), false);
42785        composeBooleanExtras("allDay", element.getAllDayElement(), false);
42786      }
42787      if (element.hasOpeningTimeElement()) {
42788        composeTimeCore("openingTime", element.getOpeningTimeElement(), false);
42789        composeTimeExtras("openingTime", element.getOpeningTimeElement(), false);
42790      }
42791      if (element.hasClosingTimeElement()) {
42792        composeTimeCore("closingTime", element.getClosingTimeElement(), false);
42793        composeTimeExtras("closingTime", element.getClosingTimeElement(), false);
42794      }
42795  }
42796
42797  protected void composeMeasure(String name, Measure element) throws IOException {
42798    if (element != null) {
42799      prop("resourceType", name);
42800      composeMeasureInner(element);
42801    }
42802  }
42803
42804  protected void composeMeasureInner(Measure element) throws IOException {
42805      composeDomainResourceElements(element);
42806      if (element.hasUrlElement()) {
42807        composeUriCore("url", element.getUrlElement(), false);
42808        composeUriExtras("url", element.getUrlElement(), false);
42809      }
42810      if (element.hasIdentifier()) {
42811        openArray("identifier");
42812        for (Identifier e : element.getIdentifier()) 
42813          composeIdentifier(null, e);
42814        closeArray();
42815      };
42816      if (element.hasVersionElement()) {
42817        composeStringCore("version", element.getVersionElement(), false);
42818        composeStringExtras("version", element.getVersionElement(), false);
42819      }
42820      if (element.hasNameElement()) {
42821        composeStringCore("name", element.getNameElement(), false);
42822        composeStringExtras("name", element.getNameElement(), false);
42823      }
42824      if (element.hasTitleElement()) {
42825        composeStringCore("title", element.getTitleElement(), false);
42826        composeStringExtras("title", element.getTitleElement(), false);
42827      }
42828      if (element.hasSubtitleElement()) {
42829        composeStringCore("subtitle", element.getSubtitleElement(), false);
42830        composeStringExtras("subtitle", element.getSubtitleElement(), false);
42831      }
42832      if (element.hasStatusElement()) {
42833        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42834        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
42835      }
42836      if (element.hasExperimentalElement()) {
42837        composeBooleanCore("experimental", element.getExperimentalElement(), false);
42838        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
42839      }
42840      if (element.hasSubject()) {
42841        composeType("subject", element.getSubject());
42842      }
42843      if (element.hasDateElement()) {
42844        composeDateTimeCore("date", element.getDateElement(), false);
42845        composeDateTimeExtras("date", element.getDateElement(), false);
42846      }
42847      if (element.hasPublisherElement()) {
42848        composeStringCore("publisher", element.getPublisherElement(), false);
42849        composeStringExtras("publisher", element.getPublisherElement(), false);
42850      }
42851      if (element.hasContact()) {
42852        openArray("contact");
42853        for (ContactDetail e : element.getContact()) 
42854          composeContactDetail(null, e);
42855        closeArray();
42856      };
42857      if (element.hasDescriptionElement()) {
42858        composeMarkdownCore("description", element.getDescriptionElement(), false);
42859        composeMarkdownExtras("description", element.getDescriptionElement(), false);
42860      }
42861      if (element.hasUseContext()) {
42862        openArray("useContext");
42863        for (UsageContext e : element.getUseContext()) 
42864          composeUsageContext(null, e);
42865        closeArray();
42866      };
42867      if (element.hasJurisdiction()) {
42868        openArray("jurisdiction");
42869        for (CodeableConcept e : element.getJurisdiction()) 
42870          composeCodeableConcept(null, e);
42871        closeArray();
42872      };
42873      if (element.hasPurposeElement()) {
42874        composeMarkdownCore("purpose", element.getPurposeElement(), false);
42875        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
42876      }
42877      if (element.hasUsageElement()) {
42878        composeStringCore("usage", element.getUsageElement(), false);
42879        composeStringExtras("usage", element.getUsageElement(), false);
42880      }
42881      if (element.hasCopyrightElement()) {
42882        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
42883        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
42884      }
42885      if (element.hasApprovalDateElement()) {
42886        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
42887        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
42888      }
42889      if (element.hasLastReviewDateElement()) {
42890        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
42891        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
42892      }
42893      if (element.hasEffectivePeriod()) {
42894        composePeriod("effectivePeriod", element.getEffectivePeriod());
42895      }
42896      if (element.hasTopic()) {
42897        openArray("topic");
42898        for (CodeableConcept e : element.getTopic()) 
42899          composeCodeableConcept(null, e);
42900        closeArray();
42901      };
42902      if (element.hasAuthor()) {
42903        openArray("author");
42904        for (ContactDetail e : element.getAuthor()) 
42905          composeContactDetail(null, e);
42906        closeArray();
42907      };
42908      if (element.hasEditor()) {
42909        openArray("editor");
42910        for (ContactDetail e : element.getEditor()) 
42911          composeContactDetail(null, e);
42912        closeArray();
42913      };
42914      if (element.hasReviewer()) {
42915        openArray("reviewer");
42916        for (ContactDetail e : element.getReviewer()) 
42917          composeContactDetail(null, e);
42918        closeArray();
42919      };
42920      if (element.hasEndorser()) {
42921        openArray("endorser");
42922        for (ContactDetail e : element.getEndorser()) 
42923          composeContactDetail(null, e);
42924        closeArray();
42925      };
42926      if (element.hasRelatedArtifact()) {
42927        openArray("relatedArtifact");
42928        for (RelatedArtifact e : element.getRelatedArtifact()) 
42929          composeRelatedArtifact(null, e);
42930        closeArray();
42931      };
42932      if (element.hasLibrary()) {
42933        openArray("library");
42934        for (CanonicalType e : element.getLibrary()) 
42935          composeCanonicalCore(null, e, true);
42936        closeArray();
42937        if (anyHasExtras(element.getLibrary())) {
42938          openArray("_library");
42939          for (CanonicalType e : element.getLibrary()) 
42940            composeCanonicalExtras(null, e, true);
42941          closeArray();
42942        }
42943      };
42944      if (element.hasDisclaimerElement()) {
42945        composeMarkdownCore("disclaimer", element.getDisclaimerElement(), false);
42946        composeMarkdownExtras("disclaimer", element.getDisclaimerElement(), false);
42947      }
42948      if (element.hasScoring()) {
42949        composeCodeableConcept("scoring", element.getScoring());
42950      }
42951      if (element.hasCompositeScoring()) {
42952        composeCodeableConcept("compositeScoring", element.getCompositeScoring());
42953      }
42954      if (element.hasType()) {
42955        openArray("type");
42956        for (CodeableConcept e : element.getType()) 
42957          composeCodeableConcept(null, e);
42958        closeArray();
42959      };
42960      if (element.hasRiskAdjustmentElement()) {
42961        composeStringCore("riskAdjustment", element.getRiskAdjustmentElement(), false);
42962        composeStringExtras("riskAdjustment", element.getRiskAdjustmentElement(), false);
42963      }
42964      if (element.hasRateAggregationElement()) {
42965        composeStringCore("rateAggregation", element.getRateAggregationElement(), false);
42966        composeStringExtras("rateAggregation", element.getRateAggregationElement(), false);
42967      }
42968      if (element.hasRationaleElement()) {
42969        composeMarkdownCore("rationale", element.getRationaleElement(), false);
42970        composeMarkdownExtras("rationale", element.getRationaleElement(), false);
42971      }
42972      if (element.hasClinicalRecommendationStatementElement()) {
42973        composeMarkdownCore("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
42974        composeMarkdownExtras("clinicalRecommendationStatement", element.getClinicalRecommendationStatementElement(), false);
42975      }
42976      if (element.hasImprovementNotationElement()) {
42977        composeEnumerationCore("improvementNotation", element.getImprovementNotationElement(), new Measure.MeasureImprovementNotationEnumFactory(), false);
42978        composeEnumerationExtras("improvementNotation", element.getImprovementNotationElement(), new Measure.MeasureImprovementNotationEnumFactory(), false);
42979      }
42980      if (element.hasDefinition()) {
42981        openArray("definition");
42982        for (MarkdownType e : element.getDefinition()) 
42983          composeMarkdownCore(null, e, true);
42984        closeArray();
42985        if (anyHasExtras(element.getDefinition())) {
42986          openArray("_definition");
42987          for (MarkdownType e : element.getDefinition()) 
42988            composeMarkdownExtras(null, e, true);
42989          closeArray();
42990        }
42991      };
42992      if (element.hasGuidanceElement()) {
42993        composeMarkdownCore("guidance", element.getGuidanceElement(), false);
42994        composeMarkdownExtras("guidance", element.getGuidanceElement(), false);
42995      }
42996      if (element.hasGroup()) {
42997        openArray("group");
42998        for (Measure.MeasureGroupComponent e : element.getGroup()) 
42999          composeMeasureMeasureGroupComponent(null, e);
43000        closeArray();
43001      };
43002      if (element.hasSupplementalData()) {
43003        openArray("supplementalData");
43004        for (Measure.MeasureSupplementalDataComponent e : element.getSupplementalData()) 
43005          composeMeasureMeasureSupplementalDataComponent(null, e);
43006        closeArray();
43007      };
43008  }
43009
43010  protected void composeMeasureMeasureGroupComponent(String name, Measure.MeasureGroupComponent element) throws IOException {
43011    if (element != null) {
43012      open(name);
43013      composeMeasureMeasureGroupComponentInner(element);
43014      close();
43015    }
43016  }
43017
43018  protected void composeMeasureMeasureGroupComponentInner(Measure.MeasureGroupComponent element) throws IOException {
43019      composeBackbone(element);
43020      if (element.hasCode()) {
43021        composeCodeableConcept("code", element.getCode());
43022      }
43023      if (element.hasDescriptionElement()) {
43024        composeStringCore("description", element.getDescriptionElement(), false);
43025        composeStringExtras("description", element.getDescriptionElement(), false);
43026      }
43027      if (element.hasPopulation()) {
43028        openArray("population");
43029        for (Measure.MeasureGroupPopulationComponent e : element.getPopulation()) 
43030          composeMeasureMeasureGroupPopulationComponent(null, e);
43031        closeArray();
43032      };
43033      if (element.hasStratifier()) {
43034        openArray("stratifier");
43035        for (Measure.MeasureGroupStratifierComponent e : element.getStratifier()) 
43036          composeMeasureMeasureGroupStratifierComponent(null, e);
43037        closeArray();
43038      };
43039  }
43040
43041  protected void composeMeasureMeasureGroupPopulationComponent(String name, Measure.MeasureGroupPopulationComponent element) throws IOException {
43042    if (element != null) {
43043      open(name);
43044      composeMeasureMeasureGroupPopulationComponentInner(element);
43045      close();
43046    }
43047  }
43048
43049  protected void composeMeasureMeasureGroupPopulationComponentInner(Measure.MeasureGroupPopulationComponent element) throws IOException {
43050      composeBackbone(element);
43051      if (element.hasCode()) {
43052        composeCodeableConcept("code", element.getCode());
43053      }
43054      if (element.hasDescriptionElement()) {
43055        composeStringCore("description", element.getDescriptionElement(), false);
43056        composeStringExtras("description", element.getDescriptionElement(), false);
43057      }
43058      if (element.hasCriteria()) {
43059        composeExpression("criteria", element.getCriteria());
43060      }
43061  }
43062
43063  protected void composeMeasureMeasureGroupStratifierComponent(String name, Measure.MeasureGroupStratifierComponent element) throws IOException {
43064    if (element != null) {
43065      open(name);
43066      composeMeasureMeasureGroupStratifierComponentInner(element);
43067      close();
43068    }
43069  }
43070
43071  protected void composeMeasureMeasureGroupStratifierComponentInner(Measure.MeasureGroupStratifierComponent element) throws IOException {
43072      composeBackbone(element);
43073      if (element.hasCode()) {
43074        composeCodeableConcept("code", element.getCode());
43075      }
43076      if (element.hasDescriptionElement()) {
43077        composeStringCore("description", element.getDescriptionElement(), false);
43078        composeStringExtras("description", element.getDescriptionElement(), false);
43079      }
43080      if (element.hasCriteria()) {
43081        composeExpression("criteria", element.getCriteria());
43082      }
43083  }
43084
43085  protected void composeMeasureMeasureSupplementalDataComponent(String name, Measure.MeasureSupplementalDataComponent element) throws IOException {
43086    if (element != null) {
43087      open(name);
43088      composeMeasureMeasureSupplementalDataComponentInner(element);
43089      close();
43090    }
43091  }
43092
43093  protected void composeMeasureMeasureSupplementalDataComponentInner(Measure.MeasureSupplementalDataComponent element) throws IOException {
43094      composeBackbone(element);
43095      if (element.hasCode()) {
43096        composeCodeableConcept("code", element.getCode());
43097      }
43098      if (element.hasUsage()) {
43099        openArray("usage");
43100        for (CodeableConcept e : element.getUsage()) 
43101          composeCodeableConcept(null, e);
43102        closeArray();
43103      };
43104      if (element.hasDescriptionElement()) {
43105        composeStringCore("description", element.getDescriptionElement(), false);
43106        composeStringExtras("description", element.getDescriptionElement(), false);
43107      }
43108      if (element.hasCriteria()) {
43109        composeExpression("criteria", element.getCriteria());
43110      }
43111  }
43112
43113  protected void composeMeasureReport(String name, MeasureReport element) throws IOException {
43114    if (element != null) {
43115      prop("resourceType", name);
43116      composeMeasureReportInner(element);
43117    }
43118  }
43119
43120  protected void composeMeasureReportInner(MeasureReport element) throws IOException {
43121      composeDomainResourceElements(element);
43122      if (element.hasIdentifier()) {
43123        openArray("identifier");
43124        for (Identifier e : element.getIdentifier()) 
43125          composeIdentifier(null, e);
43126        closeArray();
43127      };
43128      if (element.hasStatusElement()) {
43129        composeEnumerationCore("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
43130        composeEnumerationExtras("status", element.getStatusElement(), new MeasureReport.MeasureReportStatusEnumFactory(), false);
43131      }
43132      if (element.hasTypeElement()) {
43133        composeEnumerationCore("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
43134        composeEnumerationExtras("type", element.getTypeElement(), new MeasureReport.MeasureReportTypeEnumFactory(), false);
43135      }
43136      if (element.hasMeasureElement()) {
43137        composeCanonicalCore("measure", element.getMeasureElement(), false);
43138        composeCanonicalExtras("measure", element.getMeasureElement(), false);
43139      }
43140      if (element.hasSubject()) {
43141        composeReference("subject", element.getSubject());
43142      }
43143      if (element.hasDateElement()) {
43144        composeDateTimeCore("date", element.getDateElement(), false);
43145        composeDateTimeExtras("date", element.getDateElement(), false);
43146      }
43147      if (element.hasReporter()) {
43148        composeReference("reporter", element.getReporter());
43149      }
43150      if (element.hasPeriod()) {
43151        composePeriod("period", element.getPeriod());
43152      }
43153      if (element.hasImprovementNotationElement()) {
43154        composeEnumerationCore("improvementNotation", element.getImprovementNotationElement(), new MeasureReport.MeasureImprovementNotationEnumFactory(), false);
43155        composeEnumerationExtras("improvementNotation", element.getImprovementNotationElement(), new MeasureReport.MeasureImprovementNotationEnumFactory(), false);
43156      }
43157      if (element.hasGroup()) {
43158        openArray("group");
43159        for (MeasureReport.MeasureReportGroupComponent e : element.getGroup()) 
43160          composeMeasureReportMeasureReportGroupComponent(null, e);
43161        closeArray();
43162      };
43163      if (element.hasEvaluatedResource()) {
43164        openArray("evaluatedResource");
43165        for (Reference e : element.getEvaluatedResource()) 
43166          composeReference(null, e);
43167        closeArray();
43168      };
43169  }
43170
43171  protected void composeMeasureReportMeasureReportGroupComponent(String name, MeasureReport.MeasureReportGroupComponent element) throws IOException {
43172    if (element != null) {
43173      open(name);
43174      composeMeasureReportMeasureReportGroupComponentInner(element);
43175      close();
43176    }
43177  }
43178
43179  protected void composeMeasureReportMeasureReportGroupComponentInner(MeasureReport.MeasureReportGroupComponent element) throws IOException {
43180      composeBackbone(element);
43181      if (element.hasCode()) {
43182        composeCodeableConcept("code", element.getCode());
43183      }
43184      if (element.hasPopulation()) {
43185        openArray("population");
43186        for (MeasureReport.MeasureReportGroupPopulationComponent e : element.getPopulation()) 
43187          composeMeasureReportMeasureReportGroupPopulationComponent(null, e);
43188        closeArray();
43189      };
43190      if (element.hasMeasureScore()) {
43191        composeQuantity("measureScore", element.getMeasureScore());
43192      }
43193      if (element.hasStratifier()) {
43194        openArray("stratifier");
43195        for (MeasureReport.MeasureReportGroupStratifierComponent e : element.getStratifier()) 
43196          composeMeasureReportMeasureReportGroupStratifierComponent(null, e);
43197        closeArray();
43198      };
43199  }
43200
43201  protected void composeMeasureReportMeasureReportGroupPopulationComponent(String name, MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
43202    if (element != null) {
43203      open(name);
43204      composeMeasureReportMeasureReportGroupPopulationComponentInner(element);
43205      close();
43206    }
43207  }
43208
43209  protected void composeMeasureReportMeasureReportGroupPopulationComponentInner(MeasureReport.MeasureReportGroupPopulationComponent element) throws IOException {
43210      composeBackbone(element);
43211      if (element.hasCode()) {
43212        composeCodeableConcept("code", element.getCode());
43213      }
43214      if (element.hasCountElement()) {
43215        composeIntegerCore("count", element.getCountElement(), false);
43216        composeIntegerExtras("count", element.getCountElement(), false);
43217      }
43218      if (element.hasSubjectResults()) {
43219        composeReference("subjectResults", element.getSubjectResults());
43220      }
43221  }
43222
43223  protected void composeMeasureReportMeasureReportGroupStratifierComponent(String name, MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
43224    if (element != null) {
43225      open(name);
43226      composeMeasureReportMeasureReportGroupStratifierComponentInner(element);
43227      close();
43228    }
43229  }
43230
43231  protected void composeMeasureReportMeasureReportGroupStratifierComponentInner(MeasureReport.MeasureReportGroupStratifierComponent element) throws IOException {
43232      composeBackbone(element);
43233      if (element.hasCode()) {
43234        composeCodeableConcept("code", element.getCode());
43235      }
43236      if (element.hasStratum()) {
43237        openArray("stratum");
43238        for (MeasureReport.StratifierGroupComponent e : element.getStratum()) 
43239          composeMeasureReportStratifierGroupComponent(null, e);
43240        closeArray();
43241      };
43242  }
43243
43244  protected void composeMeasureReportStratifierGroupComponent(String name, MeasureReport.StratifierGroupComponent element) throws IOException {
43245    if (element != null) {
43246      open(name);
43247      composeMeasureReportStratifierGroupComponentInner(element);
43248      close();
43249    }
43250  }
43251
43252  protected void composeMeasureReportStratifierGroupComponentInner(MeasureReport.StratifierGroupComponent element) throws IOException {
43253      composeBackbone(element);
43254      if (element.hasValue()) {
43255        composeCodeableConcept("value", element.getValue());
43256      }
43257      if (element.hasPopulation()) {
43258        openArray("population");
43259        for (MeasureReport.StratifierGroupPopulationComponent e : element.getPopulation()) 
43260          composeMeasureReportStratifierGroupPopulationComponent(null, e);
43261        closeArray();
43262      };
43263      if (element.hasMeasureScore()) {
43264        composeQuantity("measureScore", element.getMeasureScore());
43265      }
43266  }
43267
43268  protected void composeMeasureReportStratifierGroupPopulationComponent(String name, MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
43269    if (element != null) {
43270      open(name);
43271      composeMeasureReportStratifierGroupPopulationComponentInner(element);
43272      close();
43273    }
43274  }
43275
43276  protected void composeMeasureReportStratifierGroupPopulationComponentInner(MeasureReport.StratifierGroupPopulationComponent element) throws IOException {
43277      composeBackbone(element);
43278      if (element.hasCode()) {
43279        composeCodeableConcept("code", element.getCode());
43280      }
43281      if (element.hasCountElement()) {
43282        composeIntegerCore("count", element.getCountElement(), false);
43283        composeIntegerExtras("count", element.getCountElement(), false);
43284      }
43285      if (element.hasSubjectResults()) {
43286        composeReference("subjectResults", element.getSubjectResults());
43287      }
43288  }
43289
43290  protected void composeMedia(String name, Media element) throws IOException {
43291    if (element != null) {
43292      prop("resourceType", name);
43293      composeMediaInner(element);
43294    }
43295  }
43296
43297  protected void composeMediaInner(Media element) throws IOException {
43298      composeDomainResourceElements(element);
43299      if (element.hasIdentifier()) {
43300        openArray("identifier");
43301        for (Identifier e : element.getIdentifier()) 
43302          composeIdentifier(null, e);
43303        closeArray();
43304      };
43305      if (element.hasBasedOn()) {
43306        openArray("basedOn");
43307        for (Reference e : element.getBasedOn()) 
43308          composeReference(null, e);
43309        closeArray();
43310      };
43311      if (element.hasPartOf()) {
43312        openArray("partOf");
43313        for (Reference e : element.getPartOf()) 
43314          composeReference(null, e);
43315        closeArray();
43316      };
43317      if (element.hasStatusElement()) {
43318        composeEnumerationCore("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
43319        composeEnumerationExtras("status", element.getStatusElement(), new Media.MediaStatusEnumFactory(), false);
43320      }
43321      if (element.hasType()) {
43322        composeCodeableConcept("type", element.getType());
43323      }
43324      if (element.hasModality()) {
43325        composeCodeableConcept("modality", element.getModality());
43326      }
43327      if (element.hasView()) {
43328        composeCodeableConcept("view", element.getView());
43329      }
43330      if (element.hasSubject()) {
43331        composeReference("subject", element.getSubject());
43332      }
43333      if (element.hasContext()) {
43334        composeReference("context", element.getContext());
43335      }
43336      if (element.hasCreated()) {
43337        composeType("created", element.getCreated());
43338      }
43339      if (element.hasIssuedElement()) {
43340        composeInstantCore("issued", element.getIssuedElement(), false);
43341        composeInstantExtras("issued", element.getIssuedElement(), false);
43342      }
43343      if (element.hasOperator()) {
43344        composeReference("operator", element.getOperator());
43345      }
43346      if (element.hasReasonCode()) {
43347        openArray("reasonCode");
43348        for (CodeableConcept e : element.getReasonCode()) 
43349          composeCodeableConcept(null, e);
43350        closeArray();
43351      };
43352      if (element.hasBodySite()) {
43353        composeCodeableConcept("bodySite", element.getBodySite());
43354      }
43355      if (element.hasDeviceNameElement()) {
43356        composeStringCore("deviceName", element.getDeviceNameElement(), false);
43357        composeStringExtras("deviceName", element.getDeviceNameElement(), false);
43358      }
43359      if (element.hasDevice()) {
43360        composeReference("device", element.getDevice());
43361      }
43362      if (element.hasHeightElement()) {
43363        composePositiveIntCore("height", element.getHeightElement(), false);
43364        composePositiveIntExtras("height", element.getHeightElement(), false);
43365      }
43366      if (element.hasWidthElement()) {
43367        composePositiveIntCore("width", element.getWidthElement(), false);
43368        composePositiveIntExtras("width", element.getWidthElement(), false);
43369      }
43370      if (element.hasFramesElement()) {
43371        composePositiveIntCore("frames", element.getFramesElement(), false);
43372        composePositiveIntExtras("frames", element.getFramesElement(), false);
43373      }
43374      if (element.hasDurationElement()) {
43375        composeDecimalCore("duration", element.getDurationElement(), false);
43376        composeDecimalExtras("duration", element.getDurationElement(), false);
43377      }
43378      if (element.hasContent()) {
43379        composeAttachment("content", element.getContent());
43380      }
43381      if (element.hasNote()) {
43382        openArray("note");
43383        for (Annotation e : element.getNote()) 
43384          composeAnnotation(null, e);
43385        closeArray();
43386      };
43387  }
43388
43389  protected void composeMedication(String name, Medication element) throws IOException {
43390    if (element != null) {
43391      prop("resourceType", name);
43392      composeMedicationInner(element);
43393    }
43394  }
43395
43396  protected void composeMedicationInner(Medication element) throws IOException {
43397      composeDomainResourceElements(element);
43398      if (element.hasCode()) {
43399        composeCodeableConcept("code", element.getCode());
43400      }
43401      if (element.hasStatusElement()) {
43402        composeEnumerationCore("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
43403        composeEnumerationExtras("status", element.getStatusElement(), new Medication.MedicationStatusEnumFactory(), false);
43404      }
43405      if (element.hasManufacturer()) {
43406        composeReference("manufacturer", element.getManufacturer());
43407      }
43408      if (element.hasForm()) {
43409        composeCodeableConcept("form", element.getForm());
43410      }
43411      if (element.hasAmount()) {
43412        composeQuantity("amount", element.getAmount());
43413      }
43414      if (element.hasIngredient()) {
43415        openArray("ingredient");
43416        for (Medication.MedicationIngredientComponent e : element.getIngredient()) 
43417          composeMedicationMedicationIngredientComponent(null, e);
43418        closeArray();
43419      };
43420      if (element.hasBatch()) {
43421        composeMedicationMedicationBatchComponent("batch", element.getBatch());
43422      }
43423  }
43424
43425  protected void composeMedicationMedicationIngredientComponent(String name, Medication.MedicationIngredientComponent element) throws IOException {
43426    if (element != null) {
43427      open(name);
43428      composeMedicationMedicationIngredientComponentInner(element);
43429      close();
43430    }
43431  }
43432
43433  protected void composeMedicationMedicationIngredientComponentInner(Medication.MedicationIngredientComponent element) throws IOException {
43434      composeBackbone(element);
43435      if (element.hasItem()) {
43436        composeType("item", element.getItem());
43437      }
43438      if (element.hasIsActiveElement()) {
43439        composeBooleanCore("isActive", element.getIsActiveElement(), false);
43440        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
43441      }
43442      if (element.hasAmount()) {
43443        composeRatio("amount", element.getAmount());
43444      }
43445  }
43446
43447  protected void composeMedicationMedicationBatchComponent(String name, Medication.MedicationBatchComponent element) throws IOException {
43448    if (element != null) {
43449      open(name);
43450      composeMedicationMedicationBatchComponentInner(element);
43451      close();
43452    }
43453  }
43454
43455  protected void composeMedicationMedicationBatchComponentInner(Medication.MedicationBatchComponent element) throws IOException {
43456      composeBackbone(element);
43457      if (element.hasLotNumberElement()) {
43458        composeStringCore("lotNumber", element.getLotNumberElement(), false);
43459        composeStringExtras("lotNumber", element.getLotNumberElement(), false);
43460      }
43461      if (element.hasExpirationDateElement()) {
43462        composeDateTimeCore("expirationDate", element.getExpirationDateElement(), false);
43463        composeDateTimeExtras("expirationDate", element.getExpirationDateElement(), false);
43464      }
43465      if (element.hasSerialNumberElement()) {
43466        composeStringCore("serialNumber", element.getSerialNumberElement(), false);
43467        composeStringExtras("serialNumber", element.getSerialNumberElement(), false);
43468      }
43469  }
43470
43471  protected void composeMedicationAdministration(String name, MedicationAdministration element) throws IOException {
43472    if (element != null) {
43473      prop("resourceType", name);
43474      composeMedicationAdministrationInner(element);
43475    }
43476  }
43477
43478  protected void composeMedicationAdministrationInner(MedicationAdministration element) throws IOException {
43479      composeDomainResourceElements(element);
43480      if (element.hasIdentifier()) {
43481        openArray("identifier");
43482        for (Identifier e : element.getIdentifier()) 
43483          composeIdentifier(null, e);
43484        closeArray();
43485      };
43486      if (element.hasInstantiates()) {
43487        openArray("instantiates");
43488        for (UriType e : element.getInstantiates()) 
43489          composeUriCore(null, e, true);
43490        closeArray();
43491        if (anyHasExtras(element.getInstantiates())) {
43492          openArray("_instantiates");
43493          for (UriType e : element.getInstantiates()) 
43494            composeUriExtras(null, e, true);
43495          closeArray();
43496        }
43497      };
43498      if (element.hasPartOf()) {
43499        openArray("partOf");
43500        for (Reference e : element.getPartOf()) 
43501          composeReference(null, e);
43502        closeArray();
43503      };
43504      if (element.hasStatusElement()) {
43505        composeEnumerationCore("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
43506        composeEnumerationExtras("status", element.getStatusElement(), new MedicationAdministration.MedicationAdministrationStatusEnumFactory(), false);
43507      }
43508      if (element.hasCategory()) {
43509        composeCodeableConcept("category", element.getCategory());
43510      }
43511      if (element.hasMedication()) {
43512        composeType("medication", element.getMedication());
43513      }
43514      if (element.hasSubject()) {
43515        composeReference("subject", element.getSubject());
43516      }
43517      if (element.hasContext()) {
43518        composeReference("context", element.getContext());
43519      }
43520      if (element.hasSupportingInformation()) {
43521        openArray("supportingInformation");
43522        for (Reference e : element.getSupportingInformation()) 
43523          composeReference(null, e);
43524        closeArray();
43525      };
43526      if (element.hasEffective()) {
43527        composeType("effective", element.getEffective());
43528      }
43529      if (element.hasPerformer()) {
43530        openArray("performer");
43531        for (MedicationAdministration.MedicationAdministrationPerformerComponent e : element.getPerformer()) 
43532          composeMedicationAdministrationMedicationAdministrationPerformerComponent(null, e);
43533        closeArray();
43534      };
43535      if (element.hasStatusReason()) {
43536        openArray("statusReason");
43537        for (CodeableConcept e : element.getStatusReason()) 
43538          composeCodeableConcept(null, e);
43539        closeArray();
43540      };
43541      if (element.hasReasonCode()) {
43542        openArray("reasonCode");
43543        for (CodeableConcept e : element.getReasonCode()) 
43544          composeCodeableConcept(null, e);
43545        closeArray();
43546      };
43547      if (element.hasReasonReference()) {
43548        openArray("reasonReference");
43549        for (Reference e : element.getReasonReference()) 
43550          composeReference(null, e);
43551        closeArray();
43552      };
43553      if (element.hasRequest()) {
43554        composeReference("request", element.getRequest());
43555      }
43556      if (element.hasDevice()) {
43557        openArray("device");
43558        for (Reference e : element.getDevice()) 
43559          composeReference(null, e);
43560        closeArray();
43561      };
43562      if (element.hasNote()) {
43563        openArray("note");
43564        for (Annotation e : element.getNote()) 
43565          composeAnnotation(null, e);
43566        closeArray();
43567      };
43568      if (element.hasDosage()) {
43569        composeMedicationAdministrationMedicationAdministrationDosageComponent("dosage", element.getDosage());
43570      }
43571      if (element.hasEventHistory()) {
43572        openArray("eventHistory");
43573        for (Reference e : element.getEventHistory()) 
43574          composeReference(null, e);
43575        closeArray();
43576      };
43577  }
43578
43579  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponent(String name, MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
43580    if (element != null) {
43581      open(name);
43582      composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(element);
43583      close();
43584    }
43585  }
43586
43587  protected void composeMedicationAdministrationMedicationAdministrationPerformerComponentInner(MedicationAdministration.MedicationAdministrationPerformerComponent element) throws IOException {
43588      composeBackbone(element);
43589      if (element.hasFunction()) {
43590        composeCodeableConcept("function", element.getFunction());
43591      }
43592      if (element.hasActor()) {
43593        composeReference("actor", element.getActor());
43594      }
43595  }
43596
43597  protected void composeMedicationAdministrationMedicationAdministrationDosageComponent(String name, MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
43598    if (element != null) {
43599      open(name);
43600      composeMedicationAdministrationMedicationAdministrationDosageComponentInner(element);
43601      close();
43602    }
43603  }
43604
43605  protected void composeMedicationAdministrationMedicationAdministrationDosageComponentInner(MedicationAdministration.MedicationAdministrationDosageComponent element) throws IOException {
43606      composeBackbone(element);
43607      if (element.hasTextElement()) {
43608        composeStringCore("text", element.getTextElement(), false);
43609        composeStringExtras("text", element.getTextElement(), false);
43610      }
43611      if (element.hasSite()) {
43612        composeCodeableConcept("site", element.getSite());
43613      }
43614      if (element.hasRoute()) {
43615        composeCodeableConcept("route", element.getRoute());
43616      }
43617      if (element.hasMethod()) {
43618        composeCodeableConcept("method", element.getMethod());
43619      }
43620      if (element.hasDose()) {
43621        composeQuantity("dose", element.getDose());
43622      }
43623      if (element.hasRate()) {
43624        composeType("rate", element.getRate());
43625      }
43626  }
43627
43628  protected void composeMedicationDispense(String name, MedicationDispense element) throws IOException {
43629    if (element != null) {
43630      prop("resourceType", name);
43631      composeMedicationDispenseInner(element);
43632    }
43633  }
43634
43635  protected void composeMedicationDispenseInner(MedicationDispense element) throws IOException {
43636      composeDomainResourceElements(element);
43637      if (element.hasIdentifier()) {
43638        openArray("identifier");
43639        for (Identifier e : element.getIdentifier()) 
43640          composeIdentifier(null, e);
43641        closeArray();
43642      };
43643      if (element.hasPartOf()) {
43644        openArray("partOf");
43645        for (Reference e : element.getPartOf()) 
43646          composeReference(null, e);
43647        closeArray();
43648      };
43649      if (element.hasStatusElement()) {
43650        composeEnumerationCore("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
43651        composeEnumerationExtras("status", element.getStatusElement(), new MedicationDispense.MedicationDispenseStatusEnumFactory(), false);
43652      }
43653      if (element.hasCategory()) {
43654        composeCodeableConcept("category", element.getCategory());
43655      }
43656      if (element.hasMedication()) {
43657        composeType("medication", element.getMedication());
43658      }
43659      if (element.hasSubject()) {
43660        composeReference("subject", element.getSubject());
43661      }
43662      if (element.hasContext()) {
43663        composeReference("context", element.getContext());
43664      }
43665      if (element.hasSupportingInformation()) {
43666        openArray("supportingInformation");
43667        for (Reference e : element.getSupportingInformation()) 
43668          composeReference(null, e);
43669        closeArray();
43670      };
43671      if (element.hasPerformer()) {
43672        openArray("performer");
43673        for (MedicationDispense.MedicationDispensePerformerComponent e : element.getPerformer()) 
43674          composeMedicationDispenseMedicationDispensePerformerComponent(null, e);
43675        closeArray();
43676      };
43677      if (element.hasLocation()) {
43678        composeReference("location", element.getLocation());
43679      }
43680      if (element.hasAuthorizingPrescription()) {
43681        openArray("authorizingPrescription");
43682        for (Reference e : element.getAuthorizingPrescription()) 
43683          composeReference(null, e);
43684        closeArray();
43685      };
43686      if (element.hasType()) {
43687        composeCodeableConcept("type", element.getType());
43688      }
43689      if (element.hasQuantity()) {
43690        composeQuantity("quantity", element.getQuantity());
43691      }
43692      if (element.hasDaysSupply()) {
43693        composeQuantity("daysSupply", element.getDaysSupply());
43694      }
43695      if (element.hasWhenPreparedElement()) {
43696        composeDateTimeCore("whenPrepared", element.getWhenPreparedElement(), false);
43697        composeDateTimeExtras("whenPrepared", element.getWhenPreparedElement(), false);
43698      }
43699      if (element.hasWhenHandedOverElement()) {
43700        composeDateTimeCore("whenHandedOver", element.getWhenHandedOverElement(), false);
43701        composeDateTimeExtras("whenHandedOver", element.getWhenHandedOverElement(), false);
43702      }
43703      if (element.hasDestination()) {
43704        composeReference("destination", element.getDestination());
43705      }
43706      if (element.hasReceiver()) {
43707        openArray("receiver");
43708        for (Reference e : element.getReceiver()) 
43709          composeReference(null, e);
43710        closeArray();
43711      };
43712      if (element.hasNote()) {
43713        openArray("note");
43714        for (Annotation e : element.getNote()) 
43715          composeAnnotation(null, e);
43716        closeArray();
43717      };
43718      if (element.hasDosageInstruction()) {
43719        openArray("dosageInstruction");
43720        for (Dosage e : element.getDosageInstruction()) 
43721          composeDosage(null, e);
43722        closeArray();
43723      };
43724      if (element.hasSubstitution()) {
43725        composeMedicationDispenseMedicationDispenseSubstitutionComponent("substitution", element.getSubstitution());
43726      }
43727      if (element.hasDetectedIssue()) {
43728        openArray("detectedIssue");
43729        for (Reference e : element.getDetectedIssue()) 
43730          composeReference(null, e);
43731        closeArray();
43732      };
43733      if (element.hasStatusReason()) {
43734        composeType("statusReason", element.getStatusReason());
43735      }
43736      if (element.hasEventHistory()) {
43737        openArray("eventHistory");
43738        for (Reference e : element.getEventHistory()) 
43739          composeReference(null, e);
43740        closeArray();
43741      };
43742  }
43743
43744  protected void composeMedicationDispenseMedicationDispensePerformerComponent(String name, MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
43745    if (element != null) {
43746      open(name);
43747      composeMedicationDispenseMedicationDispensePerformerComponentInner(element);
43748      close();
43749    }
43750  }
43751
43752  protected void composeMedicationDispenseMedicationDispensePerformerComponentInner(MedicationDispense.MedicationDispensePerformerComponent element) throws IOException {
43753      composeBackbone(element);
43754      if (element.hasFunction()) {
43755        composeCodeableConcept("function", element.getFunction());
43756      }
43757      if (element.hasActor()) {
43758        composeReference("actor", element.getActor());
43759      }
43760  }
43761
43762  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponent(String name, MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
43763    if (element != null) {
43764      open(name);
43765      composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(element);
43766      close();
43767    }
43768  }
43769
43770  protected void composeMedicationDispenseMedicationDispenseSubstitutionComponentInner(MedicationDispense.MedicationDispenseSubstitutionComponent element) throws IOException {
43771      composeBackbone(element);
43772      if (element.hasWasSubstitutedElement()) {
43773        composeBooleanCore("wasSubstituted", element.getWasSubstitutedElement(), false);
43774        composeBooleanExtras("wasSubstituted", element.getWasSubstitutedElement(), false);
43775      }
43776      if (element.hasType()) {
43777        composeCodeableConcept("type", element.getType());
43778      }
43779      if (element.hasReason()) {
43780        openArray("reason");
43781        for (CodeableConcept e : element.getReason()) 
43782          composeCodeableConcept(null, e);
43783        closeArray();
43784      };
43785      if (element.hasResponsibleParty()) {
43786        openArray("responsibleParty");
43787        for (Reference e : element.getResponsibleParty()) 
43788          composeReference(null, e);
43789        closeArray();
43790      };
43791  }
43792
43793  protected void composeMedicationKnowledge(String name, MedicationKnowledge element) throws IOException {
43794    if (element != null) {
43795      prop("resourceType", name);
43796      composeMedicationKnowledgeInner(element);
43797    }
43798  }
43799
43800  protected void composeMedicationKnowledgeInner(MedicationKnowledge element) throws IOException {
43801      composeDomainResourceElements(element);
43802      if (element.hasCode()) {
43803        composeCodeableConcept("code", element.getCode());
43804      }
43805      if (element.hasStatusElement()) {
43806        composeEnumerationCore("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
43807        composeEnumerationExtras("status", element.getStatusElement(), new MedicationKnowledge.MedicationKnowledgeStatusEnumFactory(), false);
43808      }
43809      if (element.hasManufacturer()) {
43810        composeReference("manufacturer", element.getManufacturer());
43811      }
43812      if (element.hasDoseForm()) {
43813        composeCodeableConcept("doseForm", element.getDoseForm());
43814      }
43815      if (element.hasAmount()) {
43816        composeQuantity("amount", element.getAmount());
43817      }
43818      if (element.hasSynonym()) {
43819        openArray("synonym");
43820        for (StringType e : element.getSynonym()) 
43821          composeStringCore(null, e, true);
43822        closeArray();
43823        if (anyHasExtras(element.getSynonym())) {
43824          openArray("_synonym");
43825          for (StringType e : element.getSynonym()) 
43826            composeStringExtras(null, e, true);
43827          closeArray();
43828        }
43829      };
43830      if (element.hasRelatedMedicationKnowledge()) {
43831        openArray("relatedMedicationKnowledge");
43832        for (MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent e : element.getRelatedMedicationKnowledge()) 
43833          composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(null, e);
43834        closeArray();
43835      };
43836      if (element.hasAssociatedMedication()) {
43837        openArray("associatedMedication");
43838        for (Reference e : element.getAssociatedMedication()) 
43839          composeReference(null, e);
43840        closeArray();
43841      };
43842      if (element.hasProductType()) {
43843        openArray("productType");
43844        for (CodeableConcept e : element.getProductType()) 
43845          composeCodeableConcept(null, e);
43846        closeArray();
43847      };
43848      if (element.hasMonograph()) {
43849        openArray("monograph");
43850        for (MedicationKnowledge.MedicationKnowledgeMonographComponent e : element.getMonograph()) 
43851          composeMedicationKnowledgeMedicationKnowledgeMonographComponent(null, e);
43852        closeArray();
43853      };
43854      if (element.hasIngredient()) {
43855        openArray("ingredient");
43856        for (MedicationKnowledge.MedicationKnowledgeIngredientComponent e : element.getIngredient()) 
43857          composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(null, e);
43858        closeArray();
43859      };
43860      if (element.hasPreparationInstructionElement()) {
43861        composeMarkdownCore("preparationInstruction", element.getPreparationInstructionElement(), false);
43862        composeMarkdownExtras("preparationInstruction", element.getPreparationInstructionElement(), false);
43863      }
43864      if (element.hasIntendedRoute()) {
43865        openArray("intendedRoute");
43866        for (CodeableConcept e : element.getIntendedRoute()) 
43867          composeCodeableConcept(null, e);
43868        closeArray();
43869      };
43870      if (element.hasCost()) {
43871        openArray("cost");
43872        for (MedicationKnowledge.MedicationKnowledgeCostComponent e : element.getCost()) 
43873          composeMedicationKnowledgeMedicationKnowledgeCostComponent(null, e);
43874        closeArray();
43875      };
43876      if (element.hasMonitoringProgram()) {
43877        openArray("monitoringProgram");
43878        for (MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent e : element.getMonitoringProgram()) 
43879          composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(null, e);
43880        closeArray();
43881      };
43882      if (element.hasAdministrationGuidelines()) {
43883        openArray("administrationGuidelines");
43884        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent e : element.getAdministrationGuidelines()) 
43885          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(null, e);
43886        closeArray();
43887      };
43888      if (element.hasMedicineClassification()) {
43889        openArray("medicineClassification");
43890        for (MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent e : element.getMedicineClassification()) 
43891          composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(null, e);
43892        closeArray();
43893      };
43894      if (element.hasPackaging()) {
43895        composeMedicationKnowledgeMedicationKnowledgePackagingComponent("packaging", element.getPackaging());
43896      }
43897      if (element.hasDrugCharacteristic()) {
43898        openArray("drugCharacteristic");
43899        for (MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent e : element.getDrugCharacteristic()) 
43900          composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(null, e);
43901        closeArray();
43902      };
43903      if (element.hasContraindication()) {
43904        openArray("contraindication");
43905        for (Reference e : element.getContraindication()) 
43906          composeReference(null, e);
43907        closeArray();
43908      };
43909      if (element.hasRegulatory()) {
43910        openArray("regulatory");
43911        for (MedicationKnowledge.MedicationKnowledgeRegulatoryComponent e : element.getRegulatory()) 
43912          composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(null, e);
43913        closeArray();
43914      };
43915      if (element.hasKinetics()) {
43916        openArray("kinetics");
43917        for (MedicationKnowledge.MedicationKnowledgeKineticsComponent e : element.getKinetics()) 
43918          composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(null, e);
43919        closeArray();
43920      };
43921  }
43922
43923  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponent(String name, MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
43924    if (element != null) {
43925      open(name);
43926      composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(element);
43927      close();
43928    }
43929  }
43930
43931  protected void composeMedicationKnowledgeMedicationKnowledgeRelatedMedicationKnowledgeComponentInner(MedicationKnowledge.MedicationKnowledgeRelatedMedicationKnowledgeComponent element) throws IOException {
43932      composeBackbone(element);
43933      if (element.hasType()) {
43934        composeCodeableConcept("type", element.getType());
43935      }
43936      if (element.hasReference()) {
43937        openArray("reference");
43938        for (Reference e : element.getReference()) 
43939          composeReference(null, e);
43940        closeArray();
43941      };
43942  }
43943
43944  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponent(String name, MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
43945    if (element != null) {
43946      open(name);
43947      composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(element);
43948      close();
43949    }
43950  }
43951
43952  protected void composeMedicationKnowledgeMedicationKnowledgeMonographComponentInner(MedicationKnowledge.MedicationKnowledgeMonographComponent element) throws IOException {
43953      composeBackbone(element);
43954      if (element.hasType()) {
43955        composeCodeableConcept("type", element.getType());
43956      }
43957      if (element.hasSource()) {
43958        composeReference("source", element.getSource());
43959      }
43960  }
43961
43962  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponent(String name, MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
43963    if (element != null) {
43964      open(name);
43965      composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(element);
43966      close();
43967    }
43968  }
43969
43970  protected void composeMedicationKnowledgeMedicationKnowledgeIngredientComponentInner(MedicationKnowledge.MedicationKnowledgeIngredientComponent element) throws IOException {
43971      composeBackbone(element);
43972      if (element.hasItem()) {
43973        composeType("item", element.getItem());
43974      }
43975      if (element.hasIsActiveElement()) {
43976        composeBooleanCore("isActive", element.getIsActiveElement(), false);
43977        composeBooleanExtras("isActive", element.getIsActiveElement(), false);
43978      }
43979      if (element.hasStrength()) {
43980        composeRatio("strength", element.getStrength());
43981      }
43982  }
43983
43984  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponent(String name, MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
43985    if (element != null) {
43986      open(name);
43987      composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(element);
43988      close();
43989    }
43990  }
43991
43992  protected void composeMedicationKnowledgeMedicationKnowledgeCostComponentInner(MedicationKnowledge.MedicationKnowledgeCostComponent element) throws IOException {
43993      composeBackbone(element);
43994      if (element.hasType()) {
43995        composeCodeableConcept("type", element.getType());
43996      }
43997      if (element.hasSourceElement()) {
43998        composeStringCore("source", element.getSourceElement(), false);
43999        composeStringExtras("source", element.getSourceElement(), false);
44000      }
44001      if (element.hasCost()) {
44002        composeMoney("cost", element.getCost());
44003      }
44004  }
44005
44006  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponent(String name, MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
44007    if (element != null) {
44008      open(name);
44009      composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(element);
44010      close();
44011    }
44012  }
44013
44014  protected void composeMedicationKnowledgeMedicationKnowledgeMonitoringProgramComponentInner(MedicationKnowledge.MedicationKnowledgeMonitoringProgramComponent element) throws IOException {
44015      composeBackbone(element);
44016      if (element.hasType()) {
44017        composeCodeableConcept("type", element.getType());
44018      }
44019      if (element.hasNameElement()) {
44020        composeStringCore("name", element.getNameElement(), false);
44021        composeStringExtras("name", element.getNameElement(), false);
44022      }
44023  }
44024
44025  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
44026    if (element != null) {
44027      open(name);
44028      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(element);
44029      close();
44030    }
44031  }
44032
44033  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesComponent element) throws IOException {
44034      composeBackbone(element);
44035      if (element.hasDosage()) {
44036        openArray("dosage");
44037        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent e : element.getDosage()) 
44038          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(null, e);
44039        closeArray();
44040      };
44041      if (element.hasIndication()) {
44042        composeType("indication", element.getIndication());
44043      }
44044      if (element.hasPatientCharacteristics()) {
44045        openArray("patientCharacteristics");
44046        for (MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent e : element.getPatientCharacteristics()) 
44047          composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(null, e);
44048        closeArray();
44049      };
44050  }
44051
44052  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
44053    if (element != null) {
44054      open(name);
44055      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(element);
44056      close();
44057    }
44058  }
44059
44060  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesDosageComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesDosageComponent element) throws IOException {
44061      composeBackbone(element);
44062      if (element.hasType()) {
44063        composeCodeableConcept("type", element.getType());
44064      }
44065      if (element.hasDosage()) {
44066        openArray("dosage");
44067        for (Dosage e : element.getDosage()) 
44068          composeDosage(null, e);
44069        closeArray();
44070      };
44071  }
44072
44073  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent(String name, MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
44074    if (element != null) {
44075      open(name);
44076      composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(element);
44077      close();
44078    }
44079  }
44080
44081  protected void composeMedicationKnowledgeMedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponentInner(MedicationKnowledge.MedicationKnowledgeAdministrationGuidelinesPatientCharacteristicsComponent element) throws IOException {
44082      composeBackbone(element);
44083      if (element.hasCharacteristic()) {
44084        composeType("characteristic", element.getCharacteristic());
44085      }
44086      if (element.hasValue()) {
44087        openArray("value");
44088        for (StringType e : element.getValue()) 
44089          composeStringCore(null, e, true);
44090        closeArray();
44091        if (anyHasExtras(element.getValue())) {
44092          openArray("_value");
44093          for (StringType e : element.getValue()) 
44094            composeStringExtras(null, e, true);
44095          closeArray();
44096        }
44097      };
44098  }
44099
44100  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponent(String name, MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
44101    if (element != null) {
44102      open(name);
44103      composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(element);
44104      close();
44105    }
44106  }
44107
44108  protected void composeMedicationKnowledgeMedicationKnowledgeMedicineClassificationComponentInner(MedicationKnowledge.MedicationKnowledgeMedicineClassificationComponent element) throws IOException {
44109      composeBackbone(element);
44110      if (element.hasType()) {
44111        composeCodeableConcept("type", element.getType());
44112      }
44113      if (element.hasClassification()) {
44114        openArray("classification");
44115        for (CodeableConcept e : element.getClassification()) 
44116          composeCodeableConcept(null, e);
44117        closeArray();
44118      };
44119  }
44120
44121  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponent(String name, MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
44122    if (element != null) {
44123      open(name);
44124      composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(element);
44125      close();
44126    }
44127  }
44128
44129  protected void composeMedicationKnowledgeMedicationKnowledgePackagingComponentInner(MedicationKnowledge.MedicationKnowledgePackagingComponent element) throws IOException {
44130      composeBackbone(element);
44131      if (element.hasType()) {
44132        composeCodeableConcept("type", element.getType());
44133      }
44134      if (element.hasQuantity()) {
44135        composeQuantity("quantity", element.getQuantity());
44136      }
44137  }
44138
44139  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponent(String name, MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
44140    if (element != null) {
44141      open(name);
44142      composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(element);
44143      close();
44144    }
44145  }
44146
44147  protected void composeMedicationKnowledgeMedicationKnowledgeDrugCharacteristicComponentInner(MedicationKnowledge.MedicationKnowledgeDrugCharacteristicComponent element) throws IOException {
44148      composeBackbone(element);
44149      if (element.hasType()) {
44150        composeCodeableConcept("type", element.getType());
44151      }
44152      if (element.hasValue()) {
44153        composeType("value", element.getValue());
44154      }
44155  }
44156
44157  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
44158    if (element != null) {
44159      open(name);
44160      composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(element);
44161      close();
44162    }
44163  }
44164
44165  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryComponent element) throws IOException {
44166      composeBackbone(element);
44167      if (element.hasRegulatoryAuthority()) {
44168        composeReference("regulatoryAuthority", element.getRegulatoryAuthority());
44169      }
44170      if (element.hasSubstitution()) {
44171        openArray("substitution");
44172        for (MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent e : element.getSubstitution()) 
44173          composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(null, e);
44174        closeArray();
44175      };
44176      if (element.hasSchedule()) {
44177        openArray("schedule");
44178        for (MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent e : element.getSchedule()) 
44179          composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(null, e);
44180        closeArray();
44181      };
44182      if (element.hasMaxDispense()) {
44183        composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent("maxDispense", element.getMaxDispense());
44184      }
44185  }
44186
44187  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
44188    if (element != null) {
44189      open(name);
44190      composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(element);
44191      close();
44192    }
44193  }
44194
44195  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatorySubstitutionComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatorySubstitutionComponent element) throws IOException {
44196      composeBackbone(element);
44197      if (element.hasType()) {
44198        composeCodeableConcept("type", element.getType());
44199      }
44200      if (element.hasAllowedElement()) {
44201        composeBooleanCore("allowed", element.getAllowedElement(), false);
44202        composeBooleanExtras("allowed", element.getAllowedElement(), false);
44203      }
44204  }
44205
44206  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
44207    if (element != null) {
44208      open(name);
44209      composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(element);
44210      close();
44211    }
44212  }
44213
44214  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryScheduleComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryScheduleComponent element) throws IOException {
44215      composeBackbone(element);
44216      if (element.hasSchedule()) {
44217        composeCodeableConcept("schedule", element.getSchedule());
44218      }
44219  }
44220
44221  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponent(String name, MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
44222    if (element != null) {
44223      open(name);
44224      composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(element);
44225      close();
44226    }
44227  }
44228
44229  protected void composeMedicationKnowledgeMedicationKnowledgeRegulatoryMaxDispenseComponentInner(MedicationKnowledge.MedicationKnowledgeRegulatoryMaxDispenseComponent element) throws IOException {
44230      composeBackbone(element);
44231      if (element.hasQuantity()) {
44232        composeQuantity("quantity", element.getQuantity());
44233      }
44234      if (element.hasPeriod()) {
44235        composeDuration("period", element.getPeriod());
44236      }
44237  }
44238
44239  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponent(String name, MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
44240    if (element != null) {
44241      open(name);
44242      composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(element);
44243      close();
44244    }
44245  }
44246
44247  protected void composeMedicationKnowledgeMedicationKnowledgeKineticsComponentInner(MedicationKnowledge.MedicationKnowledgeKineticsComponent element) throws IOException {
44248      composeBackbone(element);
44249      if (element.hasAreaUnderCurve()) {
44250        openArray("areaUnderCurve");
44251        for (Quantity e : element.getAreaUnderCurve()) 
44252          composeQuantity(null, e);
44253        closeArray();
44254      };
44255      if (element.hasLethalDose50()) {
44256        openArray("lethalDose50");
44257        for (Quantity e : element.getLethalDose50()) 
44258          composeQuantity(null, e);
44259        closeArray();
44260      };
44261      if (element.hasHalfLifePeriod()) {
44262        composeDuration("halfLifePeriod", element.getHalfLifePeriod());
44263      }
44264  }
44265
44266  protected void composeMedicationRequest(String name, MedicationRequest element) throws IOException {
44267    if (element != null) {
44268      prop("resourceType", name);
44269      composeMedicationRequestInner(element);
44270    }
44271  }
44272
44273  protected void composeMedicationRequestInner(MedicationRequest element) throws IOException {
44274      composeDomainResourceElements(element);
44275      if (element.hasIdentifier()) {
44276        openArray("identifier");
44277        for (Identifier e : element.getIdentifier()) 
44278          composeIdentifier(null, e);
44279        closeArray();
44280      };
44281      if (element.hasStatusElement()) {
44282        composeEnumerationCore("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
44283        composeEnumerationExtras("status", element.getStatusElement(), new MedicationRequest.MedicationRequestStatusEnumFactory(), false);
44284      }
44285      if (element.hasIntentElement()) {
44286        composeEnumerationCore("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
44287        composeEnumerationExtras("intent", element.getIntentElement(), new MedicationRequest.MedicationRequestIntentEnumFactory(), false);
44288      }
44289      if (element.hasCategory()) {
44290        openArray("category");
44291        for (CodeableConcept e : element.getCategory()) 
44292          composeCodeableConcept(null, e);
44293        closeArray();
44294      };
44295      if (element.hasPriorityElement()) {
44296        composeEnumerationCore("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
44297        composeEnumerationExtras("priority", element.getPriorityElement(), new MedicationRequest.MedicationRequestPriorityEnumFactory(), false);
44298      }
44299      if (element.hasDoNotPerformElement()) {
44300        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
44301        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
44302      }
44303      if (element.hasMedication()) {
44304        composeType("medication", element.getMedication());
44305      }
44306      if (element.hasSubject()) {
44307        composeReference("subject", element.getSubject());
44308      }
44309      if (element.hasContext()) {
44310        composeReference("context", element.getContext());
44311      }
44312      if (element.hasSupportingInformation()) {
44313        openArray("supportingInformation");
44314        for (Reference e : element.getSupportingInformation()) 
44315          composeReference(null, e);
44316        closeArray();
44317      };
44318      if (element.hasAuthoredOnElement()) {
44319        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
44320        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
44321      }
44322      if (element.hasRequester()) {
44323        composeReference("requester", element.getRequester());
44324      }
44325      if (element.hasPerformer()) {
44326        composeReference("performer", element.getPerformer());
44327      }
44328      if (element.hasPerformerType()) {
44329        composeCodeableConcept("performerType", element.getPerformerType());
44330      }
44331      if (element.hasRecorder()) {
44332        composeReference("recorder", element.getRecorder());
44333      }
44334      if (element.hasReasonCode()) {
44335        openArray("reasonCode");
44336        for (CodeableConcept e : element.getReasonCode()) 
44337          composeCodeableConcept(null, e);
44338        closeArray();
44339      };
44340      if (element.hasReasonReference()) {
44341        openArray("reasonReference");
44342        for (Reference e : element.getReasonReference()) 
44343          composeReference(null, e);
44344        closeArray();
44345      };
44346      if (element.hasInstantiates()) {
44347        openArray("instantiates");
44348        for (UriType e : element.getInstantiates()) 
44349          composeUriCore(null, e, true);
44350        closeArray();
44351        if (anyHasExtras(element.getInstantiates())) {
44352          openArray("_instantiates");
44353          for (UriType e : element.getInstantiates()) 
44354            composeUriExtras(null, e, true);
44355          closeArray();
44356        }
44357      };
44358      if (element.hasBasedOn()) {
44359        openArray("basedOn");
44360        for (Reference e : element.getBasedOn()) 
44361          composeReference(null, e);
44362        closeArray();
44363      };
44364      if (element.hasGroupIdentifier()) {
44365        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
44366      }
44367      if (element.hasStatusReason()) {
44368        composeCodeableConcept("statusReason", element.getStatusReason());
44369      }
44370      if (element.hasCourseOfTherapyType()) {
44371        composeCodeableConcept("courseOfTherapyType", element.getCourseOfTherapyType());
44372      }
44373      if (element.hasInsurance()) {
44374        openArray("insurance");
44375        for (Reference e : element.getInsurance()) 
44376          composeReference(null, e);
44377        closeArray();
44378      };
44379      if (element.hasNote()) {
44380        openArray("note");
44381        for (Annotation e : element.getNote()) 
44382          composeAnnotation(null, e);
44383        closeArray();
44384      };
44385      if (element.hasDosageInstruction()) {
44386        openArray("dosageInstruction");
44387        for (Dosage e : element.getDosageInstruction()) 
44388          composeDosage(null, e);
44389        closeArray();
44390      };
44391      if (element.hasDispenseRequest()) {
44392        composeMedicationRequestMedicationRequestDispenseRequestComponent("dispenseRequest", element.getDispenseRequest());
44393      }
44394      if (element.hasSubstitution()) {
44395        composeMedicationRequestMedicationRequestSubstitutionComponent("substitution", element.getSubstitution());
44396      }
44397      if (element.hasPriorPrescription()) {
44398        composeReference("priorPrescription", element.getPriorPrescription());
44399      }
44400      if (element.hasDetectedIssue()) {
44401        openArray("detectedIssue");
44402        for (Reference e : element.getDetectedIssue()) 
44403          composeReference(null, e);
44404        closeArray();
44405      };
44406      if (element.hasEventHistory()) {
44407        openArray("eventHistory");
44408        for (Reference e : element.getEventHistory()) 
44409          composeReference(null, e);
44410        closeArray();
44411      };
44412  }
44413
44414  protected void composeMedicationRequestMedicationRequestDispenseRequestComponent(String name, MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
44415    if (element != null) {
44416      open(name);
44417      composeMedicationRequestMedicationRequestDispenseRequestComponentInner(element);
44418      close();
44419    }
44420  }
44421
44422  protected void composeMedicationRequestMedicationRequestDispenseRequestComponentInner(MedicationRequest.MedicationRequestDispenseRequestComponent element) throws IOException {
44423      composeBackbone(element);
44424      if (element.hasInitialFill()) {
44425        composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent("initialFill", element.getInitialFill());
44426      }
44427      if (element.hasDispenseInterval()) {
44428        composeDuration("dispenseInterval", element.getDispenseInterval());
44429      }
44430      if (element.hasValidityPeriod()) {
44431        composePeriod("validityPeriod", element.getValidityPeriod());
44432      }
44433      if (element.hasNumberOfRepeatsAllowedElement()) {
44434        composeUnsignedIntCore("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
44435        composeUnsignedIntExtras("numberOfRepeatsAllowed", element.getNumberOfRepeatsAllowedElement(), false);
44436      }
44437      if (element.hasQuantity()) {
44438        composeQuantity("quantity", element.getQuantity());
44439      }
44440      if (element.hasExpectedSupplyDuration()) {
44441        composeDuration("expectedSupplyDuration", element.getExpectedSupplyDuration());
44442      }
44443      if (element.hasPerformer()) {
44444        composeReference("performer", element.getPerformer());
44445      }
44446  }
44447
44448  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponent(String name, MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
44449    if (element != null) {
44450      open(name);
44451      composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(element);
44452      close();
44453    }
44454  }
44455
44456  protected void composeMedicationRequestMedicationRequestDispenseRequestInitialFillComponentInner(MedicationRequest.MedicationRequestDispenseRequestInitialFillComponent element) throws IOException {
44457      composeBackbone(element);
44458      if (element.hasQuantity()) {
44459        composeQuantity("quantity", element.getQuantity());
44460      }
44461      if (element.hasDuration()) {
44462        composeDuration("duration", element.getDuration());
44463      }
44464  }
44465
44466  protected void composeMedicationRequestMedicationRequestSubstitutionComponent(String name, MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
44467    if (element != null) {
44468      open(name);
44469      composeMedicationRequestMedicationRequestSubstitutionComponentInner(element);
44470      close();
44471    }
44472  }
44473
44474  protected void composeMedicationRequestMedicationRequestSubstitutionComponentInner(MedicationRequest.MedicationRequestSubstitutionComponent element) throws IOException {
44475      composeBackbone(element);
44476      if (element.hasAllowedElement()) {
44477        composeBooleanCore("allowed", element.getAllowedElement(), false);
44478        composeBooleanExtras("allowed", element.getAllowedElement(), false);
44479      }
44480      if (element.hasReason()) {
44481        composeCodeableConcept("reason", element.getReason());
44482      }
44483  }
44484
44485  protected void composeMedicationStatement(String name, MedicationStatement element) throws IOException {
44486    if (element != null) {
44487      prop("resourceType", name);
44488      composeMedicationStatementInner(element);
44489    }
44490  }
44491
44492  protected void composeMedicationStatementInner(MedicationStatement element) throws IOException {
44493      composeDomainResourceElements(element);
44494      if (element.hasIdentifier()) {
44495        openArray("identifier");
44496        for (Identifier e : element.getIdentifier()) 
44497          composeIdentifier(null, e);
44498        closeArray();
44499      };
44500      if (element.hasBasedOn()) {
44501        openArray("basedOn");
44502        for (Reference e : element.getBasedOn()) 
44503          composeReference(null, e);
44504        closeArray();
44505      };
44506      if (element.hasPartOf()) {
44507        openArray("partOf");
44508        for (Reference e : element.getPartOf()) 
44509          composeReference(null, e);
44510        closeArray();
44511      };
44512      if (element.hasStatusElement()) {
44513        composeEnumerationCore("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
44514        composeEnumerationExtras("status", element.getStatusElement(), new MedicationStatement.MedicationStatementStatusEnumFactory(), false);
44515      }
44516      if (element.hasStatusReason()) {
44517        openArray("statusReason");
44518        for (CodeableConcept e : element.getStatusReason()) 
44519          composeCodeableConcept(null, e);
44520        closeArray();
44521      };
44522      if (element.hasCategory()) {
44523        composeCodeableConcept("category", element.getCategory());
44524      }
44525      if (element.hasMedication()) {
44526        composeType("medication", element.getMedication());
44527      }
44528      if (element.hasSubject()) {
44529        composeReference("subject", element.getSubject());
44530      }
44531      if (element.hasContext()) {
44532        composeReference("context", element.getContext());
44533      }
44534      if (element.hasEffective()) {
44535        composeType("effective", element.getEffective());
44536      }
44537      if (element.hasDateAssertedElement()) {
44538        composeDateTimeCore("dateAsserted", element.getDateAssertedElement(), false);
44539        composeDateTimeExtras("dateAsserted", element.getDateAssertedElement(), false);
44540      }
44541      if (element.hasInformationSource()) {
44542        composeReference("informationSource", element.getInformationSource());
44543      }
44544      if (element.hasDerivedFrom()) {
44545        openArray("derivedFrom");
44546        for (Reference e : element.getDerivedFrom()) 
44547          composeReference(null, e);
44548        closeArray();
44549      };
44550      if (element.hasReasonCode()) {
44551        openArray("reasonCode");
44552        for (CodeableConcept e : element.getReasonCode()) 
44553          composeCodeableConcept(null, e);
44554        closeArray();
44555      };
44556      if (element.hasReasonReference()) {
44557        openArray("reasonReference");
44558        for (Reference e : element.getReasonReference()) 
44559          composeReference(null, e);
44560        closeArray();
44561      };
44562      if (element.hasNote()) {
44563        openArray("note");
44564        for (Annotation e : element.getNote()) 
44565          composeAnnotation(null, e);
44566        closeArray();
44567      };
44568      if (element.hasDosage()) {
44569        openArray("dosage");
44570        for (Dosage e : element.getDosage()) 
44571          composeDosage(null, e);
44572        closeArray();
44573      };
44574  }
44575
44576  protected void composeMedicinalProduct(String name, MedicinalProduct element) throws IOException {
44577    if (element != null) {
44578      prop("resourceType", name);
44579      composeMedicinalProductInner(element);
44580    }
44581  }
44582
44583  protected void composeMedicinalProductInner(MedicinalProduct element) throws IOException {
44584      composeDomainResourceElements(element);
44585      if (element.hasIdentifier()) {
44586        openArray("identifier");
44587        for (Identifier e : element.getIdentifier()) 
44588          composeIdentifier(null, e);
44589        closeArray();
44590      };
44591      if (element.hasType()) {
44592        composeCodeableConcept("type", element.getType());
44593      }
44594      if (element.hasDomain()) {
44595        composeCoding("domain", element.getDomain());
44596      }
44597      if (element.hasCombinedPharmaceuticalDoseForm()) {
44598        composeCodeableConcept("combinedPharmaceuticalDoseForm", element.getCombinedPharmaceuticalDoseForm());
44599      }
44600      if (element.hasAdditionalMonitoringIndicator()) {
44601        composeCodeableConcept("additionalMonitoringIndicator", element.getAdditionalMonitoringIndicator());
44602      }
44603      if (element.hasSpecialMeasures()) {
44604        openArray("specialMeasures");
44605        for (StringType e : element.getSpecialMeasures()) 
44606          composeStringCore(null, e, true);
44607        closeArray();
44608        if (anyHasExtras(element.getSpecialMeasures())) {
44609          openArray("_specialMeasures");
44610          for (StringType e : element.getSpecialMeasures()) 
44611            composeStringExtras(null, e, true);
44612          closeArray();
44613        }
44614      };
44615      if (element.hasPaediatricUseIndicator()) {
44616        composeCodeableConcept("paediatricUseIndicator", element.getPaediatricUseIndicator());
44617      }
44618      if (element.hasProductClassification()) {
44619        openArray("productClassification");
44620        for (CodeableConcept e : element.getProductClassification()) 
44621          composeCodeableConcept(null, e);
44622        closeArray();
44623      };
44624      if (element.hasMarketingStatus()) {
44625        openArray("marketingStatus");
44626        for (MarketingStatus e : element.getMarketingStatus()) 
44627          composeMarketingStatus(null, e);
44628        closeArray();
44629      };
44630      if (element.hasMarketingAuthorization()) {
44631        composeReference("marketingAuthorization", element.getMarketingAuthorization());
44632      }
44633      if (element.hasPackagedMedicinalProduct()) {
44634        openArray("packagedMedicinalProduct");
44635        for (Reference e : element.getPackagedMedicinalProduct()) 
44636          composeReference(null, e);
44637        closeArray();
44638      };
44639      if (element.hasPharmaceuticalProduct()) {
44640        openArray("pharmaceuticalProduct");
44641        for (Reference e : element.getPharmaceuticalProduct()) 
44642          composeReference(null, e);
44643        closeArray();
44644      };
44645      if (element.hasContraindication()) {
44646        openArray("contraindication");
44647        for (Reference e : element.getContraindication()) 
44648          composeReference(null, e);
44649        closeArray();
44650      };
44651      if (element.hasInteraction()) {
44652        openArray("interaction");
44653        for (Reference e : element.getInteraction()) 
44654          composeReference(null, e);
44655        closeArray();
44656      };
44657      if (element.hasTherapeuticIndication()) {
44658        openArray("therapeuticIndication");
44659        for (Reference e : element.getTherapeuticIndication()) 
44660          composeReference(null, e);
44661        closeArray();
44662      };
44663      if (element.hasUndesirableEffect()) {
44664        openArray("undesirableEffect");
44665        for (Reference e : element.getUndesirableEffect()) 
44666          composeReference(null, e);
44667        closeArray();
44668      };
44669      if (element.hasAttachedDocument()) {
44670        openArray("attachedDocument");
44671        for (Reference e : element.getAttachedDocument()) 
44672          composeReference(null, e);
44673        closeArray();
44674      };
44675      if (element.hasMasterFile()) {
44676        openArray("masterFile");
44677        for (Reference e : element.getMasterFile()) 
44678          composeReference(null, e);
44679        closeArray();
44680      };
44681      if (element.hasContact()) {
44682        openArray("contact");
44683        for (Reference e : element.getContact()) 
44684          composeReference(null, e);
44685        closeArray();
44686      };
44687      if (element.hasClinicalTrial()) {
44688        openArray("clinicalTrial");
44689        for (Reference e : element.getClinicalTrial()) 
44690          composeReference(null, e);
44691        closeArray();
44692      };
44693      if (element.hasName()) {
44694        openArray("name");
44695        for (MedicinalProduct.MedicinalProductNameComponent e : element.getName()) 
44696          composeMedicinalProductMedicinalProductNameComponent(null, e);
44697        closeArray();
44698      };
44699      if (element.hasCrossReference()) {
44700        openArray("crossReference");
44701        for (Identifier e : element.getCrossReference()) 
44702          composeIdentifier(null, e);
44703        closeArray();
44704      };
44705      if (element.hasManufacturingBusinessOperation()) {
44706        openArray("manufacturingBusinessOperation");
44707        for (MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent e : element.getManufacturingBusinessOperation()) 
44708          composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(null, e);
44709        closeArray();
44710      };
44711      if (element.hasSpecialDesignation()) {
44712        openArray("specialDesignation");
44713        for (MedicinalProduct.MedicinalProductSpecialDesignationComponent e : element.getSpecialDesignation()) 
44714          composeMedicinalProductMedicinalProductSpecialDesignationComponent(null, e);
44715        closeArray();
44716      };
44717  }
44718
44719  protected void composeMedicinalProductMedicinalProductNameComponent(String name, MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
44720    if (element != null) {
44721      open(name);
44722      composeMedicinalProductMedicinalProductNameComponentInner(element);
44723      close();
44724    }
44725  }
44726
44727  protected void composeMedicinalProductMedicinalProductNameComponentInner(MedicinalProduct.MedicinalProductNameComponent element) throws IOException {
44728      composeBackbone(element);
44729      if (element.hasProductNameElement()) {
44730        composeStringCore("productName", element.getProductNameElement(), false);
44731        composeStringExtras("productName", element.getProductNameElement(), false);
44732      }
44733      if (element.hasNamePart()) {
44734        openArray("namePart");
44735        for (MedicinalProduct.MedicinalProductNameNamePartComponent e : element.getNamePart()) 
44736          composeMedicinalProductMedicinalProductNameNamePartComponent(null, e);
44737        closeArray();
44738      };
44739      if (element.hasCountryLanguage()) {
44740        openArray("countryLanguage");
44741        for (MedicinalProduct.MedicinalProductNameCountryLanguageComponent e : element.getCountryLanguage()) 
44742          composeMedicinalProductMedicinalProductNameCountryLanguageComponent(null, e);
44743        closeArray();
44744      };
44745  }
44746
44747  protected void composeMedicinalProductMedicinalProductNameNamePartComponent(String name, MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
44748    if (element != null) {
44749      open(name);
44750      composeMedicinalProductMedicinalProductNameNamePartComponentInner(element);
44751      close();
44752    }
44753  }
44754
44755  protected void composeMedicinalProductMedicinalProductNameNamePartComponentInner(MedicinalProduct.MedicinalProductNameNamePartComponent element) throws IOException {
44756      composeBackbone(element);
44757      if (element.hasPartElement()) {
44758        composeStringCore("part", element.getPartElement(), false);
44759        composeStringExtras("part", element.getPartElement(), false);
44760      }
44761      if (element.hasType()) {
44762        composeCoding("type", element.getType());
44763      }
44764  }
44765
44766  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponent(String name, MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
44767    if (element != null) {
44768      open(name);
44769      composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(element);
44770      close();
44771    }
44772  }
44773
44774  protected void composeMedicinalProductMedicinalProductNameCountryLanguageComponentInner(MedicinalProduct.MedicinalProductNameCountryLanguageComponent element) throws IOException {
44775      composeBackbone(element);
44776      if (element.hasCountry()) {
44777        composeCodeableConcept("country", element.getCountry());
44778      }
44779      if (element.hasJurisdiction()) {
44780        composeCodeableConcept("jurisdiction", element.getJurisdiction());
44781      }
44782      if (element.hasLanguage()) {
44783        composeCodeableConcept("language", element.getLanguage());
44784      }
44785  }
44786
44787  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponent(String name, MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
44788    if (element != null) {
44789      open(name);
44790      composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(element);
44791      close();
44792    }
44793  }
44794
44795  protected void composeMedicinalProductMedicinalProductManufacturingBusinessOperationComponentInner(MedicinalProduct.MedicinalProductManufacturingBusinessOperationComponent element) throws IOException {
44796      composeBackbone(element);
44797      if (element.hasOperationType()) {
44798        composeCodeableConcept("operationType", element.getOperationType());
44799      }
44800      if (element.hasAuthorisationReferenceNumber()) {
44801        composeIdentifier("authorisationReferenceNumber", element.getAuthorisationReferenceNumber());
44802      }
44803      if (element.hasEffectiveDateElement()) {
44804        composeDateTimeCore("effectiveDate", element.getEffectiveDateElement(), false);
44805        composeDateTimeExtras("effectiveDate", element.getEffectiveDateElement(), false);
44806      }
44807      if (element.hasConfidentialityIndicator()) {
44808        composeCodeableConcept("confidentialityIndicator", element.getConfidentialityIndicator());
44809      }
44810      if (element.hasManufacturer()) {
44811        openArray("manufacturer");
44812        for (Reference e : element.getManufacturer()) 
44813          composeReference(null, e);
44814        closeArray();
44815      };
44816      if (element.hasRegulator()) {
44817        composeReference("regulator", element.getRegulator());
44818      }
44819  }
44820
44821  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponent(String name, MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
44822    if (element != null) {
44823      open(name);
44824      composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(element);
44825      close();
44826    }
44827  }
44828
44829  protected void composeMedicinalProductMedicinalProductSpecialDesignationComponentInner(MedicinalProduct.MedicinalProductSpecialDesignationComponent element) throws IOException {
44830      composeBackbone(element);
44831      if (element.hasIdentifier()) {
44832        openArray("identifier");
44833        for (Identifier e : element.getIdentifier()) 
44834          composeIdentifier(null, e);
44835        closeArray();
44836      };
44837      if (element.hasIntendedUse()) {
44838        composeCodeableConcept("intendedUse", element.getIntendedUse());
44839      }
44840      if (element.hasIndication()) {
44841        composeCodeableConcept("indication", element.getIndication());
44842      }
44843      if (element.hasStatus()) {
44844        composeCodeableConcept("status", element.getStatus());
44845      }
44846      if (element.hasDateElement()) {
44847        composeDateTimeCore("date", element.getDateElement(), false);
44848        composeDateTimeExtras("date", element.getDateElement(), false);
44849      }
44850      if (element.hasSpecies()) {
44851        composeCodeableConcept("species", element.getSpecies());
44852      }
44853  }
44854
44855  protected void composeMedicinalProductAuthorization(String name, MedicinalProductAuthorization element) throws IOException {
44856    if (element != null) {
44857      prop("resourceType", name);
44858      composeMedicinalProductAuthorizationInner(element);
44859    }
44860  }
44861
44862  protected void composeMedicinalProductAuthorizationInner(MedicinalProductAuthorization element) throws IOException {
44863      composeDomainResourceElements(element);
44864      if (element.hasIdentifier()) {
44865        openArray("identifier");
44866        for (Identifier e : element.getIdentifier()) 
44867          composeIdentifier(null, e);
44868        closeArray();
44869      };
44870      if (element.hasSubject()) {
44871        composeReference("subject", element.getSubject());
44872      }
44873      if (element.hasCountry()) {
44874        openArray("country");
44875        for (CodeableConcept e : element.getCountry()) 
44876          composeCodeableConcept(null, e);
44877        closeArray();
44878      };
44879      if (element.hasJurisdiction()) {
44880        openArray("jurisdiction");
44881        for (CodeableConcept e : element.getJurisdiction()) 
44882          composeCodeableConcept(null, e);
44883        closeArray();
44884      };
44885      if (element.hasLegalStatusOfSupply()) {
44886        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
44887      }
44888      if (element.hasStatus()) {
44889        composeCodeableConcept("status", element.getStatus());
44890      }
44891      if (element.hasStatusDateElement()) {
44892        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
44893        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
44894      }
44895      if (element.hasRestoreDateElement()) {
44896        composeDateTimeCore("restoreDate", element.getRestoreDateElement(), false);
44897        composeDateTimeExtras("restoreDate", element.getRestoreDateElement(), false);
44898      }
44899      if (element.hasValidityPeriod()) {
44900        composePeriod("validityPeriod", element.getValidityPeriod());
44901      }
44902      if (element.hasDataExclusivityPeriod()) {
44903        composePeriod("dataExclusivityPeriod", element.getDataExclusivityPeriod());
44904      }
44905      if (element.hasDateOfFirstAuthorizationElement()) {
44906        composeDateTimeCore("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
44907        composeDateTimeExtras("dateOfFirstAuthorization", element.getDateOfFirstAuthorizationElement(), false);
44908      }
44909      if (element.hasInternationalBirthDateElement()) {
44910        composeDateTimeCore("internationalBirthDate", element.getInternationalBirthDateElement(), false);
44911        composeDateTimeExtras("internationalBirthDate", element.getInternationalBirthDateElement(), false);
44912      }
44913      if (element.hasLegalBasis()) {
44914        composeCodeableConcept("legalBasis", element.getLegalBasis());
44915      }
44916      if (element.hasJurisdictionalAuthorization()) {
44917        openArray("jurisdictionalAuthorization");
44918        for (MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent e : element.getJurisdictionalAuthorization()) 
44919          composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(null, e);
44920        closeArray();
44921      };
44922      if (element.hasHolder()) {
44923        composeReference("holder", element.getHolder());
44924      }
44925      if (element.hasRegulator()) {
44926        composeReference("regulator", element.getRegulator());
44927      }
44928      if (element.hasProcedure()) {
44929        composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent("procedure", element.getProcedure());
44930      }
44931  }
44932
44933  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
44934    if (element != null) {
44935      open(name);
44936      composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(element);
44937      close();
44938    }
44939  }
44940
44941  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationJurisdictionalAuthorizationComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationJurisdictionalAuthorizationComponent element) throws IOException {
44942      composeBackbone(element);
44943      if (element.hasIdentifier()) {
44944        openArray("identifier");
44945        for (Identifier e : element.getIdentifier()) 
44946          composeIdentifier(null, e);
44947        closeArray();
44948      };
44949      if (element.hasCountry()) {
44950        composeCodeableConcept("country", element.getCountry());
44951      }
44952      if (element.hasJurisdiction()) {
44953        openArray("jurisdiction");
44954        for (CodeableConcept e : element.getJurisdiction()) 
44955          composeCodeableConcept(null, e);
44956        closeArray();
44957      };
44958      if (element.hasLegalStatusOfSupply()) {
44959        composeCodeableConcept("legalStatusOfSupply", element.getLegalStatusOfSupply());
44960      }
44961      if (element.hasValidityPeriod()) {
44962        composePeriod("validityPeriod", element.getValidityPeriod());
44963      }
44964  }
44965
44966  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(String name, MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
44967    if (element != null) {
44968      open(name);
44969      composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(element);
44970      close();
44971    }
44972  }
44973
44974  protected void composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponentInner(MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent element) throws IOException {
44975      composeBackbone(element);
44976      if (element.hasIdentifier()) {
44977        composeIdentifier("identifier", element.getIdentifier());
44978      }
44979      if (element.hasType()) {
44980        composeCodeableConcept("type", element.getType());
44981      }
44982      if (element.hasDate()) {
44983        composeType("date", element.getDate());
44984      }
44985      if (element.hasApplication()) {
44986        openArray("application");
44987        for (MedicinalProductAuthorization.MedicinalProductAuthorizationProcedureComponent e : element.getApplication()) 
44988          composeMedicinalProductAuthorizationMedicinalProductAuthorizationProcedureComponent(null, e);
44989        closeArray();
44990      };
44991  }
44992
44993  protected void composeMedicinalProductClinicals(String name, MedicinalProductClinicals element) throws IOException {
44994    if (element != null) {
44995      prop("resourceType", name);
44996      composeMedicinalProductClinicalsInner(element);
44997    }
44998  }
44999
45000  protected void composeMedicinalProductClinicalsInner(MedicinalProductClinicals element) throws IOException {
45001      composeDomainResourceElements(element);
45002      if (element.hasUndesirableEffects()) {
45003        openArray("undesirableEffects");
45004        for (MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent e : element.getUndesirableEffects()) 
45005          composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(null, e);
45006        closeArray();
45007      };
45008      if (element.hasTherapeuticIndication()) {
45009        openArray("therapeuticIndication");
45010        for (MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent e : element.getTherapeuticIndication()) 
45011          composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(null, e);
45012        closeArray();
45013      };
45014      if (element.hasContraindication()) {
45015        openArray("contraindication");
45016        for (MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent e : element.getContraindication()) 
45017          composeMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponent(null, e);
45018        closeArray();
45019      };
45020      if (element.hasInteractions()) {
45021        openArray("interactions");
45022        for (MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent e : element.getInteractions()) 
45023          composeMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponent(null, e);
45024        closeArray();
45025      };
45026  }
45027
45028  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent element) throws IOException {
45029    if (element != null) {
45030      open(name);
45031      composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponentInner(element);
45032      close();
45033    }
45034  }
45035
45036  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent element) throws IOException {
45037      composeBackbone(element);
45038      if (element.hasSymptomConditionEffect()) {
45039        composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
45040      }
45041      if (element.hasClassification()) {
45042        composeCodeableConcept("classification", element.getClassification());
45043      }
45044      if (element.hasFrequencyOfOccurrence()) {
45045        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
45046      }
45047      if (element.hasPopulation()) {
45048        openArray("population");
45049        for (MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent e : element.getPopulation()) 
45050          composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(null, e);
45051        closeArray();
45052      };
45053  }
45054
45055  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent element) throws IOException {
45056    if (element != null) {
45057      open(name);
45058      composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponentInner(element);
45059      close();
45060    }
45061  }
45062
45063  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent element) throws IOException {
45064      composeBackbone(element);
45065      if (element.hasAge()) {
45066        composeType("age", element.getAge());
45067      }
45068      if (element.hasGender()) {
45069        composeCodeableConcept("gender", element.getGender());
45070      }
45071      if (element.hasRace()) {
45072        composeCodeableConcept("race", element.getRace());
45073      }
45074      if (element.hasPhysiologicalCondition()) {
45075        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
45076      }
45077  }
45078
45079  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent element) throws IOException {
45080    if (element != null) {
45081      open(name);
45082      composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponentInner(element);
45083      close();
45084    }
45085  }
45086
45087  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent element) throws IOException {
45088      composeBackbone(element);
45089      if (element.hasDiseaseSymptomProcedure()) {
45090        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
45091      }
45092      if (element.hasDiseaseStatus()) {
45093        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
45094      }
45095      if (element.hasComorbidity()) {
45096        openArray("comorbidity");
45097        for (CodeableConcept e : element.getComorbidity()) 
45098          composeCodeableConcept(null, e);
45099        closeArray();
45100      };
45101      if (element.hasIntendedEffect()) {
45102        composeCodeableConcept("intendedEffect", element.getIntendedEffect());
45103      }
45104      if (element.hasDuration()) {
45105        composeQuantity("duration", element.getDuration());
45106      }
45107      if (element.hasUndesirableEffects()) {
45108        openArray("undesirableEffects");
45109        for (MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsComponent e : element.getUndesirableEffects()) 
45110          composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsComponent(null, e);
45111        closeArray();
45112      };
45113      if (element.hasOtherTherapy()) {
45114        openArray("otherTherapy");
45115        for (MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent e : element.getOtherTherapy()) 
45116          composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(null, e);
45117        closeArray();
45118      };
45119      if (element.hasPopulation()) {
45120        openArray("population");
45121        for (MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent e : element.getPopulation()) 
45122          composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(null, e);
45123        closeArray();
45124      };
45125  }
45126
45127  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent element) throws IOException {
45128    if (element != null) {
45129      open(name);
45130      composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponentInner(element);
45131      close();
45132    }
45133  }
45134
45135  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent element) throws IOException {
45136      composeBackbone(element);
45137      if (element.hasTherapyRelationshipType()) {
45138        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
45139      }
45140      if (element.hasMedication()) {
45141        composeType("medication", element.getMedication());
45142      }
45143  }
45144
45145  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent element) throws IOException {
45146    if (element != null) {
45147      open(name);
45148      composeMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponentInner(element);
45149      close();
45150    }
45151  }
45152
45153  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsContraindicationComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsContraindicationComponent element) throws IOException {
45154      composeBackbone(element);
45155      if (element.hasDisease()) {
45156        composeCodeableConcept("disease", element.getDisease());
45157      }
45158      if (element.hasDiseaseStatus()) {
45159        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
45160      }
45161      if (element.hasComorbidity()) {
45162        openArray("comorbidity");
45163        for (CodeableConcept e : element.getComorbidity()) 
45164          composeCodeableConcept(null, e);
45165        closeArray();
45166      };
45167      if (element.hasTherapeuticIndication()) {
45168        openArray("therapeuticIndication");
45169        for (MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationComponent e : element.getTherapeuticIndication()) 
45170          composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationComponent(null, e);
45171        closeArray();
45172      };
45173      if (element.hasOtherTherapy()) {
45174        openArray("otherTherapy");
45175        for (MedicinalProductClinicals.MedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent e : element.getOtherTherapy()) 
45176          composeMedicinalProductClinicalsMedicinalProductClinicalsTherapeuticIndicationOtherTherapyComponent(null, e);
45177        closeArray();
45178      };
45179      if (element.hasPopulation()) {
45180        openArray("population");
45181        for (MedicinalProductClinicals.MedicinalProductClinicalsUndesirableEffectsPopulationComponent e : element.getPopulation()) 
45182          composeMedicinalProductClinicalsMedicinalProductClinicalsUndesirableEffectsPopulationComponent(null, e);
45183        closeArray();
45184      };
45185  }
45186
45187  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponent(String name, MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent element) throws IOException {
45188    if (element != null) {
45189      open(name);
45190      composeMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponentInner(element);
45191      close();
45192    }
45193  }
45194
45195  protected void composeMedicinalProductClinicalsMedicinalProductClinicalsInteractionsComponentInner(MedicinalProductClinicals.MedicinalProductClinicalsInteractionsComponent element) throws IOException {
45196      composeBackbone(element);
45197      if (element.hasInteractionElement()) {
45198        composeStringCore("interaction", element.getInteractionElement(), false);
45199        composeStringExtras("interaction", element.getInteractionElement(), false);
45200      }
45201      if (element.hasInteractant()) {
45202        openArray("interactant");
45203        for (CodeableConcept e : element.getInteractant()) 
45204          composeCodeableConcept(null, e);
45205        closeArray();
45206      };
45207      if (element.hasType()) {
45208        composeCodeableConcept("type", element.getType());
45209      }
45210      if (element.hasEffect()) {
45211        composeCodeableConcept("effect", element.getEffect());
45212      }
45213      if (element.hasIncidence()) {
45214        composeCodeableConcept("incidence", element.getIncidence());
45215      }
45216      if (element.hasManagement()) {
45217        composeCodeableConcept("management", element.getManagement());
45218      }
45219  }
45220
45221  protected void composeMedicinalProductContraindication(String name, MedicinalProductContraindication element) throws IOException {
45222    if (element != null) {
45223      prop("resourceType", name);
45224      composeMedicinalProductContraindicationInner(element);
45225    }
45226  }
45227
45228  protected void composeMedicinalProductContraindicationInner(MedicinalProductContraindication element) throws IOException {
45229      composeDomainResourceElements(element);
45230      if (element.hasSubject()) {
45231        openArray("subject");
45232        for (Reference e : element.getSubject()) 
45233          composeReference(null, e);
45234        closeArray();
45235      };
45236      if (element.hasDisease()) {
45237        composeCodeableConcept("disease", element.getDisease());
45238      }
45239      if (element.hasDiseaseStatus()) {
45240        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
45241      }
45242      if (element.hasComorbidity()) {
45243        openArray("comorbidity");
45244        for (CodeableConcept e : element.getComorbidity()) 
45245          composeCodeableConcept(null, e);
45246        closeArray();
45247      };
45248      if (element.hasTherapeuticIndication()) {
45249        openArray("therapeuticIndication");
45250        for (Reference e : element.getTherapeuticIndication()) 
45251          composeReference(null, e);
45252        closeArray();
45253      };
45254      if (element.hasOtherTherapy()) {
45255        openArray("otherTherapy");
45256        for (MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent e : element.getOtherTherapy()) 
45257          composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(null, e);
45258        closeArray();
45259      };
45260      if (element.hasPopulation()) {
45261        openArray("population");
45262        for (MedicinalProductContraindication.MedicinalProductContraindicationPopulationComponent e : element.getPopulation()) 
45263          composeMedicinalProductContraindicationMedicinalProductContraindicationPopulationComponent(null, e);
45264        closeArray();
45265      };
45266  }
45267
45268  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponent(String name, MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element) throws IOException {
45269    if (element != null) {
45270      open(name);
45271      composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(element);
45272      close();
45273    }
45274  }
45275
45276  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationOtherTherapyComponentInner(MedicinalProductContraindication.MedicinalProductContraindicationOtherTherapyComponent element) throws IOException {
45277      composeBackbone(element);
45278      if (element.hasTherapyRelationshipType()) {
45279        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
45280      }
45281      if (element.hasMedication()) {
45282        composeType("medication", element.getMedication());
45283      }
45284  }
45285
45286  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationPopulationComponent(String name, MedicinalProductContraindication.MedicinalProductContraindicationPopulationComponent element) throws IOException {
45287    if (element != null) {
45288      open(name);
45289      composeMedicinalProductContraindicationMedicinalProductContraindicationPopulationComponentInner(element);
45290      close();
45291    }
45292  }
45293
45294  protected void composeMedicinalProductContraindicationMedicinalProductContraindicationPopulationComponentInner(MedicinalProductContraindication.MedicinalProductContraindicationPopulationComponent element) throws IOException {
45295      composeBackbone(element);
45296      if (element.hasAge()) {
45297        composeType("age", element.getAge());
45298      }
45299      if (element.hasGender()) {
45300        composeCodeableConcept("gender", element.getGender());
45301      }
45302      if (element.hasRace()) {
45303        composeCodeableConcept("race", element.getRace());
45304      }
45305      if (element.hasPhysiologicalCondition()) {
45306        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
45307      }
45308  }
45309
45310  protected void composeMedicinalProductDeviceSpec(String name, MedicinalProductDeviceSpec element) throws IOException {
45311    if (element != null) {
45312      prop("resourceType", name);
45313      composeMedicinalProductDeviceSpecInner(element);
45314    }
45315  }
45316
45317  protected void composeMedicinalProductDeviceSpecInner(MedicinalProductDeviceSpec element) throws IOException {
45318      composeDomainResourceElements(element);
45319      if (element.hasIdentifier()) {
45320        composeIdentifier("identifier", element.getIdentifier());
45321      }
45322      if (element.hasType()) {
45323        composeCodeableConcept("type", element.getType());
45324      }
45325      if (element.hasTradeNameElement()) {
45326        composeStringCore("tradeName", element.getTradeNameElement(), false);
45327        composeStringExtras("tradeName", element.getTradeNameElement(), false);
45328      }
45329      if (element.hasQuantity()) {
45330        composeQuantity("quantity", element.getQuantity());
45331      }
45332      if (element.hasListingNumberElement()) {
45333        composeStringCore("listingNumber", element.getListingNumberElement(), false);
45334        composeStringExtras("listingNumber", element.getListingNumberElement(), false);
45335      }
45336      if (element.hasModelNumberElement()) {
45337        composeStringCore("modelNumber", element.getModelNumberElement(), false);
45338        composeStringExtras("modelNumber", element.getModelNumberElement(), false);
45339      }
45340      if (element.hasSterilityIndicator()) {
45341        composeCodeableConcept("sterilityIndicator", element.getSterilityIndicator());
45342      }
45343      if (element.hasSterilisationRequirement()) {
45344        composeCodeableConcept("sterilisationRequirement", element.getSterilisationRequirement());
45345      }
45346      if (element.hasUsage()) {
45347        composeCodeableConcept("usage", element.getUsage());
45348      }
45349      if (element.hasNomenclature()) {
45350        openArray("nomenclature");
45351        for (CodeableConcept e : element.getNomenclature()) 
45352          composeCodeableConcept(null, e);
45353        closeArray();
45354      };
45355      if (element.hasShelfLifeStorage()) {
45356        openArray("shelfLifeStorage");
45357        for (ProductShelfLife e : element.getShelfLifeStorage()) 
45358          composeProductShelfLife(null, e);
45359        closeArray();
45360      };
45361      if (element.hasPhysicalCharacteristics()) {
45362        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
45363      }
45364      if (element.hasOtherCharacteristics()) {
45365        openArray("otherCharacteristics");
45366        for (CodeableConcept e : element.getOtherCharacteristics()) 
45367          composeCodeableConcept(null, e);
45368        closeArray();
45369      };
45370      if (element.hasBatchIdentifier()) {
45371        openArray("batchIdentifier");
45372        for (Identifier e : element.getBatchIdentifier()) 
45373          composeIdentifier(null, e);
45374        closeArray();
45375      };
45376      if (element.hasManufacturer()) {
45377        openArray("manufacturer");
45378        for (Reference e : element.getManufacturer()) 
45379          composeReference(null, e);
45380        closeArray();
45381      };
45382      if (element.hasMaterial()) {
45383        openArray("material");
45384        for (MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent e : element.getMaterial()) 
45385          composeMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponent(null, e);
45386        closeArray();
45387      };
45388  }
45389
45390  protected void composeMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponent(String name, MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent element) throws IOException {
45391    if (element != null) {
45392      open(name);
45393      composeMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponentInner(element);
45394      close();
45395    }
45396  }
45397
45398  protected void composeMedicinalProductDeviceSpecMedicinalProductDeviceSpecMaterialComponentInner(MedicinalProductDeviceSpec.MedicinalProductDeviceSpecMaterialComponent element) throws IOException {
45399      composeBackbone(element);
45400      if (element.hasSubstance()) {
45401        composeCodeableConcept("substance", element.getSubstance());
45402      }
45403      if (element.hasAlternateElement()) {
45404        composeBooleanCore("alternate", element.getAlternateElement(), false);
45405        composeBooleanExtras("alternate", element.getAlternateElement(), false);
45406      }
45407      if (element.hasAllergenicIndicatorElement()) {
45408        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
45409        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
45410      }
45411  }
45412
45413  protected void composeMedicinalProductIndication(String name, MedicinalProductIndication element) throws IOException {
45414    if (element != null) {
45415      prop("resourceType", name);
45416      composeMedicinalProductIndicationInner(element);
45417    }
45418  }
45419
45420  protected void composeMedicinalProductIndicationInner(MedicinalProductIndication element) throws IOException {
45421      composeDomainResourceElements(element);
45422      if (element.hasSubject()) {
45423        openArray("subject");
45424        for (Reference e : element.getSubject()) 
45425          composeReference(null, e);
45426        closeArray();
45427      };
45428      if (element.hasDiseaseSymptomProcedure()) {
45429        composeCodeableConcept("diseaseSymptomProcedure", element.getDiseaseSymptomProcedure());
45430      }
45431      if (element.hasDiseaseStatus()) {
45432        composeCodeableConcept("diseaseStatus", element.getDiseaseStatus());
45433      }
45434      if (element.hasComorbidity()) {
45435        openArray("comorbidity");
45436        for (CodeableConcept e : element.getComorbidity()) 
45437          composeCodeableConcept(null, e);
45438        closeArray();
45439      };
45440      if (element.hasIntendedEffect()) {
45441        composeCodeableConcept("intendedEffect", element.getIntendedEffect());
45442      }
45443      if (element.hasDuration()) {
45444        composeQuantity("duration", element.getDuration());
45445      }
45446      if (element.hasOtherTherapy()) {
45447        openArray("otherTherapy");
45448        for (MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent e : element.getOtherTherapy()) 
45449          composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(null, e);
45450        closeArray();
45451      };
45452      if (element.hasUndesirableEffect()) {
45453        openArray("undesirableEffect");
45454        for (Reference e : element.getUndesirableEffect()) 
45455          composeReference(null, e);
45456        closeArray();
45457      };
45458      if (element.hasPopulation()) {
45459        openArray("population");
45460        for (MedicinalProductIndication.MedicinalProductIndicationPopulationComponent e : element.getPopulation()) 
45461          composeMedicinalProductIndicationMedicinalProductIndicationPopulationComponent(null, e);
45462        closeArray();
45463      };
45464  }
45465
45466  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponent(String name, MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
45467    if (element != null) {
45468      open(name);
45469      composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(element);
45470      close();
45471    }
45472  }
45473
45474  protected void composeMedicinalProductIndicationMedicinalProductIndicationOtherTherapyComponentInner(MedicinalProductIndication.MedicinalProductIndicationOtherTherapyComponent element) throws IOException {
45475      composeBackbone(element);
45476      if (element.hasTherapyRelationshipType()) {
45477        composeCodeableConcept("therapyRelationshipType", element.getTherapyRelationshipType());
45478      }
45479      if (element.hasMedication()) {
45480        composeType("medication", element.getMedication());
45481      }
45482  }
45483
45484  protected void composeMedicinalProductIndicationMedicinalProductIndicationPopulationComponent(String name, MedicinalProductIndication.MedicinalProductIndicationPopulationComponent element) throws IOException {
45485    if (element != null) {
45486      open(name);
45487      composeMedicinalProductIndicationMedicinalProductIndicationPopulationComponentInner(element);
45488      close();
45489    }
45490  }
45491
45492  protected void composeMedicinalProductIndicationMedicinalProductIndicationPopulationComponentInner(MedicinalProductIndication.MedicinalProductIndicationPopulationComponent element) throws IOException {
45493      composeBackbone(element);
45494      if (element.hasAge()) {
45495        composeType("age", element.getAge());
45496      }
45497      if (element.hasGender()) {
45498        composeCodeableConcept("gender", element.getGender());
45499      }
45500      if (element.hasRace()) {
45501        composeCodeableConcept("race", element.getRace());
45502      }
45503      if (element.hasPhysiologicalCondition()) {
45504        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
45505      }
45506  }
45507
45508  protected void composeMedicinalProductIngredient(String name, MedicinalProductIngredient element) throws IOException {
45509    if (element != null) {
45510      prop("resourceType", name);
45511      composeMedicinalProductIngredientInner(element);
45512    }
45513  }
45514
45515  protected void composeMedicinalProductIngredientInner(MedicinalProductIngredient element) throws IOException {
45516      composeDomainResourceElements(element);
45517      if (element.hasIdentifier()) {
45518        composeIdentifier("identifier", element.getIdentifier());
45519      }
45520      if (element.hasRole()) {
45521        composeCodeableConcept("role", element.getRole());
45522      }
45523      if (element.hasAllergenicIndicatorElement()) {
45524        composeBooleanCore("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
45525        composeBooleanExtras("allergenicIndicator", element.getAllergenicIndicatorElement(), false);
45526      }
45527      if (element.hasManufacturer()) {
45528        openArray("manufacturer");
45529        for (Reference e : element.getManufacturer()) 
45530          composeReference(null, e);
45531        closeArray();
45532      };
45533      if (element.hasSpecifiedSubstance()) {
45534        openArray("specifiedSubstance");
45535        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent e : element.getSpecifiedSubstance()) 
45536          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(null, e);
45537        closeArray();
45538      };
45539      if (element.hasSubstance()) {
45540        composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent("substance", element.getSubstance());
45541      }
45542  }
45543
45544  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
45545    if (element != null) {
45546      open(name);
45547      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(element);
45548      close();
45549    }
45550  }
45551
45552  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceComponent element) throws IOException {
45553      composeBackbone(element);
45554      if (element.hasCode()) {
45555        composeCodeableConcept("code", element.getCode());
45556      }
45557      if (element.hasGroup()) {
45558        composeCodeableConcept("group", element.getGroup());
45559      }
45560      if (element.hasConfidentiality()) {
45561        composeCodeableConcept("confidentiality", element.getConfidentiality());
45562      }
45563      if (element.hasStrength()) {
45564        openArray("strength");
45565        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
45566          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
45567        closeArray();
45568      };
45569  }
45570
45571  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
45572    if (element != null) {
45573      open(name);
45574      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(element);
45575      close();
45576    }
45577  }
45578
45579  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent element) throws IOException {
45580      composeBackbone(element);
45581      if (element.hasPresentation()) {
45582        composeRatio("presentation", element.getPresentation());
45583      }
45584      if (element.hasPresentationLowLimit()) {
45585        composeRatio("presentationLowLimit", element.getPresentationLowLimit());
45586      }
45587      if (element.hasConcentration()) {
45588        composeRatio("concentration", element.getConcentration());
45589      }
45590      if (element.hasConcentrationLowLimit()) {
45591        composeRatio("concentrationLowLimit", element.getConcentrationLowLimit());
45592      }
45593      if (element.hasMeasurementPointElement()) {
45594        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
45595        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
45596      }
45597      if (element.hasCountry()) {
45598        openArray("country");
45599        for (CodeableConcept e : element.getCountry()) 
45600          composeCodeableConcept(null, e);
45601        closeArray();
45602      };
45603      if (element.hasReferenceStrength()) {
45604        openArray("referenceStrength");
45605        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent e : element.getReferenceStrength()) 
45606          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(null, e);
45607        closeArray();
45608      };
45609  }
45610
45611  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
45612    if (element != null) {
45613      open(name);
45614      composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(element);
45615      close();
45616    }
45617  }
45618
45619  protected void composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthReferenceStrengthComponent element) throws IOException {
45620      composeBackbone(element);
45621      if (element.hasSubstance()) {
45622        composeCodeableConcept("substance", element.getSubstance());
45623      }
45624      if (element.hasStrength()) {
45625        composeRatio("strength", element.getStrength());
45626      }
45627      if (element.hasMeasurementPointElement()) {
45628        composeStringCore("measurementPoint", element.getMeasurementPointElement(), false);
45629        composeStringExtras("measurementPoint", element.getMeasurementPointElement(), false);
45630      }
45631      if (element.hasCountry()) {
45632        openArray("country");
45633        for (CodeableConcept e : element.getCountry()) 
45634          composeCodeableConcept(null, e);
45635        closeArray();
45636      };
45637  }
45638
45639  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponent(String name, MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
45640    if (element != null) {
45641      open(name);
45642      composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(element);
45643      close();
45644    }
45645  }
45646
45647  protected void composeMedicinalProductIngredientMedicinalProductIngredientSubstanceComponentInner(MedicinalProductIngredient.MedicinalProductIngredientSubstanceComponent element) throws IOException {
45648      composeBackbone(element);
45649      if (element.hasCode()) {
45650        composeCodeableConcept("code", element.getCode());
45651      }
45652      if (element.hasStrength()) {
45653        openArray("strength");
45654        for (MedicinalProductIngredient.MedicinalProductIngredientSpecifiedSubstanceStrengthComponent e : element.getStrength()) 
45655          composeMedicinalProductIngredientMedicinalProductIngredientSpecifiedSubstanceStrengthComponent(null, e);
45656        closeArray();
45657      };
45658  }
45659
45660  protected void composeMedicinalProductInteraction(String name, MedicinalProductInteraction element) throws IOException {
45661    if (element != null) {
45662      prop("resourceType", name);
45663      composeMedicinalProductInteractionInner(element);
45664    }
45665  }
45666
45667  protected void composeMedicinalProductInteractionInner(MedicinalProductInteraction element) throws IOException {
45668      composeDomainResourceElements(element);
45669      if (element.hasSubject()) {
45670        openArray("subject");
45671        for (Reference e : element.getSubject()) 
45672          composeReference(null, e);
45673        closeArray();
45674      };
45675      if (element.hasInteractionElement()) {
45676        composeStringCore("interaction", element.getInteractionElement(), false);
45677        composeStringExtras("interaction", element.getInteractionElement(), false);
45678      }
45679      if (element.hasInteractant()) {
45680        openArray("interactant");
45681        for (CodeableConcept e : element.getInteractant()) 
45682          composeCodeableConcept(null, e);
45683        closeArray();
45684      };
45685      if (element.hasType()) {
45686        composeCodeableConcept("type", element.getType());
45687      }
45688      if (element.hasEffect()) {
45689        composeCodeableConcept("effect", element.getEffect());
45690      }
45691      if (element.hasIncidence()) {
45692        composeCodeableConcept("incidence", element.getIncidence());
45693      }
45694      if (element.hasManagement()) {
45695        composeCodeableConcept("management", element.getManagement());
45696      }
45697  }
45698
45699  protected void composeMedicinalProductManufactured(String name, MedicinalProductManufactured element) throws IOException {
45700    if (element != null) {
45701      prop("resourceType", name);
45702      composeMedicinalProductManufacturedInner(element);
45703    }
45704  }
45705
45706  protected void composeMedicinalProductManufacturedInner(MedicinalProductManufactured element) throws IOException {
45707      composeDomainResourceElements(element);
45708      if (element.hasManufacturedDoseForm()) {
45709        composeCodeableConcept("manufacturedDoseForm", element.getManufacturedDoseForm());
45710      }
45711      if (element.hasUnitOfPresentation()) {
45712        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
45713      }
45714      if (element.hasQuantity()) {
45715        composeQuantity("quantity", element.getQuantity());
45716      }
45717      if (element.hasManufacturer()) {
45718        openArray("manufacturer");
45719        for (Reference e : element.getManufacturer()) 
45720          composeReference(null, e);
45721        closeArray();
45722      };
45723      if (element.hasIngredient()) {
45724        openArray("ingredient");
45725        for (Reference e : element.getIngredient()) 
45726          composeReference(null, e);
45727        closeArray();
45728      };
45729      if (element.hasPhysicalCharacteristics()) {
45730        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
45731      }
45732      if (element.hasOtherCharacteristics()) {
45733        openArray("otherCharacteristics");
45734        for (CodeableConcept e : element.getOtherCharacteristics()) 
45735          composeCodeableConcept(null, e);
45736        closeArray();
45737      };
45738  }
45739
45740  protected void composeMedicinalProductPackaged(String name, MedicinalProductPackaged element) throws IOException {
45741    if (element != null) {
45742      prop("resourceType", name);
45743      composeMedicinalProductPackagedInner(element);
45744    }
45745  }
45746
45747  protected void composeMedicinalProductPackagedInner(MedicinalProductPackaged element) throws IOException {
45748      composeDomainResourceElements(element);
45749      if (element.hasIdentifier()) {
45750        composeIdentifier("identifier", element.getIdentifier());
45751      }
45752      if (element.hasDescriptionElement()) {
45753        composeStringCore("description", element.getDescriptionElement(), false);
45754        composeStringExtras("description", element.getDescriptionElement(), false);
45755      }
45756      if (element.hasMarketingStatus()) {
45757        openArray("marketingStatus");
45758        for (MarketingStatus e : element.getMarketingStatus()) 
45759          composeMarketingStatus(null, e);
45760        closeArray();
45761      };
45762      if (element.hasMarketingAuthorization()) {
45763        composeReference("marketingAuthorization", element.getMarketingAuthorization());
45764      }
45765      if (element.hasManufacturer()) {
45766        openArray("manufacturer");
45767        for (Reference e : element.getManufacturer()) 
45768          composeReference(null, e);
45769        closeArray();
45770      };
45771      if (element.hasBatchIdentifier()) {
45772        openArray("batchIdentifier");
45773        for (MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent e : element.getBatchIdentifier()) 
45774          composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(null, e);
45775        closeArray();
45776      };
45777      if (element.hasPackageItem()) {
45778        openArray("packageItem");
45779        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
45780          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
45781        closeArray();
45782      };
45783  }
45784
45785  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
45786    if (element != null) {
45787      open(name);
45788      composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(element);
45789      close();
45790    }
45791  }
45792
45793  protected void composeMedicinalProductPackagedMedicinalProductPackagedBatchIdentifierComponentInner(MedicinalProductPackaged.MedicinalProductPackagedBatchIdentifierComponent element) throws IOException {
45794      composeBackbone(element);
45795      if (element.hasOuterPackaging()) {
45796        composeIdentifier("outerPackaging", element.getOuterPackaging());
45797      }
45798      if (element.hasImmediatePackaging()) {
45799        composeIdentifier("immediatePackaging", element.getImmediatePackaging());
45800      }
45801  }
45802
45803  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(String name, MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
45804    if (element != null) {
45805      open(name);
45806      composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(element);
45807      close();
45808    }
45809  }
45810
45811  protected void composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponentInner(MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent element) throws IOException {
45812      composeBackbone(element);
45813      if (element.hasIdentifier()) {
45814        openArray("identifier");
45815        for (Identifier e : element.getIdentifier()) 
45816          composeIdentifier(null, e);
45817        closeArray();
45818      };
45819      if (element.hasType()) {
45820        composeCodeableConcept("type", element.getType());
45821      }
45822      if (element.hasQuantity()) {
45823        composeQuantity("quantity", element.getQuantity());
45824      }
45825      if (element.hasMaterial()) {
45826        openArray("material");
45827        for (CodeableConcept e : element.getMaterial()) 
45828          composeCodeableConcept(null, e);
45829        closeArray();
45830      };
45831      if (element.hasAlternateMaterial()) {
45832        openArray("alternateMaterial");
45833        for (CodeableConcept e : element.getAlternateMaterial()) 
45834          composeCodeableConcept(null, e);
45835        closeArray();
45836      };
45837      if (element.hasDevice()) {
45838        openArray("device");
45839        for (Reference e : element.getDevice()) 
45840          composeReference(null, e);
45841        closeArray();
45842      };
45843      if (element.hasManufacturedItem()) {
45844        openArray("manufacturedItem");
45845        for (Reference e : element.getManufacturedItem()) 
45846          composeReference(null, e);
45847        closeArray();
45848      };
45849      if (element.hasPackageItem()) {
45850        openArray("packageItem");
45851        for (MedicinalProductPackaged.MedicinalProductPackagedPackageItemComponent e : element.getPackageItem()) 
45852          composeMedicinalProductPackagedMedicinalProductPackagedPackageItemComponent(null, e);
45853        closeArray();
45854      };
45855      if (element.hasPhysicalCharacteristics()) {
45856        composeProdCharacteristic("physicalCharacteristics", element.getPhysicalCharacteristics());
45857      }
45858      if (element.hasOtherCharacteristics()) {
45859        openArray("otherCharacteristics");
45860        for (CodeableConcept e : element.getOtherCharacteristics()) 
45861          composeCodeableConcept(null, e);
45862        closeArray();
45863      };
45864      if (element.hasShelfLifeStorage()) {
45865        openArray("shelfLifeStorage");
45866        for (ProductShelfLife e : element.getShelfLifeStorage()) 
45867          composeProductShelfLife(null, e);
45868        closeArray();
45869      };
45870      if (element.hasManufacturer()) {
45871        openArray("manufacturer");
45872        for (Reference e : element.getManufacturer()) 
45873          composeReference(null, e);
45874        closeArray();
45875      };
45876  }
45877
45878  protected void composeMedicinalProductPharmaceutical(String name, MedicinalProductPharmaceutical element) throws IOException {
45879    if (element != null) {
45880      prop("resourceType", name);
45881      composeMedicinalProductPharmaceuticalInner(element);
45882    }
45883  }
45884
45885  protected void composeMedicinalProductPharmaceuticalInner(MedicinalProductPharmaceutical element) throws IOException {
45886      composeDomainResourceElements(element);
45887      if (element.hasIdentifier()) {
45888        openArray("identifier");
45889        for (Identifier e : element.getIdentifier()) 
45890          composeIdentifier(null, e);
45891        closeArray();
45892      };
45893      if (element.hasAdministrableDoseForm()) {
45894        composeCodeableConcept("administrableDoseForm", element.getAdministrableDoseForm());
45895      }
45896      if (element.hasUnitOfPresentation()) {
45897        composeCodeableConcept("unitOfPresentation", element.getUnitOfPresentation());
45898      }
45899      if (element.hasIngredient()) {
45900        openArray("ingredient");
45901        for (Reference e : element.getIngredient()) 
45902          composeReference(null, e);
45903        closeArray();
45904      };
45905      if (element.hasDevice()) {
45906        openArray("device");
45907        for (Reference e : element.getDevice()) 
45908          composeReference(null, e);
45909        closeArray();
45910      };
45911      if (element.hasCharacteristics()) {
45912        openArray("characteristics");
45913        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent e : element.getCharacteristics()) 
45914          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(null, e);
45915        closeArray();
45916      };
45917      if (element.hasRouteOfAdministration()) {
45918        openArray("routeOfAdministration");
45919        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent e : element.getRouteOfAdministration()) 
45920          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(null, e);
45921        closeArray();
45922      };
45923  }
45924
45925  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
45926    if (element != null) {
45927      open(name);
45928      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(element);
45929      close();
45930    }
45931  }
45932
45933  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalCharacteristicsComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalCharacteristicsComponent element) throws IOException {
45934      composeBackbone(element);
45935      if (element.hasCode()) {
45936        composeCodeableConcept("code", element.getCode());
45937      }
45938      if (element.hasStatus()) {
45939        composeCodeableConcept("status", element.getStatus());
45940      }
45941  }
45942
45943  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element) throws IOException {
45944    if (element != null) {
45945      open(name);
45946      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(element);
45947      close();
45948    }
45949  }
45950
45951  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationComponent element) throws IOException {
45952      composeBackbone(element);
45953      if (element.hasCode()) {
45954        composeCodeableConcept("code", element.getCode());
45955      }
45956      if (element.hasFirstDose()) {
45957        composeQuantity("firstDose", element.getFirstDose());
45958      }
45959      if (element.hasMaxSingleDose()) {
45960        composeQuantity("maxSingleDose", element.getMaxSingleDose());
45961      }
45962      if (element.hasMaxDosePerDay()) {
45963        composeQuantity("maxDosePerDay", element.getMaxDosePerDay());
45964      }
45965      if (element.hasMaxDosePerTreatmentPeriod()) {
45966        composeRatio("maxDosePerTreatmentPeriod", element.getMaxDosePerTreatmentPeriod());
45967      }
45968      if (element.hasMaxTreatmentPeriod()) {
45969        composeDuration("maxTreatmentPeriod", element.getMaxTreatmentPeriod());
45970      }
45971      if (element.hasTargetSpecies()) {
45972        openArray("targetSpecies");
45973        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent e : element.getTargetSpecies()) 
45974          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(null, e);
45975        closeArray();
45976      };
45977  }
45978
45979  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
45980    if (element != null) {
45981      open(name);
45982      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(element);
45983      close();
45984    }
45985  }
45986
45987  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesComponent element) throws IOException {
45988      composeBackbone(element);
45989      if (element.hasCode()) {
45990        composeCodeableConcept("code", element.getCode());
45991      }
45992      if (element.hasWithdrawalPeriod()) {
45993        openArray("withdrawalPeriod");
45994        for (MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent e : element.getWithdrawalPeriod()) 
45995          composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(null, e);
45996        closeArray();
45997      };
45998  }
45999
46000  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent(String name, MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
46001    if (element != null) {
46002      open(name);
46003      composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(element);
46004      close();
46005    }
46006  }
46007
46008  protected void composeMedicinalProductPharmaceuticalMedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponentInner(MedicinalProductPharmaceutical.MedicinalProductPharmaceuticalRouteOfAdministrationTargetSpeciesWithdrawalPeriodComponent element) throws IOException {
46009      composeBackbone(element);
46010      if (element.hasTissue()) {
46011        composeCodeableConcept("tissue", element.getTissue());
46012      }
46013      if (element.hasValue()) {
46014        composeQuantity("value", element.getValue());
46015      }
46016      if (element.hasSupportingInformationElement()) {
46017        composeStringCore("supportingInformation", element.getSupportingInformationElement(), false);
46018        composeStringExtras("supportingInformation", element.getSupportingInformationElement(), false);
46019      }
46020  }
46021
46022  protected void composeMedicinalProductUndesirableEffect(String name, MedicinalProductUndesirableEffect element) throws IOException {
46023    if (element != null) {
46024      prop("resourceType", name);
46025      composeMedicinalProductUndesirableEffectInner(element);
46026    }
46027  }
46028
46029  protected void composeMedicinalProductUndesirableEffectInner(MedicinalProductUndesirableEffect element) throws IOException {
46030      composeDomainResourceElements(element);
46031      if (element.hasSubject()) {
46032        openArray("subject");
46033        for (Reference e : element.getSubject()) 
46034          composeReference(null, e);
46035        closeArray();
46036      };
46037      if (element.hasSymptomConditionEffect()) {
46038        composeCodeableConcept("symptomConditionEffect", element.getSymptomConditionEffect());
46039      }
46040      if (element.hasClassification()) {
46041        composeCodeableConcept("classification", element.getClassification());
46042      }
46043      if (element.hasFrequencyOfOccurrence()) {
46044        composeCodeableConcept("frequencyOfOccurrence", element.getFrequencyOfOccurrence());
46045      }
46046      if (element.hasPopulation()) {
46047        openArray("population");
46048        for (MedicinalProductUndesirableEffect.MedicinalProductUndesirableEffectPopulationComponent e : element.getPopulation()) 
46049          composeMedicinalProductUndesirableEffectMedicinalProductUndesirableEffectPopulationComponent(null, e);
46050        closeArray();
46051      };
46052  }
46053
46054  protected void composeMedicinalProductUndesirableEffectMedicinalProductUndesirableEffectPopulationComponent(String name, MedicinalProductUndesirableEffect.MedicinalProductUndesirableEffectPopulationComponent element) throws IOException {
46055    if (element != null) {
46056      open(name);
46057      composeMedicinalProductUndesirableEffectMedicinalProductUndesirableEffectPopulationComponentInner(element);
46058      close();
46059    }
46060  }
46061
46062  protected void composeMedicinalProductUndesirableEffectMedicinalProductUndesirableEffectPopulationComponentInner(MedicinalProductUndesirableEffect.MedicinalProductUndesirableEffectPopulationComponent element) throws IOException {
46063      composeBackbone(element);
46064      if (element.hasAge()) {
46065        composeType("age", element.getAge());
46066      }
46067      if (element.hasGender()) {
46068        composeCodeableConcept("gender", element.getGender());
46069      }
46070      if (element.hasRace()) {
46071        composeCodeableConcept("race", element.getRace());
46072      }
46073      if (element.hasPhysiologicalCondition()) {
46074        composeCodeableConcept("physiologicalCondition", element.getPhysiologicalCondition());
46075      }
46076  }
46077
46078  protected void composeMessageDefinition(String name, MessageDefinition element) throws IOException {
46079    if (element != null) {
46080      prop("resourceType", name);
46081      composeMessageDefinitionInner(element);
46082    }
46083  }
46084
46085  protected void composeMessageDefinitionInner(MessageDefinition element) throws IOException {
46086      composeDomainResourceElements(element);
46087      if (element.hasUrlElement()) {
46088        composeUriCore("url", element.getUrlElement(), false);
46089        composeUriExtras("url", element.getUrlElement(), false);
46090      }
46091      if (element.hasIdentifier()) {
46092        openArray("identifier");
46093        for (Identifier e : element.getIdentifier()) 
46094          composeIdentifier(null, e);
46095        closeArray();
46096      };
46097      if (element.hasVersionElement()) {
46098        composeStringCore("version", element.getVersionElement(), false);
46099        composeStringExtras("version", element.getVersionElement(), false);
46100      }
46101      if (element.hasNameElement()) {
46102        composeStringCore("name", element.getNameElement(), false);
46103        composeStringExtras("name", element.getNameElement(), false);
46104      }
46105      if (element.hasTitleElement()) {
46106        composeStringCore("title", element.getTitleElement(), false);
46107        composeStringExtras("title", element.getTitleElement(), false);
46108      }
46109      if (element.hasReplaces()) {
46110        openArray("replaces");
46111        for (CanonicalType e : element.getReplaces()) 
46112          composeCanonicalCore(null, e, true);
46113        closeArray();
46114        if (anyHasExtras(element.getReplaces())) {
46115          openArray("_replaces");
46116          for (CanonicalType e : element.getReplaces()) 
46117            composeCanonicalExtras(null, e, true);
46118          closeArray();
46119        }
46120      };
46121      if (element.hasStatusElement()) {
46122        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46123        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46124      }
46125      if (element.hasExperimentalElement()) {
46126        composeBooleanCore("experimental", element.getExperimentalElement(), false);
46127        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
46128      }
46129      if (element.hasDateElement()) {
46130        composeDateTimeCore("date", element.getDateElement(), false);
46131        composeDateTimeExtras("date", element.getDateElement(), false);
46132      }
46133      if (element.hasPublisherElement()) {
46134        composeStringCore("publisher", element.getPublisherElement(), false);
46135        composeStringExtras("publisher", element.getPublisherElement(), false);
46136      }
46137      if (element.hasContact()) {
46138        openArray("contact");
46139        for (ContactDetail e : element.getContact()) 
46140          composeContactDetail(null, e);
46141        closeArray();
46142      };
46143      if (element.hasDescriptionElement()) {
46144        composeMarkdownCore("description", element.getDescriptionElement(), false);
46145        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46146      }
46147      if (element.hasUseContext()) {
46148        openArray("useContext");
46149        for (UsageContext e : element.getUseContext()) 
46150          composeUsageContext(null, e);
46151        closeArray();
46152      };
46153      if (element.hasJurisdiction()) {
46154        openArray("jurisdiction");
46155        for (CodeableConcept e : element.getJurisdiction()) 
46156          composeCodeableConcept(null, e);
46157        closeArray();
46158      };
46159      if (element.hasPurposeElement()) {
46160        composeMarkdownCore("purpose", element.getPurposeElement(), false);
46161        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
46162      }
46163      if (element.hasCopyrightElement()) {
46164        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
46165        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
46166      }
46167      if (element.hasBaseElement()) {
46168        composeCanonicalCore("base", element.getBaseElement(), false);
46169        composeCanonicalExtras("base", element.getBaseElement(), false);
46170      }
46171      if (element.hasParent()) {
46172        openArray("parent");
46173        for (CanonicalType e : element.getParent()) 
46174          composeCanonicalCore(null, e, true);
46175        closeArray();
46176        if (anyHasExtras(element.getParent())) {
46177          openArray("_parent");
46178          for (CanonicalType e : element.getParent()) 
46179            composeCanonicalExtras(null, e, true);
46180          closeArray();
46181        }
46182      };
46183      if (element.hasEvent()) {
46184        composeType("event", element.getEvent());
46185      }
46186      if (element.hasCategoryElement()) {
46187        composeEnumerationCore("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
46188        composeEnumerationExtras("category", element.getCategoryElement(), new MessageDefinition.MessageSignificanceCategoryEnumFactory(), false);
46189      }
46190      if (element.hasFocus()) {
46191        openArray("focus");
46192        for (MessageDefinition.MessageDefinitionFocusComponent e : element.getFocus()) 
46193          composeMessageDefinitionMessageDefinitionFocusComponent(null, e);
46194        closeArray();
46195      };
46196      if (element.hasResponseRequiredElement()) {
46197        composeEnumerationCore("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
46198        composeEnumerationExtras("responseRequired", element.getResponseRequiredElement(), new MessageDefinition.MessageheaderResponseRequestEnumFactory(), false);
46199      }
46200      if (element.hasAllowedResponse()) {
46201        openArray("allowedResponse");
46202        for (MessageDefinition.MessageDefinitionAllowedResponseComponent e : element.getAllowedResponse()) 
46203          composeMessageDefinitionMessageDefinitionAllowedResponseComponent(null, e);
46204        closeArray();
46205      };
46206      if (element.hasGraph()) {
46207        openArray("graph");
46208        for (CanonicalType e : element.getGraph()) 
46209          composeCanonicalCore(null, e, true);
46210        closeArray();
46211        if (anyHasExtras(element.getGraph())) {
46212          openArray("_graph");
46213          for (CanonicalType e : element.getGraph()) 
46214            composeCanonicalExtras(null, e, true);
46215          closeArray();
46216        }
46217      };
46218  }
46219
46220  protected void composeMessageDefinitionMessageDefinitionFocusComponent(String name, MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
46221    if (element != null) {
46222      open(name);
46223      composeMessageDefinitionMessageDefinitionFocusComponentInner(element);
46224      close();
46225    }
46226  }
46227
46228  protected void composeMessageDefinitionMessageDefinitionFocusComponentInner(MessageDefinition.MessageDefinitionFocusComponent element) throws IOException {
46229      composeBackbone(element);
46230      if (element.hasCodeElement()) {
46231        composeCodeCore("code", element.getCodeElement(), false);
46232        composeCodeExtras("code", element.getCodeElement(), false);
46233      }
46234      if (element.hasProfileElement()) {
46235        composeCanonicalCore("profile", element.getProfileElement(), false);
46236        composeCanonicalExtras("profile", element.getProfileElement(), false);
46237      }
46238      if (element.hasMinElement()) {
46239        composeUnsignedIntCore("min", element.getMinElement(), false);
46240        composeUnsignedIntExtras("min", element.getMinElement(), false);
46241      }
46242      if (element.hasMaxElement()) {
46243        composeStringCore("max", element.getMaxElement(), false);
46244        composeStringExtras("max", element.getMaxElement(), false);
46245      }
46246  }
46247
46248  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponent(String name, MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
46249    if (element != null) {
46250      open(name);
46251      composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(element);
46252      close();
46253    }
46254  }
46255
46256  protected void composeMessageDefinitionMessageDefinitionAllowedResponseComponentInner(MessageDefinition.MessageDefinitionAllowedResponseComponent element) throws IOException {
46257      composeBackbone(element);
46258      if (element.hasMessageElement()) {
46259        composeCanonicalCore("message", element.getMessageElement(), false);
46260        composeCanonicalExtras("message", element.getMessageElement(), false);
46261      }
46262      if (element.hasSituationElement()) {
46263        composeMarkdownCore("situation", element.getSituationElement(), false);
46264        composeMarkdownExtras("situation", element.getSituationElement(), false);
46265      }
46266  }
46267
46268  protected void composeMessageHeader(String name, MessageHeader element) throws IOException {
46269    if (element != null) {
46270      prop("resourceType", name);
46271      composeMessageHeaderInner(element);
46272    }
46273  }
46274
46275  protected void composeMessageHeaderInner(MessageHeader element) throws IOException {
46276      composeDomainResourceElements(element);
46277      if (element.hasEvent()) {
46278        composeType("event", element.getEvent());
46279      }
46280      if (element.hasDestination()) {
46281        openArray("destination");
46282        for (MessageHeader.MessageDestinationComponent e : element.getDestination()) 
46283          composeMessageHeaderMessageDestinationComponent(null, e);
46284        closeArray();
46285      };
46286      if (element.hasSender()) {
46287        composeReference("sender", element.getSender());
46288      }
46289      if (element.hasEnterer()) {
46290        composeReference("enterer", element.getEnterer());
46291      }
46292      if (element.hasAuthor()) {
46293        composeReference("author", element.getAuthor());
46294      }
46295      if (element.hasSource()) {
46296        composeMessageHeaderMessageSourceComponent("source", element.getSource());
46297      }
46298      if (element.hasResponsible()) {
46299        composeReference("responsible", element.getResponsible());
46300      }
46301      if (element.hasReason()) {
46302        composeCodeableConcept("reason", element.getReason());
46303      }
46304      if (element.hasResponse()) {
46305        composeMessageHeaderMessageHeaderResponseComponent("response", element.getResponse());
46306      }
46307      if (element.hasFocus()) {
46308        openArray("focus");
46309        for (Reference e : element.getFocus()) 
46310          composeReference(null, e);
46311        closeArray();
46312      };
46313      if (element.hasDefinitionElement()) {
46314        composeCanonicalCore("definition", element.getDefinitionElement(), false);
46315        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
46316      }
46317  }
46318
46319  protected void composeMessageHeaderMessageDestinationComponent(String name, MessageHeader.MessageDestinationComponent element) throws IOException {
46320    if (element != null) {
46321      open(name);
46322      composeMessageHeaderMessageDestinationComponentInner(element);
46323      close();
46324    }
46325  }
46326
46327  protected void composeMessageHeaderMessageDestinationComponentInner(MessageHeader.MessageDestinationComponent element) throws IOException {
46328      composeBackbone(element);
46329      if (element.hasNameElement()) {
46330        composeStringCore("name", element.getNameElement(), false);
46331        composeStringExtras("name", element.getNameElement(), false);
46332      }
46333      if (element.hasTarget()) {
46334        composeReference("target", element.getTarget());
46335      }
46336      if (element.hasEndpointElement()) {
46337        composeUrlCore("endpoint", element.getEndpointElement(), false);
46338        composeUrlExtras("endpoint", element.getEndpointElement(), false);
46339      }
46340      if (element.hasReceiver()) {
46341        composeReference("receiver", element.getReceiver());
46342      }
46343  }
46344
46345  protected void composeMessageHeaderMessageSourceComponent(String name, MessageHeader.MessageSourceComponent element) throws IOException {
46346    if (element != null) {
46347      open(name);
46348      composeMessageHeaderMessageSourceComponentInner(element);
46349      close();
46350    }
46351  }
46352
46353  protected void composeMessageHeaderMessageSourceComponentInner(MessageHeader.MessageSourceComponent element) throws IOException {
46354      composeBackbone(element);
46355      if (element.hasNameElement()) {
46356        composeStringCore("name", element.getNameElement(), false);
46357        composeStringExtras("name", element.getNameElement(), false);
46358      }
46359      if (element.hasSoftwareElement()) {
46360        composeStringCore("software", element.getSoftwareElement(), false);
46361        composeStringExtras("software", element.getSoftwareElement(), false);
46362      }
46363      if (element.hasVersionElement()) {
46364        composeStringCore("version", element.getVersionElement(), false);
46365        composeStringExtras("version", element.getVersionElement(), false);
46366      }
46367      if (element.hasContact()) {
46368        composeContactPoint("contact", element.getContact());
46369      }
46370      if (element.hasEndpointElement()) {
46371        composeUrlCore("endpoint", element.getEndpointElement(), false);
46372        composeUrlExtras("endpoint", element.getEndpointElement(), false);
46373      }
46374  }
46375
46376  protected void composeMessageHeaderMessageHeaderResponseComponent(String name, MessageHeader.MessageHeaderResponseComponent element) throws IOException {
46377    if (element != null) {
46378      open(name);
46379      composeMessageHeaderMessageHeaderResponseComponentInner(element);
46380      close();
46381    }
46382  }
46383
46384  protected void composeMessageHeaderMessageHeaderResponseComponentInner(MessageHeader.MessageHeaderResponseComponent element) throws IOException {
46385      composeBackbone(element);
46386      if (element.hasIdentifierElement()) {
46387        composeIdCore("identifier", element.getIdentifierElement(), false);
46388        composeIdExtras("identifier", element.getIdentifierElement(), false);
46389      }
46390      if (element.hasCodeElement()) {
46391        composeEnumerationCore("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
46392        composeEnumerationExtras("code", element.getCodeElement(), new MessageHeader.ResponseTypeEnumFactory(), false);
46393      }
46394      if (element.hasDetails()) {
46395        composeReference("details", element.getDetails());
46396      }
46397  }
46398
46399  protected void composeNamingSystem(String name, NamingSystem element) throws IOException {
46400    if (element != null) {
46401      prop("resourceType", name);
46402      composeNamingSystemInner(element);
46403    }
46404  }
46405
46406  protected void composeNamingSystemInner(NamingSystem element) throws IOException {
46407      composeDomainResourceElements(element);
46408      if (element.hasNameElement()) {
46409        composeStringCore("name", element.getNameElement(), false);
46410        composeStringExtras("name", element.getNameElement(), false);
46411      }
46412      if (element.hasStatusElement()) {
46413        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46414        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
46415      }
46416      if (element.hasKindElement()) {
46417        composeEnumerationCore("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
46418        composeEnumerationExtras("kind", element.getKindElement(), new NamingSystem.NamingSystemTypeEnumFactory(), false);
46419      }
46420      if (element.hasDateElement()) {
46421        composeDateTimeCore("date", element.getDateElement(), false);
46422        composeDateTimeExtras("date", element.getDateElement(), false);
46423      }
46424      if (element.hasPublisherElement()) {
46425        composeStringCore("publisher", element.getPublisherElement(), false);
46426        composeStringExtras("publisher", element.getPublisherElement(), false);
46427      }
46428      if (element.hasContact()) {
46429        openArray("contact");
46430        for (ContactDetail e : element.getContact()) 
46431          composeContactDetail(null, e);
46432        closeArray();
46433      };
46434      if (element.hasResponsibleElement()) {
46435        composeStringCore("responsible", element.getResponsibleElement(), false);
46436        composeStringExtras("responsible", element.getResponsibleElement(), false);
46437      }
46438      if (element.hasType()) {
46439        composeCodeableConcept("type", element.getType());
46440      }
46441      if (element.hasDescriptionElement()) {
46442        composeMarkdownCore("description", element.getDescriptionElement(), false);
46443        composeMarkdownExtras("description", element.getDescriptionElement(), false);
46444      }
46445      if (element.hasUseContext()) {
46446        openArray("useContext");
46447        for (UsageContext e : element.getUseContext()) 
46448          composeUsageContext(null, e);
46449        closeArray();
46450      };
46451      if (element.hasJurisdiction()) {
46452        openArray("jurisdiction");
46453        for (CodeableConcept e : element.getJurisdiction()) 
46454          composeCodeableConcept(null, e);
46455        closeArray();
46456      };
46457      if (element.hasUsageElement()) {
46458        composeStringCore("usage", element.getUsageElement(), false);
46459        composeStringExtras("usage", element.getUsageElement(), false);
46460      }
46461      if (element.hasUniqueId()) {
46462        openArray("uniqueId");
46463        for (NamingSystem.NamingSystemUniqueIdComponent e : element.getUniqueId()) 
46464          composeNamingSystemNamingSystemUniqueIdComponent(null, e);
46465        closeArray();
46466      };
46467  }
46468
46469  protected void composeNamingSystemNamingSystemUniqueIdComponent(String name, NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
46470    if (element != null) {
46471      open(name);
46472      composeNamingSystemNamingSystemUniqueIdComponentInner(element);
46473      close();
46474    }
46475  }
46476
46477  protected void composeNamingSystemNamingSystemUniqueIdComponentInner(NamingSystem.NamingSystemUniqueIdComponent element) throws IOException {
46478      composeBackbone(element);
46479      if (element.hasTypeElement()) {
46480        composeEnumerationCore("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
46481        composeEnumerationExtras("type", element.getTypeElement(), new NamingSystem.NamingSystemIdentifierTypeEnumFactory(), false);
46482      }
46483      if (element.hasValueElement()) {
46484        composeStringCore("value", element.getValueElement(), false);
46485        composeStringExtras("value", element.getValueElement(), false);
46486      }
46487      if (element.hasPreferredElement()) {
46488        composeBooleanCore("preferred", element.getPreferredElement(), false);
46489        composeBooleanExtras("preferred", element.getPreferredElement(), false);
46490      }
46491      if (element.hasCommentElement()) {
46492        composeStringCore("comment", element.getCommentElement(), false);
46493        composeStringExtras("comment", element.getCommentElement(), false);
46494      }
46495      if (element.hasPeriod()) {
46496        composePeriod("period", element.getPeriod());
46497      }
46498  }
46499
46500  protected void composeNutritionOrder(String name, NutritionOrder element) throws IOException {
46501    if (element != null) {
46502      prop("resourceType", name);
46503      composeNutritionOrderInner(element);
46504    }
46505  }
46506
46507  protected void composeNutritionOrderInner(NutritionOrder element) throws IOException {
46508      composeDomainResourceElements(element);
46509      if (element.hasIdentifier()) {
46510        openArray("identifier");
46511        for (Identifier e : element.getIdentifier()) 
46512          composeIdentifier(null, e);
46513        closeArray();
46514      };
46515      if (element.hasInstantiatesCanonical()) {
46516        openArray("instantiatesCanonical");
46517        for (CanonicalType e : element.getInstantiatesCanonical()) 
46518          composeCanonicalCore(null, e, true);
46519        closeArray();
46520        if (anyHasExtras(element.getInstantiatesCanonical())) {
46521          openArray("_instantiatesCanonical");
46522          for (CanonicalType e : element.getInstantiatesCanonical()) 
46523            composeCanonicalExtras(null, e, true);
46524          closeArray();
46525        }
46526      };
46527      if (element.hasInstantiatesUri()) {
46528        openArray("instantiatesUri");
46529        for (UriType e : element.getInstantiatesUri()) 
46530          composeUriCore(null, e, true);
46531        closeArray();
46532        if (anyHasExtras(element.getInstantiatesUri())) {
46533          openArray("_instantiatesUri");
46534          for (UriType e : element.getInstantiatesUri()) 
46535            composeUriExtras(null, e, true);
46536          closeArray();
46537        }
46538      };
46539      if (element.hasInstantiates()) {
46540        openArray("instantiates");
46541        for (UriType e : element.getInstantiates()) 
46542          composeUriCore(null, e, true);
46543        closeArray();
46544        if (anyHasExtras(element.getInstantiates())) {
46545          openArray("_instantiates");
46546          for (UriType e : element.getInstantiates()) 
46547            composeUriExtras(null, e, true);
46548          closeArray();
46549        }
46550      };
46551      if (element.hasStatusElement()) {
46552        composeEnumerationCore("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
46553        composeEnumerationExtras("status", element.getStatusElement(), new NutritionOrder.NutritionOrderStatusEnumFactory(), false);
46554      }
46555      if (element.hasIntentElement()) {
46556        composeEnumerationCore("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
46557        composeEnumerationExtras("intent", element.getIntentElement(), new NutritionOrder.NutritiionOrderIntentEnumFactory(), false);
46558      }
46559      if (element.hasPatient()) {
46560        composeReference("patient", element.getPatient());
46561      }
46562      if (element.hasContext()) {
46563        composeReference("context", element.getContext());
46564      }
46565      if (element.hasDateTimeElement()) {
46566        composeDateTimeCore("dateTime", element.getDateTimeElement(), false);
46567        composeDateTimeExtras("dateTime", element.getDateTimeElement(), false);
46568      }
46569      if (element.hasOrderer()) {
46570        composeReference("orderer", element.getOrderer());
46571      }
46572      if (element.hasAllergyIntolerance()) {
46573        openArray("allergyIntolerance");
46574        for (Reference e : element.getAllergyIntolerance()) 
46575          composeReference(null, e);
46576        closeArray();
46577      };
46578      if (element.hasFoodPreferenceModifier()) {
46579        openArray("foodPreferenceModifier");
46580        for (CodeableConcept e : element.getFoodPreferenceModifier()) 
46581          composeCodeableConcept(null, e);
46582        closeArray();
46583      };
46584      if (element.hasExcludeFoodModifier()) {
46585        openArray("excludeFoodModifier");
46586        for (CodeableConcept e : element.getExcludeFoodModifier()) 
46587          composeCodeableConcept(null, e);
46588        closeArray();
46589      };
46590      if (element.hasOralDiet()) {
46591        composeNutritionOrderNutritionOrderOralDietComponent("oralDiet", element.getOralDiet());
46592      }
46593      if (element.hasSupplement()) {
46594        openArray("supplement");
46595        for (NutritionOrder.NutritionOrderSupplementComponent e : element.getSupplement()) 
46596          composeNutritionOrderNutritionOrderSupplementComponent(null, e);
46597        closeArray();
46598      };
46599      if (element.hasEnteralFormula()) {
46600        composeNutritionOrderNutritionOrderEnteralFormulaComponent("enteralFormula", element.getEnteralFormula());
46601      }
46602      if (element.hasNote()) {
46603        openArray("note");
46604        for (Annotation e : element.getNote()) 
46605          composeAnnotation(null, e);
46606        closeArray();
46607      };
46608  }
46609
46610  protected void composeNutritionOrderNutritionOrderOralDietComponent(String name, NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
46611    if (element != null) {
46612      open(name);
46613      composeNutritionOrderNutritionOrderOralDietComponentInner(element);
46614      close();
46615    }
46616  }
46617
46618  protected void composeNutritionOrderNutritionOrderOralDietComponentInner(NutritionOrder.NutritionOrderOralDietComponent element) throws IOException {
46619      composeBackbone(element);
46620      if (element.hasType()) {
46621        openArray("type");
46622        for (CodeableConcept e : element.getType()) 
46623          composeCodeableConcept(null, e);
46624        closeArray();
46625      };
46626      if (element.hasSchedule()) {
46627        openArray("schedule");
46628        for (Timing e : element.getSchedule()) 
46629          composeTiming(null, e);
46630        closeArray();
46631      };
46632      if (element.hasNutrient()) {
46633        openArray("nutrient");
46634        for (NutritionOrder.NutritionOrderOralDietNutrientComponent e : element.getNutrient()) 
46635          composeNutritionOrderNutritionOrderOralDietNutrientComponent(null, e);
46636        closeArray();
46637      };
46638      if (element.hasTexture()) {
46639        openArray("texture");
46640        for (NutritionOrder.NutritionOrderOralDietTextureComponent e : element.getTexture()) 
46641          composeNutritionOrderNutritionOrderOralDietTextureComponent(null, e);
46642        closeArray();
46643      };
46644      if (element.hasFluidConsistencyType()) {
46645        openArray("fluidConsistencyType");
46646        for (CodeableConcept e : element.getFluidConsistencyType()) 
46647          composeCodeableConcept(null, e);
46648        closeArray();
46649      };
46650      if (element.hasInstructionElement()) {
46651        composeStringCore("instruction", element.getInstructionElement(), false);
46652        composeStringExtras("instruction", element.getInstructionElement(), false);
46653      }
46654  }
46655
46656  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponent(String name, NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
46657    if (element != null) {
46658      open(name);
46659      composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(element);
46660      close();
46661    }
46662  }
46663
46664  protected void composeNutritionOrderNutritionOrderOralDietNutrientComponentInner(NutritionOrder.NutritionOrderOralDietNutrientComponent element) throws IOException {
46665      composeBackbone(element);
46666      if (element.hasModifier()) {
46667        composeCodeableConcept("modifier", element.getModifier());
46668      }
46669      if (element.hasAmount()) {
46670        composeQuantity("amount", element.getAmount());
46671      }
46672  }
46673
46674  protected void composeNutritionOrderNutritionOrderOralDietTextureComponent(String name, NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
46675    if (element != null) {
46676      open(name);
46677      composeNutritionOrderNutritionOrderOralDietTextureComponentInner(element);
46678      close();
46679    }
46680  }
46681
46682  protected void composeNutritionOrderNutritionOrderOralDietTextureComponentInner(NutritionOrder.NutritionOrderOralDietTextureComponent element) throws IOException {
46683      composeBackbone(element);
46684      if (element.hasModifier()) {
46685        composeCodeableConcept("modifier", element.getModifier());
46686      }
46687      if (element.hasFoodType()) {
46688        composeCodeableConcept("foodType", element.getFoodType());
46689      }
46690  }
46691
46692  protected void composeNutritionOrderNutritionOrderSupplementComponent(String name, NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
46693    if (element != null) {
46694      open(name);
46695      composeNutritionOrderNutritionOrderSupplementComponentInner(element);
46696      close();
46697    }
46698  }
46699
46700  protected void composeNutritionOrderNutritionOrderSupplementComponentInner(NutritionOrder.NutritionOrderSupplementComponent element) throws IOException {
46701      composeBackbone(element);
46702      if (element.hasType()) {
46703        composeCodeableConcept("type", element.getType());
46704      }
46705      if (element.hasProductNameElement()) {
46706        composeStringCore("productName", element.getProductNameElement(), false);
46707        composeStringExtras("productName", element.getProductNameElement(), false);
46708      }
46709      if (element.hasSchedule()) {
46710        openArray("schedule");
46711        for (Timing e : element.getSchedule()) 
46712          composeTiming(null, e);
46713        closeArray();
46714      };
46715      if (element.hasQuantity()) {
46716        composeQuantity("quantity", element.getQuantity());
46717      }
46718      if (element.hasInstructionElement()) {
46719        composeStringCore("instruction", element.getInstructionElement(), false);
46720        composeStringExtras("instruction", element.getInstructionElement(), false);
46721      }
46722  }
46723
46724  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
46725    if (element != null) {
46726      open(name);
46727      composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(element);
46728      close();
46729    }
46730  }
46731
46732  protected void composeNutritionOrderNutritionOrderEnteralFormulaComponentInner(NutritionOrder.NutritionOrderEnteralFormulaComponent element) throws IOException {
46733      composeBackbone(element);
46734      if (element.hasBaseFormulaType()) {
46735        composeCodeableConcept("baseFormulaType", element.getBaseFormulaType());
46736      }
46737      if (element.hasBaseFormulaProductNameElement()) {
46738        composeStringCore("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
46739        composeStringExtras("baseFormulaProductName", element.getBaseFormulaProductNameElement(), false);
46740      }
46741      if (element.hasAdditiveType()) {
46742        composeCodeableConcept("additiveType", element.getAdditiveType());
46743      }
46744      if (element.hasAdditiveProductNameElement()) {
46745        composeStringCore("additiveProductName", element.getAdditiveProductNameElement(), false);
46746        composeStringExtras("additiveProductName", element.getAdditiveProductNameElement(), false);
46747      }
46748      if (element.hasCaloricDensity()) {
46749        composeQuantity("caloricDensity", element.getCaloricDensity());
46750      }
46751      if (element.hasRouteofAdministration()) {
46752        composeCodeableConcept("routeofAdministration", element.getRouteofAdministration());
46753      }
46754      if (element.hasAdministration()) {
46755        openArray("administration");
46756        for (NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent e : element.getAdministration()) 
46757          composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(null, e);
46758        closeArray();
46759      };
46760      if (element.hasMaxVolumeToDeliver()) {
46761        composeQuantity("maxVolumeToDeliver", element.getMaxVolumeToDeliver());
46762      }
46763      if (element.hasAdministrationInstructionElement()) {
46764        composeStringCore("administrationInstruction", element.getAdministrationInstructionElement(), false);
46765        composeStringExtras("administrationInstruction", element.getAdministrationInstructionElement(), false);
46766      }
46767  }
46768
46769  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponent(String name, NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
46770    if (element != null) {
46771      open(name);
46772      composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(element);
46773      close();
46774    }
46775  }
46776
46777  protected void composeNutritionOrderNutritionOrderEnteralFormulaAdministrationComponentInner(NutritionOrder.NutritionOrderEnteralFormulaAdministrationComponent element) throws IOException {
46778      composeBackbone(element);
46779      if (element.hasSchedule()) {
46780        composeTiming("schedule", element.getSchedule());
46781      }
46782      if (element.hasQuantity()) {
46783        composeQuantity("quantity", element.getQuantity());
46784      }
46785      if (element.hasRate()) {
46786        composeType("rate", element.getRate());
46787      }
46788  }
46789
46790  protected void composeObservation(String name, Observation element) throws IOException {
46791    if (element != null) {
46792      prop("resourceType", name);
46793      composeObservationInner(element);
46794    }
46795  }
46796
46797  protected void composeObservationInner(Observation element) throws IOException {
46798      composeDomainResourceElements(element);
46799      if (element.hasIdentifier()) {
46800        openArray("identifier");
46801        for (Identifier e : element.getIdentifier()) 
46802          composeIdentifier(null, e);
46803        closeArray();
46804      };
46805      if (element.hasBasedOn()) {
46806        openArray("basedOn");
46807        for (Reference e : element.getBasedOn()) 
46808          composeReference(null, e);
46809        closeArray();
46810      };
46811      if (element.hasPartOf()) {
46812        openArray("partOf");
46813        for (Reference e : element.getPartOf()) 
46814          composeReference(null, e);
46815        closeArray();
46816      };
46817      if (element.hasStatusElement()) {
46818        composeEnumerationCore("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
46819        composeEnumerationExtras("status", element.getStatusElement(), new Observation.ObservationStatusEnumFactory(), false);
46820      }
46821      if (element.hasCategory()) {
46822        openArray("category");
46823        for (CodeableConcept e : element.getCategory()) 
46824          composeCodeableConcept(null, e);
46825        closeArray();
46826      };
46827      if (element.hasCode()) {
46828        composeCodeableConcept("code", element.getCode());
46829      }
46830      if (element.hasSubject()) {
46831        composeReference("subject", element.getSubject());
46832      }
46833      if (element.hasFocus()) {
46834        openArray("focus");
46835        for (Reference e : element.getFocus()) 
46836          composeReference(null, e);
46837        closeArray();
46838      };
46839      if (element.hasEncounter()) {
46840        composeReference("encounter", element.getEncounter());
46841      }
46842      if (element.hasEffective()) {
46843        composeType("effective", element.getEffective());
46844      }
46845      if (element.hasIssuedElement()) {
46846        composeInstantCore("issued", element.getIssuedElement(), false);
46847        composeInstantExtras("issued", element.getIssuedElement(), false);
46848      }
46849      if (element.hasPerformer()) {
46850        openArray("performer");
46851        for (Reference e : element.getPerformer()) 
46852          composeReference(null, e);
46853        closeArray();
46854      };
46855      if (element.hasValue()) {
46856        composeType("value", element.getValue());
46857      }
46858      if (element.hasDataAbsentReason()) {
46859        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
46860      }
46861      if (element.hasInterpretation()) {
46862        openArray("interpretation");
46863        for (CodeableConcept e : element.getInterpretation()) 
46864          composeCodeableConcept(null, e);
46865        closeArray();
46866      };
46867      if (element.hasCommentElement()) {
46868        composeStringCore("comment", element.getCommentElement(), false);
46869        composeStringExtras("comment", element.getCommentElement(), false);
46870      }
46871      if (element.hasBodySite()) {
46872        composeCodeableConcept("bodySite", element.getBodySite());
46873      }
46874      if (element.hasMethod()) {
46875        composeCodeableConcept("method", element.getMethod());
46876      }
46877      if (element.hasSpecimen()) {
46878        composeReference("specimen", element.getSpecimen());
46879      }
46880      if (element.hasDevice()) {
46881        composeReference("device", element.getDevice());
46882      }
46883      if (element.hasReferenceRange()) {
46884        openArray("referenceRange");
46885        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
46886          composeObservationObservationReferenceRangeComponent(null, e);
46887        closeArray();
46888      };
46889      if (element.hasHasMember()) {
46890        openArray("hasMember");
46891        for (Reference e : element.getHasMember()) 
46892          composeReference(null, e);
46893        closeArray();
46894      };
46895      if (element.hasDerivedFrom()) {
46896        openArray("derivedFrom");
46897        for (Reference e : element.getDerivedFrom()) 
46898          composeReference(null, e);
46899        closeArray();
46900      };
46901      if (element.hasComponent()) {
46902        openArray("component");
46903        for (Observation.ObservationComponentComponent e : element.getComponent()) 
46904          composeObservationObservationComponentComponent(null, e);
46905        closeArray();
46906      };
46907  }
46908
46909  protected void composeObservationObservationReferenceRangeComponent(String name, Observation.ObservationReferenceRangeComponent element) throws IOException {
46910    if (element != null) {
46911      open(name);
46912      composeObservationObservationReferenceRangeComponentInner(element);
46913      close();
46914    }
46915  }
46916
46917  protected void composeObservationObservationReferenceRangeComponentInner(Observation.ObservationReferenceRangeComponent element) throws IOException {
46918      composeBackbone(element);
46919      if (element.hasLow()) {
46920        composeQuantity("low", element.getLow());
46921      }
46922      if (element.hasHigh()) {
46923        composeQuantity("high", element.getHigh());
46924      }
46925      if (element.hasType()) {
46926        composeCodeableConcept("type", element.getType());
46927      }
46928      if (element.hasAppliesTo()) {
46929        openArray("appliesTo");
46930        for (CodeableConcept e : element.getAppliesTo()) 
46931          composeCodeableConcept(null, e);
46932        closeArray();
46933      };
46934      if (element.hasAge()) {
46935        composeRange("age", element.getAge());
46936      }
46937      if (element.hasTextElement()) {
46938        composeStringCore("text", element.getTextElement(), false);
46939        composeStringExtras("text", element.getTextElement(), false);
46940      }
46941  }
46942
46943  protected void composeObservationObservationComponentComponent(String name, Observation.ObservationComponentComponent element) throws IOException {
46944    if (element != null) {
46945      open(name);
46946      composeObservationObservationComponentComponentInner(element);
46947      close();
46948    }
46949  }
46950
46951  protected void composeObservationObservationComponentComponentInner(Observation.ObservationComponentComponent element) throws IOException {
46952      composeBackbone(element);
46953      if (element.hasCode()) {
46954        composeCodeableConcept("code", element.getCode());
46955      }
46956      if (element.hasValue()) {
46957        composeType("value", element.getValue());
46958      }
46959      if (element.hasDataAbsentReason()) {
46960        composeCodeableConcept("dataAbsentReason", element.getDataAbsentReason());
46961      }
46962      if (element.hasInterpretation()) {
46963        openArray("interpretation");
46964        for (CodeableConcept e : element.getInterpretation()) 
46965          composeCodeableConcept(null, e);
46966        closeArray();
46967      };
46968      if (element.hasReferenceRange()) {
46969        openArray("referenceRange");
46970        for (Observation.ObservationReferenceRangeComponent e : element.getReferenceRange()) 
46971          composeObservationObservationReferenceRangeComponent(null, e);
46972        closeArray();
46973      };
46974  }
46975
46976  protected void composeObservationDefinition(String name, ObservationDefinition element) throws IOException {
46977    if (element != null) {
46978      prop("resourceType", name);
46979      composeObservationDefinitionInner(element);
46980    }
46981  }
46982
46983  protected void composeObservationDefinitionInner(ObservationDefinition element) throws IOException {
46984      composeDomainResourceElements(element);
46985      if (element.hasCategory()) {
46986        composeCodeableConcept("category", element.getCategory());
46987      }
46988      if (element.hasCode()) {
46989        composeCodeableConcept("code", element.getCode());
46990      }
46991      if (element.hasIdentifier()) {
46992        openArray("identifier");
46993        for (Identifier e : element.getIdentifier()) 
46994          composeIdentifier(null, e);
46995        closeArray();
46996      };
46997      if (element.hasPermittedDataType()) {
46998        openArray("permittedDataType");
46999        for (Coding e : element.getPermittedDataType()) 
47000          composeCoding(null, e);
47001        closeArray();
47002      };
47003      if (element.hasMultipleResultsAllowedElement()) {
47004        composeBooleanCore("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
47005        composeBooleanExtras("multipleResultsAllowed", element.getMultipleResultsAllowedElement(), false);
47006      }
47007      if (element.hasMethod()) {
47008        composeCodeableConcept("method", element.getMethod());
47009      }
47010      if (element.hasPreferredReportNameElement()) {
47011        composeStringCore("preferredReportName", element.getPreferredReportNameElement(), false);
47012        composeStringExtras("preferredReportName", element.getPreferredReportNameElement(), false);
47013      }
47014      if (element.hasQuantitativeDetails()) {
47015        composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent("quantitativeDetails", element.getQuantitativeDetails());
47016      }
47017      if (element.hasQualifiedInterval()) {
47018        openArray("qualifiedInterval");
47019        for (ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent e : element.getQualifiedInterval()) 
47020          composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(null, e);
47021        closeArray();
47022      };
47023      if (element.hasValidCodedValueSetElement()) {
47024        composeUriCore("validCodedValueSet", element.getValidCodedValueSetElement(), false);
47025        composeUriExtras("validCodedValueSet", element.getValidCodedValueSetElement(), false);
47026      }
47027      if (element.hasNormalCodedValueSetElement()) {
47028        composeUriCore("normalCodedValueSet", element.getNormalCodedValueSetElement(), false);
47029        composeUriExtras("normalCodedValueSet", element.getNormalCodedValueSetElement(), false);
47030      }
47031      if (element.hasAbnormalCodedValueSetElement()) {
47032        composeUriCore("abnormalCodedValueSet", element.getAbnormalCodedValueSetElement(), false);
47033        composeUriExtras("abnormalCodedValueSet", element.getAbnormalCodedValueSetElement(), false);
47034      }
47035      if (element.hasCriticalCodedValueSetElement()) {
47036        composeUriCore("criticalCodedValueSet", element.getCriticalCodedValueSetElement(), false);
47037        composeUriExtras("criticalCodedValueSet", element.getCriticalCodedValueSetElement(), false);
47038      }
47039  }
47040
47041  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponent(String name, ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
47042    if (element != null) {
47043      open(name);
47044      composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(element);
47045      close();
47046    }
47047  }
47048
47049  protected void composeObservationDefinitionObservationDefinitionQuantitativeDetailsComponentInner(ObservationDefinition.ObservationDefinitionQuantitativeDetailsComponent element) throws IOException {
47050      composeBackbone(element);
47051      if (element.hasCustomaryUnit()) {
47052        composeCoding("customaryUnit", element.getCustomaryUnit());
47053      }
47054      if (element.hasUnit()) {
47055        composeCoding("unit", element.getUnit());
47056      }
47057      if (element.hasConversionFactorElement()) {
47058        composeDecimalCore("conversionFactor", element.getConversionFactorElement(), false);
47059        composeDecimalExtras("conversionFactor", element.getConversionFactorElement(), false);
47060      }
47061      if (element.hasDecimalPrecisionElement()) {
47062        composeIntegerCore("decimalPrecision", element.getDecimalPrecisionElement(), false);
47063        composeIntegerExtras("decimalPrecision", element.getDecimalPrecisionElement(), false);
47064      }
47065  }
47066
47067  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponent(String name, ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
47068    if (element != null) {
47069      open(name);
47070      composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(element);
47071      close();
47072    }
47073  }
47074
47075  protected void composeObservationDefinitionObservationDefinitionQualifiedIntervalComponentInner(ObservationDefinition.ObservationDefinitionQualifiedIntervalComponent element) throws IOException {
47076      composeBackbone(element);
47077      if (element.hasCategory()) {
47078        composeCodeableConcept("category", element.getCategory());
47079      }
47080      if (element.hasRange()) {
47081        composeRange("range", element.getRange());
47082      }
47083      if (element.hasType()) {
47084        composeCodeableConcept("type", element.getType());
47085      }
47086      if (element.hasAppliesTo()) {
47087        openArray("appliesTo");
47088        for (CodeableConcept e : element.getAppliesTo()) 
47089          composeCodeableConcept(null, e);
47090        closeArray();
47091      };
47092      if (element.hasAge()) {
47093        composeRange("age", element.getAge());
47094      }
47095      if (element.hasGestationalAge()) {
47096        composeRange("gestationalAge", element.getGestationalAge());
47097      }
47098      if (element.hasConditionElement()) {
47099        composeStringCore("condition", element.getConditionElement(), false);
47100        composeStringExtras("condition", element.getConditionElement(), false);
47101      }
47102  }
47103
47104  protected void composeOperationDefinition(String name, OperationDefinition element) throws IOException {
47105    if (element != null) {
47106      prop("resourceType", name);
47107      composeOperationDefinitionInner(element);
47108    }
47109  }
47110
47111  protected void composeOperationDefinitionInner(OperationDefinition element) throws IOException {
47112      composeDomainResourceElements(element);
47113      if (element.hasUrlElement()) {
47114        composeUriCore("url", element.getUrlElement(), false);
47115        composeUriExtras("url", element.getUrlElement(), false);
47116      }
47117      if (element.hasVersionElement()) {
47118        composeStringCore("version", element.getVersionElement(), false);
47119        composeStringExtras("version", element.getVersionElement(), false);
47120      }
47121      if (element.hasNameElement()) {
47122        composeStringCore("name", element.getNameElement(), false);
47123        composeStringExtras("name", element.getNameElement(), false);
47124      }
47125      if (element.hasTitleElement()) {
47126        composeStringCore("title", element.getTitleElement(), false);
47127        composeStringExtras("title", element.getTitleElement(), false);
47128      }
47129      if (element.hasStatusElement()) {
47130        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47131        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
47132      }
47133      if (element.hasKindElement()) {
47134        composeEnumerationCore("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
47135        composeEnumerationExtras("kind", element.getKindElement(), new OperationDefinition.OperationKindEnumFactory(), false);
47136      }
47137      if (element.hasExperimentalElement()) {
47138        composeBooleanCore("experimental", element.getExperimentalElement(), false);
47139        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
47140      }
47141      if (element.hasDateElement()) {
47142        composeDateTimeCore("date", element.getDateElement(), false);
47143        composeDateTimeExtras("date", element.getDateElement(), false);
47144      }
47145      if (element.hasPublisherElement()) {
47146        composeStringCore("publisher", element.getPublisherElement(), false);
47147        composeStringExtras("publisher", element.getPublisherElement(), false);
47148      }
47149      if (element.hasContact()) {
47150        openArray("contact");
47151        for (ContactDetail e : element.getContact()) 
47152          composeContactDetail(null, e);
47153        closeArray();
47154      };
47155      if (element.hasDescriptionElement()) {
47156        composeMarkdownCore("description", element.getDescriptionElement(), false);
47157        composeMarkdownExtras("description", element.getDescriptionElement(), false);
47158      }
47159      if (element.hasUseContext()) {
47160        openArray("useContext");
47161        for (UsageContext e : element.getUseContext()) 
47162          composeUsageContext(null, e);
47163        closeArray();
47164      };
47165      if (element.hasJurisdiction()) {
47166        openArray("jurisdiction");
47167        for (CodeableConcept e : element.getJurisdiction()) 
47168          composeCodeableConcept(null, e);
47169        closeArray();
47170      };
47171      if (element.hasPurposeElement()) {
47172        composeMarkdownCore("purpose", element.getPurposeElement(), false);
47173        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
47174      }
47175      if (element.hasAffectsStateElement()) {
47176        composeBooleanCore("affectsState", element.getAffectsStateElement(), false);
47177        composeBooleanExtras("affectsState", element.getAffectsStateElement(), false);
47178      }
47179      if (element.hasCodeElement()) {
47180        composeCodeCore("code", element.getCodeElement(), false);
47181        composeCodeExtras("code", element.getCodeElement(), false);
47182      }
47183      if (element.hasCommentElement()) {
47184        composeMarkdownCore("comment", element.getCommentElement(), false);
47185        composeMarkdownExtras("comment", element.getCommentElement(), false);
47186      }
47187      if (element.hasBaseElement()) {
47188        composeCanonicalCore("base", element.getBaseElement(), false);
47189        composeCanonicalExtras("base", element.getBaseElement(), false);
47190      }
47191      if (element.hasResource()) {
47192        openArray("resource");
47193        for (CodeType e : element.getResource()) 
47194          composeCodeCore(null, e, true);
47195        closeArray();
47196        if (anyHasExtras(element.getResource())) {
47197          openArray("_resource");
47198          for (CodeType e : element.getResource()) 
47199            composeCodeExtras(null, e, true);
47200          closeArray();
47201        }
47202      };
47203      if (element.hasSystemElement()) {
47204        composeBooleanCore("system", element.getSystemElement(), false);
47205        composeBooleanExtras("system", element.getSystemElement(), false);
47206      }
47207      if (element.hasTypeElement()) {
47208        composeBooleanCore("type", element.getTypeElement(), false);
47209        composeBooleanExtras("type", element.getTypeElement(), false);
47210      }
47211      if (element.hasInstanceElement()) {
47212        composeBooleanCore("instance", element.getInstanceElement(), false);
47213        composeBooleanExtras("instance", element.getInstanceElement(), false);
47214      }
47215      if (element.hasInputProfileElement()) {
47216        composeCanonicalCore("inputProfile", element.getInputProfileElement(), false);
47217        composeCanonicalExtras("inputProfile", element.getInputProfileElement(), false);
47218      }
47219      if (element.hasOutputProfileElement()) {
47220        composeCanonicalCore("outputProfile", element.getOutputProfileElement(), false);
47221        composeCanonicalExtras("outputProfile", element.getOutputProfileElement(), false);
47222      }
47223      if (element.hasParameter()) {
47224        openArray("parameter");
47225        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getParameter()) 
47226          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
47227        closeArray();
47228      };
47229      if (element.hasOverload()) {
47230        openArray("overload");
47231        for (OperationDefinition.OperationDefinitionOverloadComponent e : element.getOverload()) 
47232          composeOperationDefinitionOperationDefinitionOverloadComponent(null, e);
47233        closeArray();
47234      };
47235  }
47236
47237  protected void composeOperationDefinitionOperationDefinitionParameterComponent(String name, OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
47238    if (element != null) {
47239      open(name);
47240      composeOperationDefinitionOperationDefinitionParameterComponentInner(element);
47241      close();
47242    }
47243  }
47244
47245  protected void composeOperationDefinitionOperationDefinitionParameterComponentInner(OperationDefinition.OperationDefinitionParameterComponent element) throws IOException {
47246      composeBackbone(element);
47247      if (element.hasNameElement()) {
47248        composeCodeCore("name", element.getNameElement(), false);
47249        composeCodeExtras("name", element.getNameElement(), false);
47250      }
47251      if (element.hasUseElement()) {
47252        composeEnumerationCore("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
47253        composeEnumerationExtras("use", element.getUseElement(), new OperationDefinition.OperationParameterUseEnumFactory(), false);
47254      }
47255      if (element.hasMinElement()) {
47256        composeIntegerCore("min", element.getMinElement(), false);
47257        composeIntegerExtras("min", element.getMinElement(), false);
47258      }
47259      if (element.hasMaxElement()) {
47260        composeStringCore("max", element.getMaxElement(), false);
47261        composeStringExtras("max", element.getMaxElement(), false);
47262      }
47263      if (element.hasDocumentationElement()) {
47264        composeStringCore("documentation", element.getDocumentationElement(), false);
47265        composeStringExtras("documentation", element.getDocumentationElement(), false);
47266      }
47267      if (element.hasTypeElement()) {
47268        composeCodeCore("type", element.getTypeElement(), false);
47269        composeCodeExtras("type", element.getTypeElement(), false);
47270      }
47271      if (element.hasTargetProfile()) {
47272        openArray("targetProfile");
47273        for (CanonicalType e : element.getTargetProfile()) 
47274          composeCanonicalCore(null, e, true);
47275        closeArray();
47276        if (anyHasExtras(element.getTargetProfile())) {
47277          openArray("_targetProfile");
47278          for (CanonicalType e : element.getTargetProfile()) 
47279            composeCanonicalExtras(null, e, true);
47280          closeArray();
47281        }
47282      };
47283      if (element.hasSearchTypeElement()) {
47284        composeEnumerationCore("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
47285        composeEnumerationExtras("searchType", element.getSearchTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
47286      }
47287      if (element.hasBinding()) {
47288        composeOperationDefinitionOperationDefinitionParameterBindingComponent("binding", element.getBinding());
47289      }
47290      if (element.hasReferencedFrom()) {
47291        openArray("referencedFrom");
47292        for (OperationDefinition.OperationDefinitionParameterReferencedFromComponent e : element.getReferencedFrom()) 
47293          composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(null, e);
47294        closeArray();
47295      };
47296      if (element.hasPart()) {
47297        openArray("part");
47298        for (OperationDefinition.OperationDefinitionParameterComponent e : element.getPart()) 
47299          composeOperationDefinitionOperationDefinitionParameterComponent(null, e);
47300        closeArray();
47301      };
47302  }
47303
47304  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponent(String name, OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
47305    if (element != null) {
47306      open(name);
47307      composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(element);
47308      close();
47309    }
47310  }
47311
47312  protected void composeOperationDefinitionOperationDefinitionParameterBindingComponentInner(OperationDefinition.OperationDefinitionParameterBindingComponent element) throws IOException {
47313      composeBackbone(element);
47314      if (element.hasStrengthElement()) {
47315        composeEnumerationCore("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
47316        composeEnumerationExtras("strength", element.getStrengthElement(), new Enumerations.BindingStrengthEnumFactory(), false);
47317      }
47318      if (element.hasValueSetElement()) {
47319        composeCanonicalCore("valueSet", element.getValueSetElement(), false);
47320        composeCanonicalExtras("valueSet", element.getValueSetElement(), false);
47321      }
47322  }
47323
47324  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponent(String name, OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
47325    if (element != null) {
47326      open(name);
47327      composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(element);
47328      close();
47329    }
47330  }
47331
47332  protected void composeOperationDefinitionOperationDefinitionParameterReferencedFromComponentInner(OperationDefinition.OperationDefinitionParameterReferencedFromComponent element) throws IOException {
47333      composeBackbone(element);
47334      if (element.hasSourceElement()) {
47335        composeStringCore("source", element.getSourceElement(), false);
47336        composeStringExtras("source", element.getSourceElement(), false);
47337      }
47338      if (element.hasSourceIdElement()) {
47339        composeStringCore("sourceId", element.getSourceIdElement(), false);
47340        composeStringExtras("sourceId", element.getSourceIdElement(), false);
47341      }
47342  }
47343
47344  protected void composeOperationDefinitionOperationDefinitionOverloadComponent(String name, OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
47345    if (element != null) {
47346      open(name);
47347      composeOperationDefinitionOperationDefinitionOverloadComponentInner(element);
47348      close();
47349    }
47350  }
47351
47352  protected void composeOperationDefinitionOperationDefinitionOverloadComponentInner(OperationDefinition.OperationDefinitionOverloadComponent element) throws IOException {
47353      composeBackbone(element);
47354      if (element.hasParameterName()) {
47355        openArray("parameterName");
47356        for (StringType e : element.getParameterName()) 
47357          composeStringCore(null, e, true);
47358        closeArray();
47359        if (anyHasExtras(element.getParameterName())) {
47360          openArray("_parameterName");
47361          for (StringType e : element.getParameterName()) 
47362            composeStringExtras(null, e, true);
47363          closeArray();
47364        }
47365      };
47366      if (element.hasCommentElement()) {
47367        composeStringCore("comment", element.getCommentElement(), false);
47368        composeStringExtras("comment", element.getCommentElement(), false);
47369      }
47370  }
47371
47372  protected void composeOperationOutcome(String name, OperationOutcome element) throws IOException {
47373    if (element != null) {
47374      prop("resourceType", name);
47375      composeOperationOutcomeInner(element);
47376    }
47377  }
47378
47379  protected void composeOperationOutcomeInner(OperationOutcome element) throws IOException {
47380      composeDomainResourceElements(element);
47381      if (element.hasIssue()) {
47382        openArray("issue");
47383        for (OperationOutcome.OperationOutcomeIssueComponent e : element.getIssue()) 
47384          composeOperationOutcomeOperationOutcomeIssueComponent(null, e);
47385        closeArray();
47386      };
47387  }
47388
47389  protected void composeOperationOutcomeOperationOutcomeIssueComponent(String name, OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
47390    if (element != null) {
47391      open(name);
47392      composeOperationOutcomeOperationOutcomeIssueComponentInner(element);
47393      close();
47394    }
47395  }
47396
47397  protected void composeOperationOutcomeOperationOutcomeIssueComponentInner(OperationOutcome.OperationOutcomeIssueComponent element) throws IOException {
47398      composeBackbone(element);
47399      if (element.hasSeverityElement()) {
47400        composeEnumerationCore("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
47401        composeEnumerationExtras("severity", element.getSeverityElement(), new OperationOutcome.IssueSeverityEnumFactory(), false);
47402      }
47403      if (element.hasCodeElement()) {
47404        composeEnumerationCore("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
47405        composeEnumerationExtras("code", element.getCodeElement(), new OperationOutcome.IssueTypeEnumFactory(), false);
47406      }
47407      if (element.hasDetails()) {
47408        composeCodeableConcept("details", element.getDetails());
47409      }
47410      if (element.hasDiagnosticsElement()) {
47411        composeStringCore("diagnostics", element.getDiagnosticsElement(), false);
47412        composeStringExtras("diagnostics", element.getDiagnosticsElement(), false);
47413      }
47414      if (element.hasLocation()) {
47415        openArray("location");
47416        for (StringType e : element.getLocation()) 
47417          composeStringCore(null, e, true);
47418        closeArray();
47419        if (anyHasExtras(element.getLocation())) {
47420          openArray("_location");
47421          for (StringType e : element.getLocation()) 
47422            composeStringExtras(null, e, true);
47423          closeArray();
47424        }
47425      };
47426      if (element.hasExpression()) {
47427        openArray("expression");
47428        for (StringType e : element.getExpression()) 
47429          composeStringCore(null, e, true);
47430        closeArray();
47431        if (anyHasExtras(element.getExpression())) {
47432          openArray("_expression");
47433          for (StringType e : element.getExpression()) 
47434            composeStringExtras(null, e, true);
47435          closeArray();
47436        }
47437      };
47438  }
47439
47440  protected void composeOrganization(String name, Organization element) throws IOException {
47441    if (element != null) {
47442      prop("resourceType", name);
47443      composeOrganizationInner(element);
47444    }
47445  }
47446
47447  protected void composeOrganizationInner(Organization element) throws IOException {
47448      composeDomainResourceElements(element);
47449      if (element.hasIdentifier()) {
47450        openArray("identifier");
47451        for (Identifier e : element.getIdentifier()) 
47452          composeIdentifier(null, e);
47453        closeArray();
47454      };
47455      if (element.hasActiveElement()) {
47456        composeBooleanCore("active", element.getActiveElement(), false);
47457        composeBooleanExtras("active", element.getActiveElement(), false);
47458      }
47459      if (element.hasType()) {
47460        openArray("type");
47461        for (CodeableConcept e : element.getType()) 
47462          composeCodeableConcept(null, e);
47463        closeArray();
47464      };
47465      if (element.hasNameElement()) {
47466        composeStringCore("name", element.getNameElement(), false);
47467        composeStringExtras("name", element.getNameElement(), false);
47468      }
47469      if (element.hasAlias()) {
47470        openArray("alias");
47471        for (StringType e : element.getAlias()) 
47472          composeStringCore(null, e, true);
47473        closeArray();
47474        if (anyHasExtras(element.getAlias())) {
47475          openArray("_alias");
47476          for (StringType e : element.getAlias()) 
47477            composeStringExtras(null, e, true);
47478          closeArray();
47479        }
47480      };
47481      if (element.hasTelecom()) {
47482        openArray("telecom");
47483        for (ContactPoint e : element.getTelecom()) 
47484          composeContactPoint(null, e);
47485        closeArray();
47486      };
47487      if (element.hasAddress()) {
47488        openArray("address");
47489        for (Address e : element.getAddress()) 
47490          composeAddress(null, e);
47491        closeArray();
47492      };
47493      if (element.hasPartOf()) {
47494        composeReference("partOf", element.getPartOf());
47495      }
47496      if (element.hasContact()) {
47497        openArray("contact");
47498        for (Organization.OrganizationContactComponent e : element.getContact()) 
47499          composeOrganizationOrganizationContactComponent(null, e);
47500        closeArray();
47501      };
47502      if (element.hasEndpoint()) {
47503        openArray("endpoint");
47504        for (Reference e : element.getEndpoint()) 
47505          composeReference(null, e);
47506        closeArray();
47507      };
47508  }
47509
47510  protected void composeOrganizationOrganizationContactComponent(String name, Organization.OrganizationContactComponent element) throws IOException {
47511    if (element != null) {
47512      open(name);
47513      composeOrganizationOrganizationContactComponentInner(element);
47514      close();
47515    }
47516  }
47517
47518  protected void composeOrganizationOrganizationContactComponentInner(Organization.OrganizationContactComponent element) throws IOException {
47519      composeBackbone(element);
47520      if (element.hasPurpose()) {
47521        composeCodeableConcept("purpose", element.getPurpose());
47522      }
47523      if (element.hasName()) {
47524        composeHumanName("name", element.getName());
47525      }
47526      if (element.hasTelecom()) {
47527        openArray("telecom");
47528        for (ContactPoint e : element.getTelecom()) 
47529          composeContactPoint(null, e);
47530        closeArray();
47531      };
47532      if (element.hasAddress()) {
47533        composeAddress("address", element.getAddress());
47534      }
47535  }
47536
47537  protected void composeOrganizationAffiliation(String name, OrganizationAffiliation element) throws IOException {
47538    if (element != null) {
47539      prop("resourceType", name);
47540      composeOrganizationAffiliationInner(element);
47541    }
47542  }
47543
47544  protected void composeOrganizationAffiliationInner(OrganizationAffiliation element) throws IOException {
47545      composeDomainResourceElements(element);
47546      if (element.hasIdentifier()) {
47547        openArray("identifier");
47548        for (Identifier e : element.getIdentifier()) 
47549          composeIdentifier(null, e);
47550        closeArray();
47551      };
47552      if (element.hasActiveElement()) {
47553        composeBooleanCore("active", element.getActiveElement(), false);
47554        composeBooleanExtras("active", element.getActiveElement(), false);
47555      }
47556      if (element.hasPeriod()) {
47557        composePeriod("period", element.getPeriod());
47558      }
47559      if (element.hasOrganization()) {
47560        composeReference("organization", element.getOrganization());
47561      }
47562      if (element.hasParticipatingOrganization()) {
47563        composeReference("participatingOrganization", element.getParticipatingOrganization());
47564      }
47565      if (element.hasNetwork()) {
47566        openArray("network");
47567        for (Reference e : element.getNetwork()) 
47568          composeReference(null, e);
47569        closeArray();
47570      };
47571      if (element.hasCode()) {
47572        openArray("code");
47573        for (CodeableConcept e : element.getCode()) 
47574          composeCodeableConcept(null, e);
47575        closeArray();
47576      };
47577      if (element.hasSpecialty()) {
47578        openArray("specialty");
47579        for (CodeableConcept e : element.getSpecialty()) 
47580          composeCodeableConcept(null, e);
47581        closeArray();
47582      };
47583      if (element.hasLocation()) {
47584        openArray("location");
47585        for (Reference e : element.getLocation()) 
47586          composeReference(null, e);
47587        closeArray();
47588      };
47589      if (element.hasHealthcareService()) {
47590        openArray("healthcareService");
47591        for (Reference e : element.getHealthcareService()) 
47592          composeReference(null, e);
47593        closeArray();
47594      };
47595      if (element.hasTelecom()) {
47596        openArray("telecom");
47597        for (ContactPoint e : element.getTelecom()) 
47598          composeContactPoint(null, e);
47599        closeArray();
47600      };
47601      if (element.hasEndpoint()) {
47602        openArray("endpoint");
47603        for (Reference e : element.getEndpoint()) 
47604          composeReference(null, e);
47605        closeArray();
47606      };
47607  }
47608
47609  protected void composePatient(String name, Patient element) throws IOException {
47610    if (element != null) {
47611      prop("resourceType", name);
47612      composePatientInner(element);
47613    }
47614  }
47615
47616  protected void composePatientInner(Patient element) throws IOException {
47617      composeDomainResourceElements(element);
47618      if (element.hasIdentifier()) {
47619        openArray("identifier");
47620        for (Identifier e : element.getIdentifier()) 
47621          composeIdentifier(null, e);
47622        closeArray();
47623      };
47624      if (element.hasActiveElement()) {
47625        composeBooleanCore("active", element.getActiveElement(), false);
47626        composeBooleanExtras("active", element.getActiveElement(), false);
47627      }
47628      if (element.hasName()) {
47629        openArray("name");
47630        for (HumanName e : element.getName()) 
47631          composeHumanName(null, e);
47632        closeArray();
47633      };
47634      if (element.hasTelecom()) {
47635        openArray("telecom");
47636        for (ContactPoint e : element.getTelecom()) 
47637          composeContactPoint(null, e);
47638        closeArray();
47639      };
47640      if (element.hasGenderElement()) {
47641        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
47642        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
47643      }
47644      if (element.hasBirthDateElement()) {
47645        composeDateCore("birthDate", element.getBirthDateElement(), false);
47646        composeDateExtras("birthDate", element.getBirthDateElement(), false);
47647      }
47648      if (element.hasDeceased()) {
47649        composeType("deceased", element.getDeceased());
47650      }
47651      if (element.hasAddress()) {
47652        openArray("address");
47653        for (Address e : element.getAddress()) 
47654          composeAddress(null, e);
47655        closeArray();
47656      };
47657      if (element.hasMaritalStatus()) {
47658        composeCodeableConcept("maritalStatus", element.getMaritalStatus());
47659      }
47660      if (element.hasMultipleBirth()) {
47661        composeType("multipleBirth", element.getMultipleBirth());
47662      }
47663      if (element.hasPhoto()) {
47664        openArray("photo");
47665        for (Attachment e : element.getPhoto()) 
47666          composeAttachment(null, e);
47667        closeArray();
47668      };
47669      if (element.hasContact()) {
47670        openArray("contact");
47671        for (Patient.ContactComponent e : element.getContact()) 
47672          composePatientContactComponent(null, e);
47673        closeArray();
47674      };
47675      if (element.hasCommunication()) {
47676        openArray("communication");
47677        for (Patient.PatientCommunicationComponent e : element.getCommunication()) 
47678          composePatientPatientCommunicationComponent(null, e);
47679        closeArray();
47680      };
47681      if (element.hasGeneralPractitioner()) {
47682        openArray("generalPractitioner");
47683        for (Reference e : element.getGeneralPractitioner()) 
47684          composeReference(null, e);
47685        closeArray();
47686      };
47687      if (element.hasManagingOrganization()) {
47688        composeReference("managingOrganization", element.getManagingOrganization());
47689      }
47690      if (element.hasLink()) {
47691        openArray("link");
47692        for (Patient.PatientLinkComponent e : element.getLink()) 
47693          composePatientPatientLinkComponent(null, e);
47694        closeArray();
47695      };
47696  }
47697
47698  protected void composePatientContactComponent(String name, Patient.ContactComponent element) throws IOException {
47699    if (element != null) {
47700      open(name);
47701      composePatientContactComponentInner(element);
47702      close();
47703    }
47704  }
47705
47706  protected void composePatientContactComponentInner(Patient.ContactComponent element) throws IOException {
47707      composeBackbone(element);
47708      if (element.hasRelationship()) {
47709        openArray("relationship");
47710        for (CodeableConcept e : element.getRelationship()) 
47711          composeCodeableConcept(null, e);
47712        closeArray();
47713      };
47714      if (element.hasName()) {
47715        composeHumanName("name", element.getName());
47716      }
47717      if (element.hasTelecom()) {
47718        openArray("telecom");
47719        for (ContactPoint e : element.getTelecom()) 
47720          composeContactPoint(null, e);
47721        closeArray();
47722      };
47723      if (element.hasAddress()) {
47724        composeAddress("address", element.getAddress());
47725      }
47726      if (element.hasGenderElement()) {
47727        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
47728        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
47729      }
47730      if (element.hasOrganization()) {
47731        composeReference("organization", element.getOrganization());
47732      }
47733      if (element.hasPeriod()) {
47734        composePeriod("period", element.getPeriod());
47735      }
47736  }
47737
47738  protected void composePatientPatientCommunicationComponent(String name, Patient.PatientCommunicationComponent element) throws IOException {
47739    if (element != null) {
47740      open(name);
47741      composePatientPatientCommunicationComponentInner(element);
47742      close();
47743    }
47744  }
47745
47746  protected void composePatientPatientCommunicationComponentInner(Patient.PatientCommunicationComponent element) throws IOException {
47747      composeBackbone(element);
47748      if (element.hasLanguage()) {
47749        composeCodeableConcept("language", element.getLanguage());
47750      }
47751      if (element.hasPreferredElement()) {
47752        composeBooleanCore("preferred", element.getPreferredElement(), false);
47753        composeBooleanExtras("preferred", element.getPreferredElement(), false);
47754      }
47755  }
47756
47757  protected void composePatientPatientLinkComponent(String name, Patient.PatientLinkComponent element) throws IOException {
47758    if (element != null) {
47759      open(name);
47760      composePatientPatientLinkComponentInner(element);
47761      close();
47762    }
47763  }
47764
47765  protected void composePatientPatientLinkComponentInner(Patient.PatientLinkComponent element) throws IOException {
47766      composeBackbone(element);
47767      if (element.hasOther()) {
47768        composeReference("other", element.getOther());
47769      }
47770      if (element.hasTypeElement()) {
47771        composeEnumerationCore("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
47772        composeEnumerationExtras("type", element.getTypeElement(), new Patient.LinkTypeEnumFactory(), false);
47773      }
47774  }
47775
47776  protected void composePaymentNotice(String name, PaymentNotice element) throws IOException {
47777    if (element != null) {
47778      prop("resourceType", name);
47779      composePaymentNoticeInner(element);
47780    }
47781  }
47782
47783  protected void composePaymentNoticeInner(PaymentNotice element) throws IOException {
47784      composeDomainResourceElements(element);
47785      if (element.hasIdentifier()) {
47786        openArray("identifier");
47787        for (Identifier e : element.getIdentifier()) 
47788          composeIdentifier(null, e);
47789        closeArray();
47790      };
47791      if (element.hasStatusElement()) {
47792        composeEnumerationCore("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
47793        composeEnumerationExtras("status", element.getStatusElement(), new PaymentNotice.PaymentNoticeStatusEnumFactory(), false);
47794      }
47795      if (element.hasRequest()) {
47796        composeReference("request", element.getRequest());
47797      }
47798      if (element.hasResponse()) {
47799        composeReference("response", element.getResponse());
47800      }
47801      if (element.hasStatusDateElement()) {
47802        composeDateCore("statusDate", element.getStatusDateElement(), false);
47803        composeDateExtras("statusDate", element.getStatusDateElement(), false);
47804      }
47805      if (element.hasCreatedElement()) {
47806        composeDateTimeCore("created", element.getCreatedElement(), false);
47807        composeDateTimeExtras("created", element.getCreatedElement(), false);
47808      }
47809      if (element.hasTarget()) {
47810        composeReference("target", element.getTarget());
47811      }
47812      if (element.hasProvider()) {
47813        composeReference("provider", element.getProvider());
47814      }
47815      if (element.hasPaymentStatus()) {
47816        composeCodeableConcept("paymentStatus", element.getPaymentStatus());
47817      }
47818  }
47819
47820  protected void composePaymentReconciliation(String name, PaymentReconciliation element) throws IOException {
47821    if (element != null) {
47822      prop("resourceType", name);
47823      composePaymentReconciliationInner(element);
47824    }
47825  }
47826
47827  protected void composePaymentReconciliationInner(PaymentReconciliation element) throws IOException {
47828      composeDomainResourceElements(element);
47829      if (element.hasIdentifier()) {
47830        openArray("identifier");
47831        for (Identifier e : element.getIdentifier()) 
47832          composeIdentifier(null, e);
47833        closeArray();
47834      };
47835      if (element.hasStatusElement()) {
47836        composeEnumerationCore("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
47837        composeEnumerationExtras("status", element.getStatusElement(), new PaymentReconciliation.PaymentReconciliationStatusEnumFactory(), false);
47838      }
47839      if (element.hasPeriod()) {
47840        composePeriod("period", element.getPeriod());
47841      }
47842      if (element.hasCreatedElement()) {
47843        composeDateTimeCore("created", element.getCreatedElement(), false);
47844        composeDateTimeExtras("created", element.getCreatedElement(), false);
47845      }
47846      if (element.hasOrganization()) {
47847        composeReference("organization", element.getOrganization());
47848      }
47849      if (element.hasRequest()) {
47850        composeReference("request", element.getRequest());
47851      }
47852      if (element.hasOutcomeElement()) {
47853        composeEnumerationCore("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
47854        composeEnumerationExtras("outcome", element.getOutcomeElement(), new Enumerations.RemittanceOutcomeEnumFactory(), false);
47855      }
47856      if (element.hasDispositionElement()) {
47857        composeStringCore("disposition", element.getDispositionElement(), false);
47858        composeStringExtras("disposition", element.getDispositionElement(), false);
47859      }
47860      if (element.hasRequestProvider()) {
47861        composeReference("requestProvider", element.getRequestProvider());
47862      }
47863      if (element.hasDetail()) {
47864        openArray("detail");
47865        for (PaymentReconciliation.DetailsComponent e : element.getDetail()) 
47866          composePaymentReconciliationDetailsComponent(null, e);
47867        closeArray();
47868      };
47869      if (element.hasForm()) {
47870        composeCodeableConcept("form", element.getForm());
47871      }
47872      if (element.hasTotal()) {
47873        composeMoney("total", element.getTotal());
47874      }
47875      if (element.hasProcessNote()) {
47876        openArray("processNote");
47877        for (PaymentReconciliation.NotesComponent e : element.getProcessNote()) 
47878          composePaymentReconciliationNotesComponent(null, e);
47879        closeArray();
47880      };
47881  }
47882
47883  protected void composePaymentReconciliationDetailsComponent(String name, PaymentReconciliation.DetailsComponent element) throws IOException {
47884    if (element != null) {
47885      open(name);
47886      composePaymentReconciliationDetailsComponentInner(element);
47887      close();
47888    }
47889  }
47890
47891  protected void composePaymentReconciliationDetailsComponentInner(PaymentReconciliation.DetailsComponent element) throws IOException {
47892      composeBackbone(element);
47893      if (element.hasType()) {
47894        composeCodeableConcept("type", element.getType());
47895      }
47896      if (element.hasRequest()) {
47897        composeReference("request", element.getRequest());
47898      }
47899      if (element.hasResponse()) {
47900        composeReference("response", element.getResponse());
47901      }
47902      if (element.hasSubmitter()) {
47903        composeReference("submitter", element.getSubmitter());
47904      }
47905      if (element.hasPayee()) {
47906        composeReference("payee", element.getPayee());
47907      }
47908      if (element.hasDateElement()) {
47909        composeDateCore("date", element.getDateElement(), false);
47910        composeDateExtras("date", element.getDateElement(), false);
47911      }
47912      if (element.hasAmount()) {
47913        composeMoney("amount", element.getAmount());
47914      }
47915  }
47916
47917  protected void composePaymentReconciliationNotesComponent(String name, PaymentReconciliation.NotesComponent element) throws IOException {
47918    if (element != null) {
47919      open(name);
47920      composePaymentReconciliationNotesComponentInner(element);
47921      close();
47922    }
47923  }
47924
47925  protected void composePaymentReconciliationNotesComponentInner(PaymentReconciliation.NotesComponent element) throws IOException {
47926      composeBackbone(element);
47927      if (element.hasTypeElement()) {
47928        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
47929        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
47930      }
47931      if (element.hasTextElement()) {
47932        composeStringCore("text", element.getTextElement(), false);
47933        composeStringExtras("text", element.getTextElement(), false);
47934      }
47935  }
47936
47937  protected void composePerson(String name, Person element) throws IOException {
47938    if (element != null) {
47939      prop("resourceType", name);
47940      composePersonInner(element);
47941    }
47942  }
47943
47944  protected void composePersonInner(Person element) throws IOException {
47945      composeDomainResourceElements(element);
47946      if (element.hasIdentifier()) {
47947        openArray("identifier");
47948        for (Identifier e : element.getIdentifier()) 
47949          composeIdentifier(null, e);
47950        closeArray();
47951      };
47952      if (element.hasName()) {
47953        openArray("name");
47954        for (HumanName e : element.getName()) 
47955          composeHumanName(null, e);
47956        closeArray();
47957      };
47958      if (element.hasTelecom()) {
47959        openArray("telecom");
47960        for (ContactPoint e : element.getTelecom()) 
47961          composeContactPoint(null, e);
47962        closeArray();
47963      };
47964      if (element.hasGenderElement()) {
47965        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
47966        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
47967      }
47968      if (element.hasBirthDateElement()) {
47969        composeDateCore("birthDate", element.getBirthDateElement(), false);
47970        composeDateExtras("birthDate", element.getBirthDateElement(), false);
47971      }
47972      if (element.hasAddress()) {
47973        openArray("address");
47974        for (Address e : element.getAddress()) 
47975          composeAddress(null, e);
47976        closeArray();
47977      };
47978      if (element.hasPhoto()) {
47979        composeAttachment("photo", element.getPhoto());
47980      }
47981      if (element.hasManagingOrganization()) {
47982        composeReference("managingOrganization", element.getManagingOrganization());
47983      }
47984      if (element.hasActiveElement()) {
47985        composeBooleanCore("active", element.getActiveElement(), false);
47986        composeBooleanExtras("active", element.getActiveElement(), false);
47987      }
47988      if (element.hasLink()) {
47989        openArray("link");
47990        for (Person.PersonLinkComponent e : element.getLink()) 
47991          composePersonPersonLinkComponent(null, e);
47992        closeArray();
47993      };
47994  }
47995
47996  protected void composePersonPersonLinkComponent(String name, Person.PersonLinkComponent element) throws IOException {
47997    if (element != null) {
47998      open(name);
47999      composePersonPersonLinkComponentInner(element);
48000      close();
48001    }
48002  }
48003
48004  protected void composePersonPersonLinkComponentInner(Person.PersonLinkComponent element) throws IOException {
48005      composeBackbone(element);
48006      if (element.hasTarget()) {
48007        composeReference("target", element.getTarget());
48008      }
48009      if (element.hasAssuranceElement()) {
48010        composeEnumerationCore("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
48011        composeEnumerationExtras("assurance", element.getAssuranceElement(), new Person.IdentityAssuranceLevelEnumFactory(), false);
48012      }
48013  }
48014
48015  protected void composePlanDefinition(String name, PlanDefinition element) throws IOException {
48016    if (element != null) {
48017      prop("resourceType", name);
48018      composePlanDefinitionInner(element);
48019    }
48020  }
48021
48022  protected void composePlanDefinitionInner(PlanDefinition element) throws IOException {
48023      composeDomainResourceElements(element);
48024      if (element.hasUrlElement()) {
48025        composeUriCore("url", element.getUrlElement(), false);
48026        composeUriExtras("url", element.getUrlElement(), false);
48027      }
48028      if (element.hasIdentifier()) {
48029        openArray("identifier");
48030        for (Identifier e : element.getIdentifier()) 
48031          composeIdentifier(null, e);
48032        closeArray();
48033      };
48034      if (element.hasVersionElement()) {
48035        composeStringCore("version", element.getVersionElement(), false);
48036        composeStringExtras("version", element.getVersionElement(), false);
48037      }
48038      if (element.hasNameElement()) {
48039        composeStringCore("name", element.getNameElement(), false);
48040        composeStringExtras("name", element.getNameElement(), false);
48041      }
48042      if (element.hasTitleElement()) {
48043        composeStringCore("title", element.getTitleElement(), false);
48044        composeStringExtras("title", element.getTitleElement(), false);
48045      }
48046      if (element.hasSubtitleElement()) {
48047        composeStringCore("subtitle", element.getSubtitleElement(), false);
48048        composeStringExtras("subtitle", element.getSubtitleElement(), false);
48049      }
48050      if (element.hasType()) {
48051        composeCodeableConcept("type", element.getType());
48052      }
48053      if (element.hasStatusElement()) {
48054        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48055        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
48056      }
48057      if (element.hasExperimentalElement()) {
48058        composeBooleanCore("experimental", element.getExperimentalElement(), false);
48059        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
48060      }
48061      if (element.hasSubject()) {
48062        composeType("subject", element.getSubject());
48063      }
48064      if (element.hasDateElement()) {
48065        composeDateTimeCore("date", element.getDateElement(), false);
48066        composeDateTimeExtras("date", element.getDateElement(), false);
48067      }
48068      if (element.hasPublisherElement()) {
48069        composeStringCore("publisher", element.getPublisherElement(), false);
48070        composeStringExtras("publisher", element.getPublisherElement(), false);
48071      }
48072      if (element.hasContact()) {
48073        openArray("contact");
48074        for (ContactDetail e : element.getContact()) 
48075          composeContactDetail(null, e);
48076        closeArray();
48077      };
48078      if (element.hasDescriptionElement()) {
48079        composeMarkdownCore("description", element.getDescriptionElement(), false);
48080        composeMarkdownExtras("description", element.getDescriptionElement(), false);
48081      }
48082      if (element.hasUseContext()) {
48083        openArray("useContext");
48084        for (UsageContext e : element.getUseContext()) 
48085          composeUsageContext(null, e);
48086        closeArray();
48087      };
48088      if (element.hasJurisdiction()) {
48089        openArray("jurisdiction");
48090        for (CodeableConcept e : element.getJurisdiction()) 
48091          composeCodeableConcept(null, e);
48092        closeArray();
48093      };
48094      if (element.hasPurposeElement()) {
48095        composeMarkdownCore("purpose", element.getPurposeElement(), false);
48096        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
48097      }
48098      if (element.hasUsageElement()) {
48099        composeStringCore("usage", element.getUsageElement(), false);
48100        composeStringExtras("usage", element.getUsageElement(), false);
48101      }
48102      if (element.hasCopyrightElement()) {
48103        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
48104        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
48105      }
48106      if (element.hasApprovalDateElement()) {
48107        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
48108        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
48109      }
48110      if (element.hasLastReviewDateElement()) {
48111        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
48112        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
48113      }
48114      if (element.hasEffectivePeriod()) {
48115        composePeriod("effectivePeriod", element.getEffectivePeriod());
48116      }
48117      if (element.hasTopic()) {
48118        openArray("topic");
48119        for (CodeableConcept e : element.getTopic()) 
48120          composeCodeableConcept(null, e);
48121        closeArray();
48122      };
48123      if (element.hasAuthor()) {
48124        openArray("author");
48125        for (ContactDetail e : element.getAuthor()) 
48126          composeContactDetail(null, e);
48127        closeArray();
48128      };
48129      if (element.hasEditor()) {
48130        openArray("editor");
48131        for (ContactDetail e : element.getEditor()) 
48132          composeContactDetail(null, e);
48133        closeArray();
48134      };
48135      if (element.hasReviewer()) {
48136        openArray("reviewer");
48137        for (ContactDetail e : element.getReviewer()) 
48138          composeContactDetail(null, e);
48139        closeArray();
48140      };
48141      if (element.hasEndorser()) {
48142        openArray("endorser");
48143        for (ContactDetail e : element.getEndorser()) 
48144          composeContactDetail(null, e);
48145        closeArray();
48146      };
48147      if (element.hasRelatedArtifact()) {
48148        openArray("relatedArtifact");
48149        for (RelatedArtifact e : element.getRelatedArtifact()) 
48150          composeRelatedArtifact(null, e);
48151        closeArray();
48152      };
48153      if (element.hasLibrary()) {
48154        openArray("library");
48155        for (CanonicalType e : element.getLibrary()) 
48156          composeCanonicalCore(null, e, true);
48157        closeArray();
48158        if (anyHasExtras(element.getLibrary())) {
48159          openArray("_library");
48160          for (CanonicalType e : element.getLibrary()) 
48161            composeCanonicalExtras(null, e, true);
48162          closeArray();
48163        }
48164      };
48165      if (element.hasGoal()) {
48166        openArray("goal");
48167        for (PlanDefinition.PlanDefinitionGoalComponent e : element.getGoal()) 
48168          composePlanDefinitionPlanDefinitionGoalComponent(null, e);
48169        closeArray();
48170      };
48171      if (element.hasAction()) {
48172        openArray("action");
48173        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
48174          composePlanDefinitionPlanDefinitionActionComponent(null, e);
48175        closeArray();
48176      };
48177  }
48178
48179  protected void composePlanDefinitionPlanDefinitionGoalComponent(String name, PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
48180    if (element != null) {
48181      open(name);
48182      composePlanDefinitionPlanDefinitionGoalComponentInner(element);
48183      close();
48184    }
48185  }
48186
48187  protected void composePlanDefinitionPlanDefinitionGoalComponentInner(PlanDefinition.PlanDefinitionGoalComponent element) throws IOException {
48188      composeBackbone(element);
48189      if (element.hasCategory()) {
48190        composeCodeableConcept("category", element.getCategory());
48191      }
48192      if (element.hasDescription()) {
48193        composeCodeableConcept("description", element.getDescription());
48194      }
48195      if (element.hasPriority()) {
48196        composeCodeableConcept("priority", element.getPriority());
48197      }
48198      if (element.hasStart()) {
48199        composeCodeableConcept("start", element.getStart());
48200      }
48201      if (element.hasAddresses()) {
48202        openArray("addresses");
48203        for (CodeableConcept e : element.getAddresses()) 
48204          composeCodeableConcept(null, e);
48205        closeArray();
48206      };
48207      if (element.hasDocumentation()) {
48208        openArray("documentation");
48209        for (RelatedArtifact e : element.getDocumentation()) 
48210          composeRelatedArtifact(null, e);
48211        closeArray();
48212      };
48213      if (element.hasTarget()) {
48214        openArray("target");
48215        for (PlanDefinition.PlanDefinitionGoalTargetComponent e : element.getTarget()) 
48216          composePlanDefinitionPlanDefinitionGoalTargetComponent(null, e);
48217        closeArray();
48218      };
48219  }
48220
48221  protected void composePlanDefinitionPlanDefinitionGoalTargetComponent(String name, PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
48222    if (element != null) {
48223      open(name);
48224      composePlanDefinitionPlanDefinitionGoalTargetComponentInner(element);
48225      close();
48226    }
48227  }
48228
48229  protected void composePlanDefinitionPlanDefinitionGoalTargetComponentInner(PlanDefinition.PlanDefinitionGoalTargetComponent element) throws IOException {
48230      composeBackbone(element);
48231      if (element.hasMeasure()) {
48232        composeCodeableConcept("measure", element.getMeasure());
48233      }
48234      if (element.hasDetail()) {
48235        composeType("detail", element.getDetail());
48236      }
48237      if (element.hasDue()) {
48238        composeDuration("due", element.getDue());
48239      }
48240  }
48241
48242  protected void composePlanDefinitionPlanDefinitionActionComponent(String name, PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
48243    if (element != null) {
48244      open(name);
48245      composePlanDefinitionPlanDefinitionActionComponentInner(element);
48246      close();
48247    }
48248  }
48249
48250  protected void composePlanDefinitionPlanDefinitionActionComponentInner(PlanDefinition.PlanDefinitionActionComponent element) throws IOException {
48251      composeBackbone(element);
48252      if (element.hasPrefixElement()) {
48253        composeStringCore("prefix", element.getPrefixElement(), false);
48254        composeStringExtras("prefix", element.getPrefixElement(), false);
48255      }
48256      if (element.hasTitleElement()) {
48257        composeStringCore("title", element.getTitleElement(), false);
48258        composeStringExtras("title", element.getTitleElement(), false);
48259      }
48260      if (element.hasDescriptionElement()) {
48261        composeStringCore("description", element.getDescriptionElement(), false);
48262        composeStringExtras("description", element.getDescriptionElement(), false);
48263      }
48264      if (element.hasTextEquivalentElement()) {
48265        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
48266        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
48267      }
48268      if (element.hasPriorityElement()) {
48269        composeEnumerationCore("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
48270        composeEnumerationExtras("priority", element.getPriorityElement(), new PlanDefinition.RequestPriorityEnumFactory(), false);
48271      }
48272      if (element.hasCode()) {
48273        openArray("code");
48274        for (CodeableConcept e : element.getCode()) 
48275          composeCodeableConcept(null, e);
48276        closeArray();
48277      };
48278      if (element.hasReason()) {
48279        openArray("reason");
48280        for (CodeableConcept e : element.getReason()) 
48281          composeCodeableConcept(null, e);
48282        closeArray();
48283      };
48284      if (element.hasDocumentation()) {
48285        openArray("documentation");
48286        for (RelatedArtifact e : element.getDocumentation()) 
48287          composeRelatedArtifact(null, e);
48288        closeArray();
48289      };
48290      if (element.hasGoalId()) {
48291        openArray("goalId");
48292        for (IdType e : element.getGoalId()) 
48293          composeIdCore(null, e, true);
48294        closeArray();
48295        if (anyHasExtras(element.getGoalId())) {
48296          openArray("_goalId");
48297          for (IdType e : element.getGoalId()) 
48298            composeIdExtras(null, e, true);
48299          closeArray();
48300        }
48301      };
48302      if (element.hasTrigger()) {
48303        openArray("trigger");
48304        for (TriggerDefinition e : element.getTrigger()) 
48305          composeTriggerDefinition(null, e);
48306        closeArray();
48307      };
48308      if (element.hasCondition()) {
48309        openArray("condition");
48310        for (PlanDefinition.PlanDefinitionActionConditionComponent e : element.getCondition()) 
48311          composePlanDefinitionPlanDefinitionActionConditionComponent(null, e);
48312        closeArray();
48313      };
48314      if (element.hasInput()) {
48315        openArray("input");
48316        for (DataRequirement e : element.getInput()) 
48317          composeDataRequirement(null, e);
48318        closeArray();
48319      };
48320      if (element.hasOutput()) {
48321        openArray("output");
48322        for (DataRequirement e : element.getOutput()) 
48323          composeDataRequirement(null, e);
48324        closeArray();
48325      };
48326      if (element.hasRelatedAction()) {
48327        openArray("relatedAction");
48328        for (PlanDefinition.PlanDefinitionActionRelatedActionComponent e : element.getRelatedAction()) 
48329          composePlanDefinitionPlanDefinitionActionRelatedActionComponent(null, e);
48330        closeArray();
48331      };
48332      if (element.hasTiming()) {
48333        composeType("timing", element.getTiming());
48334      }
48335      if (element.hasParticipant()) {
48336        openArray("participant");
48337        for (PlanDefinition.PlanDefinitionActionParticipantComponent e : element.getParticipant()) 
48338          composePlanDefinitionPlanDefinitionActionParticipantComponent(null, e);
48339        closeArray();
48340      };
48341      if (element.hasType()) {
48342        composeCodeableConcept("type", element.getType());
48343      }
48344      if (element.hasGroupingBehaviorElement()) {
48345        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
48346        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new PlanDefinition.ActionGroupingBehaviorEnumFactory(), false);
48347      }
48348      if (element.hasSelectionBehaviorElement()) {
48349        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
48350        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new PlanDefinition.ActionSelectionBehaviorEnumFactory(), false);
48351      }
48352      if (element.hasRequiredBehaviorElement()) {
48353        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
48354        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new PlanDefinition.ActionRequiredBehaviorEnumFactory(), false);
48355      }
48356      if (element.hasPrecheckBehaviorElement()) {
48357        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
48358        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new PlanDefinition.ActionPrecheckBehaviorEnumFactory(), false);
48359      }
48360      if (element.hasCardinalityBehaviorElement()) {
48361        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
48362        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new PlanDefinition.ActionCardinalityBehaviorEnumFactory(), false);
48363      }
48364      if (element.hasDefinitionElement()) {
48365        composeCanonicalCore("definition", element.getDefinitionElement(), false);
48366        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
48367      }
48368      if (element.hasTransformElement()) {
48369        composeCanonicalCore("transform", element.getTransformElement(), false);
48370        composeCanonicalExtras("transform", element.getTransformElement(), false);
48371      }
48372      if (element.hasDynamicValue()) {
48373        openArray("dynamicValue");
48374        for (PlanDefinition.PlanDefinitionActionDynamicValueComponent e : element.getDynamicValue()) 
48375          composePlanDefinitionPlanDefinitionActionDynamicValueComponent(null, e);
48376        closeArray();
48377      };
48378      if (element.hasAction()) {
48379        openArray("action");
48380        for (PlanDefinition.PlanDefinitionActionComponent e : element.getAction()) 
48381          composePlanDefinitionPlanDefinitionActionComponent(null, e);
48382        closeArray();
48383      };
48384  }
48385
48386  protected void composePlanDefinitionPlanDefinitionActionConditionComponent(String name, PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
48387    if (element != null) {
48388      open(name);
48389      composePlanDefinitionPlanDefinitionActionConditionComponentInner(element);
48390      close();
48391    }
48392  }
48393
48394  protected void composePlanDefinitionPlanDefinitionActionConditionComponentInner(PlanDefinition.PlanDefinitionActionConditionComponent element) throws IOException {
48395      composeBackbone(element);
48396      if (element.hasKindElement()) {
48397        composeEnumerationCore("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
48398        composeEnumerationExtras("kind", element.getKindElement(), new PlanDefinition.ActionConditionKindEnumFactory(), false);
48399      }
48400      if (element.hasExpression()) {
48401        composeExpression("expression", element.getExpression());
48402      }
48403  }
48404
48405  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponent(String name, PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
48406    if (element != null) {
48407      open(name);
48408      composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(element);
48409      close();
48410    }
48411  }
48412
48413  protected void composePlanDefinitionPlanDefinitionActionRelatedActionComponentInner(PlanDefinition.PlanDefinitionActionRelatedActionComponent element) throws IOException {
48414      composeBackbone(element);
48415      if (element.hasActionIdElement()) {
48416        composeIdCore("actionId", element.getActionIdElement(), false);
48417        composeIdExtras("actionId", element.getActionIdElement(), false);
48418      }
48419      if (element.hasRelationshipElement()) {
48420        composeEnumerationCore("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
48421        composeEnumerationExtras("relationship", element.getRelationshipElement(), new PlanDefinition.ActionRelationshipTypeEnumFactory(), false);
48422      }
48423      if (element.hasOffset()) {
48424        composeType("offset", element.getOffset());
48425      }
48426  }
48427
48428  protected void composePlanDefinitionPlanDefinitionActionParticipantComponent(String name, PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
48429    if (element != null) {
48430      open(name);
48431      composePlanDefinitionPlanDefinitionActionParticipantComponentInner(element);
48432      close();
48433    }
48434  }
48435
48436  protected void composePlanDefinitionPlanDefinitionActionParticipantComponentInner(PlanDefinition.PlanDefinitionActionParticipantComponent element) throws IOException {
48437      composeBackbone(element);
48438      if (element.hasTypeElement()) {
48439        composeEnumerationCore("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
48440        composeEnumerationExtras("type", element.getTypeElement(), new PlanDefinition.ActionParticipantTypeEnumFactory(), false);
48441      }
48442      if (element.hasRole()) {
48443        composeCodeableConcept("role", element.getRole());
48444      }
48445  }
48446
48447  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponent(String name, PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
48448    if (element != null) {
48449      open(name);
48450      composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(element);
48451      close();
48452    }
48453  }
48454
48455  protected void composePlanDefinitionPlanDefinitionActionDynamicValueComponentInner(PlanDefinition.PlanDefinitionActionDynamicValueComponent element) throws IOException {
48456      composeBackbone(element);
48457      if (element.hasPathElement()) {
48458        composeStringCore("path", element.getPathElement(), false);
48459        composeStringExtras("path", element.getPathElement(), false);
48460      }
48461      if (element.hasExpression()) {
48462        composeExpression("expression", element.getExpression());
48463      }
48464  }
48465
48466  protected void composePractitioner(String name, Practitioner element) throws IOException {
48467    if (element != null) {
48468      prop("resourceType", name);
48469      composePractitionerInner(element);
48470    }
48471  }
48472
48473  protected void composePractitionerInner(Practitioner element) throws IOException {
48474      composeDomainResourceElements(element);
48475      if (element.hasIdentifier()) {
48476        openArray("identifier");
48477        for (Identifier e : element.getIdentifier()) 
48478          composeIdentifier(null, e);
48479        closeArray();
48480      };
48481      if (element.hasActiveElement()) {
48482        composeBooleanCore("active", element.getActiveElement(), false);
48483        composeBooleanExtras("active", element.getActiveElement(), false);
48484      }
48485      if (element.hasName()) {
48486        openArray("name");
48487        for (HumanName e : element.getName()) 
48488          composeHumanName(null, e);
48489        closeArray();
48490      };
48491      if (element.hasTelecom()) {
48492        openArray("telecom");
48493        for (ContactPoint e : element.getTelecom()) 
48494          composeContactPoint(null, e);
48495        closeArray();
48496      };
48497      if (element.hasAddress()) {
48498        openArray("address");
48499        for (Address e : element.getAddress()) 
48500          composeAddress(null, e);
48501        closeArray();
48502      };
48503      if (element.hasGenderElement()) {
48504        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
48505        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
48506      }
48507      if (element.hasBirthDateElement()) {
48508        composeDateCore("birthDate", element.getBirthDateElement(), false);
48509        composeDateExtras("birthDate", element.getBirthDateElement(), false);
48510      }
48511      if (element.hasPhoto()) {
48512        openArray("photo");
48513        for (Attachment e : element.getPhoto()) 
48514          composeAttachment(null, e);
48515        closeArray();
48516      };
48517      if (element.hasQualification()) {
48518        openArray("qualification");
48519        for (Practitioner.PractitionerQualificationComponent e : element.getQualification()) 
48520          composePractitionerPractitionerQualificationComponent(null, e);
48521        closeArray();
48522      };
48523      if (element.hasCommunication()) {
48524        openArray("communication");
48525        for (CodeableConcept e : element.getCommunication()) 
48526          composeCodeableConcept(null, e);
48527        closeArray();
48528      };
48529  }
48530
48531  protected void composePractitionerPractitionerQualificationComponent(String name, Practitioner.PractitionerQualificationComponent element) throws IOException {
48532    if (element != null) {
48533      open(name);
48534      composePractitionerPractitionerQualificationComponentInner(element);
48535      close();
48536    }
48537  }
48538
48539  protected void composePractitionerPractitionerQualificationComponentInner(Practitioner.PractitionerQualificationComponent element) throws IOException {
48540      composeBackbone(element);
48541      if (element.hasIdentifier()) {
48542        openArray("identifier");
48543        for (Identifier e : element.getIdentifier()) 
48544          composeIdentifier(null, e);
48545        closeArray();
48546      };
48547      if (element.hasCode()) {
48548        composeCodeableConcept("code", element.getCode());
48549      }
48550      if (element.hasPeriod()) {
48551        composePeriod("period", element.getPeriod());
48552      }
48553      if (element.hasIssuer()) {
48554        composeReference("issuer", element.getIssuer());
48555      }
48556  }
48557
48558  protected void composePractitionerRole(String name, PractitionerRole element) throws IOException {
48559    if (element != null) {
48560      prop("resourceType", name);
48561      composePractitionerRoleInner(element);
48562    }
48563  }
48564
48565  protected void composePractitionerRoleInner(PractitionerRole element) throws IOException {
48566      composeDomainResourceElements(element);
48567      if (element.hasIdentifier()) {
48568        openArray("identifier");
48569        for (Identifier e : element.getIdentifier()) 
48570          composeIdentifier(null, e);
48571        closeArray();
48572      };
48573      if (element.hasActiveElement()) {
48574        composeBooleanCore("active", element.getActiveElement(), false);
48575        composeBooleanExtras("active", element.getActiveElement(), false);
48576      }
48577      if (element.hasPeriod()) {
48578        composePeriod("period", element.getPeriod());
48579      }
48580      if (element.hasPractitioner()) {
48581        composeReference("practitioner", element.getPractitioner());
48582      }
48583      if (element.hasOrganization()) {
48584        composeReference("organization", element.getOrganization());
48585      }
48586      if (element.hasCode()) {
48587        openArray("code");
48588        for (CodeableConcept e : element.getCode()) 
48589          composeCodeableConcept(null, e);
48590        closeArray();
48591      };
48592      if (element.hasSpecialty()) {
48593        openArray("specialty");
48594        for (CodeableConcept e : element.getSpecialty()) 
48595          composeCodeableConcept(null, e);
48596        closeArray();
48597      };
48598      if (element.hasLocation()) {
48599        openArray("location");
48600        for (Reference e : element.getLocation()) 
48601          composeReference(null, e);
48602        closeArray();
48603      };
48604      if (element.hasHealthcareService()) {
48605        openArray("healthcareService");
48606        for (Reference e : element.getHealthcareService()) 
48607          composeReference(null, e);
48608        closeArray();
48609      };
48610      if (element.hasTelecom()) {
48611        openArray("telecom");
48612        for (ContactPoint e : element.getTelecom()) 
48613          composeContactPoint(null, e);
48614        closeArray();
48615      };
48616      if (element.hasAvailableTime()) {
48617        openArray("availableTime");
48618        for (PractitionerRole.PractitionerRoleAvailableTimeComponent e : element.getAvailableTime()) 
48619          composePractitionerRolePractitionerRoleAvailableTimeComponent(null, e);
48620        closeArray();
48621      };
48622      if (element.hasNotAvailable()) {
48623        openArray("notAvailable");
48624        for (PractitionerRole.PractitionerRoleNotAvailableComponent e : element.getNotAvailable()) 
48625          composePractitionerRolePractitionerRoleNotAvailableComponent(null, e);
48626        closeArray();
48627      };
48628      if (element.hasAvailabilityExceptionsElement()) {
48629        composeStringCore("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
48630        composeStringExtras("availabilityExceptions", element.getAvailabilityExceptionsElement(), false);
48631      }
48632      if (element.hasEndpoint()) {
48633        openArray("endpoint");
48634        for (Reference e : element.getEndpoint()) 
48635          composeReference(null, e);
48636        closeArray();
48637      };
48638  }
48639
48640  protected void composePractitionerRolePractitionerRoleAvailableTimeComponent(String name, PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
48641    if (element != null) {
48642      open(name);
48643      composePractitionerRolePractitionerRoleAvailableTimeComponentInner(element);
48644      close();
48645    }
48646  }
48647
48648  protected void composePractitionerRolePractitionerRoleAvailableTimeComponentInner(PractitionerRole.PractitionerRoleAvailableTimeComponent element) throws IOException {
48649      composeBackbone(element);
48650      if (element.hasDaysOfWeek()) {
48651        openArray("daysOfWeek");
48652        for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
48653          composeEnumerationCore(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
48654        closeArray();
48655        if (anyHasExtras(element.getDaysOfWeek())) {
48656          openArray("_daysOfWeek");
48657          for (Enumeration<PractitionerRole.DaysOfWeek> e : element.getDaysOfWeek()) 
48658            composeEnumerationExtras(null, e, new PractitionerRole.DaysOfWeekEnumFactory(), true);
48659          closeArray();
48660        }
48661      };
48662      if (element.hasAllDayElement()) {
48663        composeBooleanCore("allDay", element.getAllDayElement(), false);
48664        composeBooleanExtras("allDay", element.getAllDayElement(), false);
48665      }
48666      if (element.hasAvailableStartTimeElement()) {
48667        composeTimeCore("availableStartTime", element.getAvailableStartTimeElement(), false);
48668        composeTimeExtras("availableStartTime", element.getAvailableStartTimeElement(), false);
48669      }
48670      if (element.hasAvailableEndTimeElement()) {
48671        composeTimeCore("availableEndTime", element.getAvailableEndTimeElement(), false);
48672        composeTimeExtras("availableEndTime", element.getAvailableEndTimeElement(), false);
48673      }
48674  }
48675
48676  protected void composePractitionerRolePractitionerRoleNotAvailableComponent(String name, PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
48677    if (element != null) {
48678      open(name);
48679      composePractitionerRolePractitionerRoleNotAvailableComponentInner(element);
48680      close();
48681    }
48682  }
48683
48684  protected void composePractitionerRolePractitionerRoleNotAvailableComponentInner(PractitionerRole.PractitionerRoleNotAvailableComponent element) throws IOException {
48685      composeBackbone(element);
48686      if (element.hasDescriptionElement()) {
48687        composeStringCore("description", element.getDescriptionElement(), false);
48688        composeStringExtras("description", element.getDescriptionElement(), false);
48689      }
48690      if (element.hasDuring()) {
48691        composePeriod("during", element.getDuring());
48692      }
48693  }
48694
48695  protected void composeProcedure(String name, Procedure element) throws IOException {
48696    if (element != null) {
48697      prop("resourceType", name);
48698      composeProcedureInner(element);
48699    }
48700  }
48701
48702  protected void composeProcedureInner(Procedure element) throws IOException {
48703      composeDomainResourceElements(element);
48704      if (element.hasIdentifier()) {
48705        openArray("identifier");
48706        for (Identifier e : element.getIdentifier()) 
48707          composeIdentifier(null, e);
48708        closeArray();
48709      };
48710      if (element.hasInstantiatesCanonical()) {
48711        openArray("instantiatesCanonical");
48712        for (CanonicalType e : element.getInstantiatesCanonical()) 
48713          composeCanonicalCore(null, e, true);
48714        closeArray();
48715        if (anyHasExtras(element.getInstantiatesCanonical())) {
48716          openArray("_instantiatesCanonical");
48717          for (CanonicalType e : element.getInstantiatesCanonical()) 
48718            composeCanonicalExtras(null, e, true);
48719          closeArray();
48720        }
48721      };
48722      if (element.hasInstantiatesUri()) {
48723        openArray("instantiatesUri");
48724        for (UriType e : element.getInstantiatesUri()) 
48725          composeUriCore(null, e, true);
48726        closeArray();
48727        if (anyHasExtras(element.getInstantiatesUri())) {
48728          openArray("_instantiatesUri");
48729          for (UriType e : element.getInstantiatesUri()) 
48730            composeUriExtras(null, e, true);
48731          closeArray();
48732        }
48733      };
48734      if (element.hasBasedOn()) {
48735        openArray("basedOn");
48736        for (Reference e : element.getBasedOn()) 
48737          composeReference(null, e);
48738        closeArray();
48739      };
48740      if (element.hasPartOf()) {
48741        openArray("partOf");
48742        for (Reference e : element.getPartOf()) 
48743          composeReference(null, e);
48744        closeArray();
48745      };
48746      if (element.hasStatusElement()) {
48747        composeEnumerationCore("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
48748        composeEnumerationExtras("status", element.getStatusElement(), new Procedure.ProcedureStatusEnumFactory(), false);
48749      }
48750      if (element.hasStatusReason()) {
48751        composeCodeableConcept("statusReason", element.getStatusReason());
48752      }
48753      if (element.hasCategory()) {
48754        composeCodeableConcept("category", element.getCategory());
48755      }
48756      if (element.hasCode()) {
48757        composeCodeableConcept("code", element.getCode());
48758      }
48759      if (element.hasSubject()) {
48760        composeReference("subject", element.getSubject());
48761      }
48762      if (element.hasContext()) {
48763        composeReference("context", element.getContext());
48764      }
48765      if (element.hasPerformed()) {
48766        composeType("performed", element.getPerformed());
48767      }
48768      if (element.hasRecorder()) {
48769        composeReference("recorder", element.getRecorder());
48770      }
48771      if (element.hasAsserter()) {
48772        composeReference("asserter", element.getAsserter());
48773      }
48774      if (element.hasPerformer()) {
48775        openArray("performer");
48776        for (Procedure.ProcedurePerformerComponent e : element.getPerformer()) 
48777          composeProcedureProcedurePerformerComponent(null, e);
48778        closeArray();
48779      };
48780      if (element.hasLocation()) {
48781        composeReference("location", element.getLocation());
48782      }
48783      if (element.hasReasonCode()) {
48784        openArray("reasonCode");
48785        for (CodeableConcept e : element.getReasonCode()) 
48786          composeCodeableConcept(null, e);
48787        closeArray();
48788      };
48789      if (element.hasReasonReference()) {
48790        openArray("reasonReference");
48791        for (Reference e : element.getReasonReference()) 
48792          composeReference(null, e);
48793        closeArray();
48794      };
48795      if (element.hasBodySite()) {
48796        openArray("bodySite");
48797        for (CodeableConcept e : element.getBodySite()) 
48798          composeCodeableConcept(null, e);
48799        closeArray();
48800      };
48801      if (element.hasOutcome()) {
48802        composeCodeableConcept("outcome", element.getOutcome());
48803      }
48804      if (element.hasReport()) {
48805        openArray("report");
48806        for (Reference e : element.getReport()) 
48807          composeReference(null, e);
48808        closeArray();
48809      };
48810      if (element.hasComplication()) {
48811        openArray("complication");
48812        for (CodeableConcept e : element.getComplication()) 
48813          composeCodeableConcept(null, e);
48814        closeArray();
48815      };
48816      if (element.hasComplicationDetail()) {
48817        openArray("complicationDetail");
48818        for (Reference e : element.getComplicationDetail()) 
48819          composeReference(null, e);
48820        closeArray();
48821      };
48822      if (element.hasFollowUp()) {
48823        openArray("followUp");
48824        for (CodeableConcept e : element.getFollowUp()) 
48825          composeCodeableConcept(null, e);
48826        closeArray();
48827      };
48828      if (element.hasNote()) {
48829        openArray("note");
48830        for (Annotation e : element.getNote()) 
48831          composeAnnotation(null, e);
48832        closeArray();
48833      };
48834      if (element.hasFocalDevice()) {
48835        openArray("focalDevice");
48836        for (Procedure.ProcedureFocalDeviceComponent e : element.getFocalDevice()) 
48837          composeProcedureProcedureFocalDeviceComponent(null, e);
48838        closeArray();
48839      };
48840      if (element.hasUsedReference()) {
48841        openArray("usedReference");
48842        for (Reference e : element.getUsedReference()) 
48843          composeReference(null, e);
48844        closeArray();
48845      };
48846      if (element.hasUsedCode()) {
48847        openArray("usedCode");
48848        for (CodeableConcept e : element.getUsedCode()) 
48849          composeCodeableConcept(null, e);
48850        closeArray();
48851      };
48852  }
48853
48854  protected void composeProcedureProcedurePerformerComponent(String name, Procedure.ProcedurePerformerComponent element) throws IOException {
48855    if (element != null) {
48856      open(name);
48857      composeProcedureProcedurePerformerComponentInner(element);
48858      close();
48859    }
48860  }
48861
48862  protected void composeProcedureProcedurePerformerComponentInner(Procedure.ProcedurePerformerComponent element) throws IOException {
48863      composeBackbone(element);
48864      if (element.hasFunction()) {
48865        composeCodeableConcept("function", element.getFunction());
48866      }
48867      if (element.hasActor()) {
48868        composeReference("actor", element.getActor());
48869      }
48870      if (element.hasOnBehalfOf()) {
48871        composeReference("onBehalfOf", element.getOnBehalfOf());
48872      }
48873  }
48874
48875  protected void composeProcedureProcedureFocalDeviceComponent(String name, Procedure.ProcedureFocalDeviceComponent element) throws IOException {
48876    if (element != null) {
48877      open(name);
48878      composeProcedureProcedureFocalDeviceComponentInner(element);
48879      close();
48880    }
48881  }
48882
48883  protected void composeProcedureProcedureFocalDeviceComponentInner(Procedure.ProcedureFocalDeviceComponent element) throws IOException {
48884      composeBackbone(element);
48885      if (element.hasAction()) {
48886        composeCodeableConcept("action", element.getAction());
48887      }
48888      if (element.hasManipulated()) {
48889        composeReference("manipulated", element.getManipulated());
48890      }
48891  }
48892
48893  protected void composeProcessRequest(String name, ProcessRequest element) throws IOException {
48894    if (element != null) {
48895      prop("resourceType", name);
48896      composeProcessRequestInner(element);
48897    }
48898  }
48899
48900  protected void composeProcessRequestInner(ProcessRequest element) throws IOException {
48901      composeDomainResourceElements(element);
48902      if (element.hasIdentifier()) {
48903        openArray("identifier");
48904        for (Identifier e : element.getIdentifier()) 
48905          composeIdentifier(null, e);
48906        closeArray();
48907      };
48908      if (element.hasStatusElement()) {
48909        composeEnumerationCore("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory(), false);
48910        composeEnumerationExtras("status", element.getStatusElement(), new ProcessRequest.ProcessRequestStatusEnumFactory(), false);
48911      }
48912      if (element.hasActionElement()) {
48913        composeEnumerationCore("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
48914        composeEnumerationExtras("action", element.getActionElement(), new ProcessRequest.ActionListEnumFactory(), false);
48915      }
48916      if (element.hasTarget()) {
48917        composeReference("target", element.getTarget());
48918      }
48919      if (element.hasCreatedElement()) {
48920        composeDateTimeCore("created", element.getCreatedElement(), false);
48921        composeDateTimeExtras("created", element.getCreatedElement(), false);
48922      }
48923      if (element.hasProvider()) {
48924        composeReference("provider", element.getProvider());
48925      }
48926      if (element.hasRequest()) {
48927        composeReference("request", element.getRequest());
48928      }
48929      if (element.hasResponse()) {
48930        composeReference("response", element.getResponse());
48931      }
48932      if (element.hasNullifyElement()) {
48933        composeBooleanCore("nullify", element.getNullifyElement(), false);
48934        composeBooleanExtras("nullify", element.getNullifyElement(), false);
48935      }
48936      if (element.hasReferenceElement()) {
48937        composeStringCore("reference", element.getReferenceElement(), false);
48938        composeStringExtras("reference", element.getReferenceElement(), false);
48939      }
48940      if (element.hasItem()) {
48941        openArray("item");
48942        for (ProcessRequest.ItemsComponent e : element.getItem()) 
48943          composeProcessRequestItemsComponent(null, e);
48944        closeArray();
48945      };
48946      if (element.hasInclude()) {
48947        openArray("include");
48948        for (StringType e : element.getInclude()) 
48949          composeStringCore(null, e, true);
48950        closeArray();
48951        if (anyHasExtras(element.getInclude())) {
48952          openArray("_include");
48953          for (StringType e : element.getInclude()) 
48954            composeStringExtras(null, e, true);
48955          closeArray();
48956        }
48957      };
48958      if (element.hasExclude()) {
48959        openArray("exclude");
48960        for (StringType e : element.getExclude()) 
48961          composeStringCore(null, e, true);
48962        closeArray();
48963        if (anyHasExtras(element.getExclude())) {
48964          openArray("_exclude");
48965          for (StringType e : element.getExclude()) 
48966            composeStringExtras(null, e, true);
48967          closeArray();
48968        }
48969      };
48970      if (element.hasPeriod()) {
48971        composePeriod("period", element.getPeriod());
48972      }
48973  }
48974
48975  protected void composeProcessRequestItemsComponent(String name, ProcessRequest.ItemsComponent element) throws IOException {
48976    if (element != null) {
48977      open(name);
48978      composeProcessRequestItemsComponentInner(element);
48979      close();
48980    }
48981  }
48982
48983  protected void composeProcessRequestItemsComponentInner(ProcessRequest.ItemsComponent element) throws IOException {
48984      composeBackbone(element);
48985      if (element.hasSequenceLinkIdElement()) {
48986        composeIntegerCore("sequenceLinkId", element.getSequenceLinkIdElement(), false);
48987        composeIntegerExtras("sequenceLinkId", element.getSequenceLinkIdElement(), false);
48988      }
48989  }
48990
48991  protected void composeProcessResponse(String name, ProcessResponse element) throws IOException {
48992    if (element != null) {
48993      prop("resourceType", name);
48994      composeProcessResponseInner(element);
48995    }
48996  }
48997
48998  protected void composeProcessResponseInner(ProcessResponse element) throws IOException {
48999      composeDomainResourceElements(element);
49000      if (element.hasIdentifier()) {
49001        openArray("identifier");
49002        for (Identifier e : element.getIdentifier()) 
49003          composeIdentifier(null, e);
49004        closeArray();
49005      };
49006      if (element.hasStatusElement()) {
49007        composeEnumerationCore("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory(), false);
49008        composeEnumerationExtras("status", element.getStatusElement(), new ProcessResponse.ProcessResponseStatusEnumFactory(), false);
49009      }
49010      if (element.hasCreatedElement()) {
49011        composeDateTimeCore("created", element.getCreatedElement(), false);
49012        composeDateTimeExtras("created", element.getCreatedElement(), false);
49013      }
49014      if (element.hasOrganization()) {
49015        composeReference("organization", element.getOrganization());
49016      }
49017      if (element.hasRequest()) {
49018        composeReference("request", element.getRequest());
49019      }
49020      if (element.hasOutcomeElement()) {
49021        composeEnumerationCore("outcome", element.getOutcomeElement(), new ProcessResponse.ProcessingOutcomeEnumFactory(), false);
49022        composeEnumerationExtras("outcome", element.getOutcomeElement(), new ProcessResponse.ProcessingOutcomeEnumFactory(), false);
49023      }
49024      if (element.hasDispositionElement()) {
49025        composeStringCore("disposition", element.getDispositionElement(), false);
49026        composeStringExtras("disposition", element.getDispositionElement(), false);
49027      }
49028      if (element.hasRequestProvider()) {
49029        composeReference("requestProvider", element.getRequestProvider());
49030      }
49031      if (element.hasForm()) {
49032        composeCodeableConcept("form", element.getForm());
49033      }
49034      if (element.hasProcessNote()) {
49035        openArray("processNote");
49036        for (ProcessResponse.ProcessResponseProcessNoteComponent e : element.getProcessNote()) 
49037          composeProcessResponseProcessResponseProcessNoteComponent(null, e);
49038        closeArray();
49039      };
49040      if (element.hasError()) {
49041        openArray("error");
49042        for (CodeableConcept e : element.getError()) 
49043          composeCodeableConcept(null, e);
49044        closeArray();
49045      };
49046      if (element.hasCommunicationRequest()) {
49047        openArray("communicationRequest");
49048        for (Reference e : element.getCommunicationRequest()) 
49049          composeReference(null, e);
49050        closeArray();
49051      };
49052  }
49053
49054  protected void composeProcessResponseProcessResponseProcessNoteComponent(String name, ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
49055    if (element != null) {
49056      open(name);
49057      composeProcessResponseProcessResponseProcessNoteComponentInner(element);
49058      close();
49059    }
49060  }
49061
49062  protected void composeProcessResponseProcessResponseProcessNoteComponentInner(ProcessResponse.ProcessResponseProcessNoteComponent element) throws IOException {
49063      composeBackbone(element);
49064      if (element.hasTypeElement()) {
49065        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
49066        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.NoteTypeEnumFactory(), false);
49067      }
49068      if (element.hasTextElement()) {
49069        composeStringCore("text", element.getTextElement(), false);
49070        composeStringExtras("text", element.getTextElement(), false);
49071      }
49072  }
49073
49074  protected void composeProvenance(String name, Provenance element) throws IOException {
49075    if (element != null) {
49076      prop("resourceType", name);
49077      composeProvenanceInner(element);
49078    }
49079  }
49080
49081  protected void composeProvenanceInner(Provenance element) throws IOException {
49082      composeDomainResourceElements(element);
49083      if (element.hasTarget()) {
49084        openArray("target");
49085        for (Reference e : element.getTarget()) 
49086          composeReference(null, e);
49087        closeArray();
49088      };
49089      if (element.hasOccurred()) {
49090        composeType("occurred", element.getOccurred());
49091      }
49092      if (element.hasRecordedElement()) {
49093        composeInstantCore("recorded", element.getRecordedElement(), false);
49094        composeInstantExtras("recorded", element.getRecordedElement(), false);
49095      }
49096      if (element.hasPolicy()) {
49097        openArray("policy");
49098        for (UriType e : element.getPolicy()) 
49099          composeUriCore(null, e, true);
49100        closeArray();
49101        if (anyHasExtras(element.getPolicy())) {
49102          openArray("_policy");
49103          for (UriType e : element.getPolicy()) 
49104            composeUriExtras(null, e, true);
49105          closeArray();
49106        }
49107      };
49108      if (element.hasLocation()) {
49109        composeReference("location", element.getLocation());
49110      }
49111      if (element.hasReason()) {
49112        openArray("reason");
49113        for (CodeableConcept e : element.getReason()) 
49114          composeCodeableConcept(null, e);
49115        closeArray();
49116      };
49117      if (element.hasActivity()) {
49118        composeCodeableConcept("activity", element.getActivity());
49119      }
49120      if (element.hasAgent()) {
49121        openArray("agent");
49122        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
49123          composeProvenanceProvenanceAgentComponent(null, e);
49124        closeArray();
49125      };
49126      if (element.hasEntity()) {
49127        openArray("entity");
49128        for (Provenance.ProvenanceEntityComponent e : element.getEntity()) 
49129          composeProvenanceProvenanceEntityComponent(null, e);
49130        closeArray();
49131      };
49132      if (element.hasSignature()) {
49133        openArray("signature");
49134        for (Signature e : element.getSignature()) 
49135          composeSignature(null, e);
49136        closeArray();
49137      };
49138  }
49139
49140  protected void composeProvenanceProvenanceAgentComponent(String name, Provenance.ProvenanceAgentComponent element) throws IOException {
49141    if (element != null) {
49142      open(name);
49143      composeProvenanceProvenanceAgentComponentInner(element);
49144      close();
49145    }
49146  }
49147
49148  protected void composeProvenanceProvenanceAgentComponentInner(Provenance.ProvenanceAgentComponent element) throws IOException {
49149      composeBackbone(element);
49150      if (element.hasType()) {
49151        composeCodeableConcept("type", element.getType());
49152      }
49153      if (element.hasRole()) {
49154        openArray("role");
49155        for (CodeableConcept e : element.getRole()) 
49156          composeCodeableConcept(null, e);
49157        closeArray();
49158      };
49159      if (element.hasWho()) {
49160        composeReference("who", element.getWho());
49161      }
49162      if (element.hasOnBehalfOf()) {
49163        composeReference("onBehalfOf", element.getOnBehalfOf());
49164      }
49165  }
49166
49167  protected void composeProvenanceProvenanceEntityComponent(String name, Provenance.ProvenanceEntityComponent element) throws IOException {
49168    if (element != null) {
49169      open(name);
49170      composeProvenanceProvenanceEntityComponentInner(element);
49171      close();
49172    }
49173  }
49174
49175  protected void composeProvenanceProvenanceEntityComponentInner(Provenance.ProvenanceEntityComponent element) throws IOException {
49176      composeBackbone(element);
49177      if (element.hasRoleElement()) {
49178        composeEnumerationCore("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
49179        composeEnumerationExtras("role", element.getRoleElement(), new Provenance.ProvenanceEntityRoleEnumFactory(), false);
49180      }
49181      if (element.hasWhat()) {
49182        composeReference("what", element.getWhat());
49183      }
49184      if (element.hasAgent()) {
49185        openArray("agent");
49186        for (Provenance.ProvenanceAgentComponent e : element.getAgent()) 
49187          composeProvenanceProvenanceAgentComponent(null, e);
49188        closeArray();
49189      };
49190  }
49191
49192  protected void composeQuestionnaire(String name, Questionnaire element) throws IOException {
49193    if (element != null) {
49194      prop("resourceType", name);
49195      composeQuestionnaireInner(element);
49196    }
49197  }
49198
49199  protected void composeQuestionnaireInner(Questionnaire element) throws IOException {
49200      composeDomainResourceElements(element);
49201      if (element.hasUrlElement()) {
49202        composeUriCore("url", element.getUrlElement(), false);
49203        composeUriExtras("url", element.getUrlElement(), false);
49204      }
49205      if (element.hasIdentifier()) {
49206        openArray("identifier");
49207        for (Identifier e : element.getIdentifier()) 
49208          composeIdentifier(null, e);
49209        closeArray();
49210      };
49211      if (element.hasVersionElement()) {
49212        composeStringCore("version", element.getVersionElement(), false);
49213        composeStringExtras("version", element.getVersionElement(), false);
49214      }
49215      if (element.hasNameElement()) {
49216        composeStringCore("name", element.getNameElement(), false);
49217        composeStringExtras("name", element.getNameElement(), false);
49218      }
49219      if (element.hasTitleElement()) {
49220        composeStringCore("title", element.getTitleElement(), false);
49221        composeStringExtras("title", element.getTitleElement(), false);
49222      }
49223      if (element.hasDerivedFrom()) {
49224        openArray("derivedFrom");
49225        for (CanonicalType e : element.getDerivedFrom()) 
49226          composeCanonicalCore(null, e, true);
49227        closeArray();
49228        if (anyHasExtras(element.getDerivedFrom())) {
49229          openArray("_derivedFrom");
49230          for (CanonicalType e : element.getDerivedFrom()) 
49231            composeCanonicalExtras(null, e, true);
49232          closeArray();
49233        }
49234      };
49235      if (element.hasStatusElement()) {
49236        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49237        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
49238      }
49239      if (element.hasExperimentalElement()) {
49240        composeBooleanCore("experimental", element.getExperimentalElement(), false);
49241        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
49242      }
49243      if (element.hasSubjectType()) {
49244        openArray("subjectType");
49245        for (CodeType e : element.getSubjectType()) 
49246          composeCodeCore(null, e, true);
49247        closeArray();
49248        if (anyHasExtras(element.getSubjectType())) {
49249          openArray("_subjectType");
49250          for (CodeType e : element.getSubjectType()) 
49251            composeCodeExtras(null, e, true);
49252          closeArray();
49253        }
49254      };
49255      if (element.hasDateElement()) {
49256        composeDateTimeCore("date", element.getDateElement(), false);
49257        composeDateTimeExtras("date", element.getDateElement(), false);
49258      }
49259      if (element.hasPublisherElement()) {
49260        composeStringCore("publisher", element.getPublisherElement(), false);
49261        composeStringExtras("publisher", element.getPublisherElement(), false);
49262      }
49263      if (element.hasContact()) {
49264        openArray("contact");
49265        for (ContactDetail e : element.getContact()) 
49266          composeContactDetail(null, e);
49267        closeArray();
49268      };
49269      if (element.hasDescriptionElement()) {
49270        composeMarkdownCore("description", element.getDescriptionElement(), false);
49271        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49272      }
49273      if (element.hasUseContext()) {
49274        openArray("useContext");
49275        for (UsageContext e : element.getUseContext()) 
49276          composeUsageContext(null, e);
49277        closeArray();
49278      };
49279      if (element.hasJurisdiction()) {
49280        openArray("jurisdiction");
49281        for (CodeableConcept e : element.getJurisdiction()) 
49282          composeCodeableConcept(null, e);
49283        closeArray();
49284      };
49285      if (element.hasPurposeElement()) {
49286        composeMarkdownCore("purpose", element.getPurposeElement(), false);
49287        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
49288      }
49289      if (element.hasCopyrightElement()) {
49290        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
49291        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
49292      }
49293      if (element.hasApprovalDateElement()) {
49294        composeDateCore("approvalDate", element.getApprovalDateElement(), false);
49295        composeDateExtras("approvalDate", element.getApprovalDateElement(), false);
49296      }
49297      if (element.hasLastReviewDateElement()) {
49298        composeDateCore("lastReviewDate", element.getLastReviewDateElement(), false);
49299        composeDateExtras("lastReviewDate", element.getLastReviewDateElement(), false);
49300      }
49301      if (element.hasEffectivePeriod()) {
49302        composePeriod("effectivePeriod", element.getEffectivePeriod());
49303      }
49304      if (element.hasCode()) {
49305        openArray("code");
49306        for (Coding e : element.getCode()) 
49307          composeCoding(null, e);
49308        closeArray();
49309      };
49310      if (element.hasItem()) {
49311        openArray("item");
49312        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
49313          composeQuestionnaireQuestionnaireItemComponent(null, e);
49314        closeArray();
49315      };
49316  }
49317
49318  protected void composeQuestionnaireQuestionnaireItemComponent(String name, Questionnaire.QuestionnaireItemComponent element) throws IOException {
49319    if (element != null) {
49320      open(name);
49321      composeQuestionnaireQuestionnaireItemComponentInner(element);
49322      close();
49323    }
49324  }
49325
49326  protected void composeQuestionnaireQuestionnaireItemComponentInner(Questionnaire.QuestionnaireItemComponent element) throws IOException {
49327      composeBackbone(element);
49328      if (element.hasLinkIdElement()) {
49329        composeStringCore("linkId", element.getLinkIdElement(), false);
49330        composeStringExtras("linkId", element.getLinkIdElement(), false);
49331      }
49332      if (element.hasDefinitionElement()) {
49333        composeUriCore("definition", element.getDefinitionElement(), false);
49334        composeUriExtras("definition", element.getDefinitionElement(), false);
49335      }
49336      if (element.hasCode()) {
49337        openArray("code");
49338        for (Coding e : element.getCode()) 
49339          composeCoding(null, e);
49340        closeArray();
49341      };
49342      if (element.hasPrefixElement()) {
49343        composeStringCore("prefix", element.getPrefixElement(), false);
49344        composeStringExtras("prefix", element.getPrefixElement(), false);
49345      }
49346      if (element.hasTextElement()) {
49347        composeStringCore("text", element.getTextElement(), false);
49348        composeStringExtras("text", element.getTextElement(), false);
49349      }
49350      if (element.hasTypeElement()) {
49351        composeEnumerationCore("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
49352        composeEnumerationExtras("type", element.getTypeElement(), new Questionnaire.QuestionnaireItemTypeEnumFactory(), false);
49353      }
49354      if (element.hasEnableWhen()) {
49355        openArray("enableWhen");
49356        for (Questionnaire.QuestionnaireItemEnableWhenComponent e : element.getEnableWhen()) 
49357          composeQuestionnaireQuestionnaireItemEnableWhenComponent(null, e);
49358        closeArray();
49359      };
49360      if (element.hasEnableBehaviorElement()) {
49361        composeEnumerationCore("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
49362        composeEnumerationExtras("enableBehavior", element.getEnableBehaviorElement(), new Questionnaire.EnableWhenBehaviorEnumFactory(), false);
49363      }
49364      if (element.hasRequiredElement()) {
49365        composeBooleanCore("required", element.getRequiredElement(), false);
49366        composeBooleanExtras("required", element.getRequiredElement(), false);
49367      }
49368      if (element.hasRepeatsElement()) {
49369        composeBooleanCore("repeats", element.getRepeatsElement(), false);
49370        composeBooleanExtras("repeats", element.getRepeatsElement(), false);
49371      }
49372      if (element.hasReadOnlyElement()) {
49373        composeBooleanCore("readOnly", element.getReadOnlyElement(), false);
49374        composeBooleanExtras("readOnly", element.getReadOnlyElement(), false);
49375      }
49376      if (element.hasMaxLengthElement()) {
49377        composeIntegerCore("maxLength", element.getMaxLengthElement(), false);
49378        composeIntegerExtras("maxLength", element.getMaxLengthElement(), false);
49379      }
49380      if (element.hasAnswerValueSetElement()) {
49381        composeCanonicalCore("answerValueSet", element.getAnswerValueSetElement(), false);
49382        composeCanonicalExtras("answerValueSet", element.getAnswerValueSetElement(), false);
49383      }
49384      if (element.hasAnswerOption()) {
49385        openArray("answerOption");
49386        for (Questionnaire.QuestionnaireItemAnswerOptionComponent e : element.getAnswerOption()) 
49387          composeQuestionnaireQuestionnaireItemAnswerOptionComponent(null, e);
49388        closeArray();
49389      };
49390      if (element.hasInitial()) {
49391        openArray("initial");
49392        for (Questionnaire.QuestionnaireItemInitialComponent e : element.getInitial()) 
49393          composeQuestionnaireQuestionnaireItemInitialComponent(null, e);
49394        closeArray();
49395      };
49396      if (element.hasItem()) {
49397        openArray("item");
49398        for (Questionnaire.QuestionnaireItemComponent e : element.getItem()) 
49399          composeQuestionnaireQuestionnaireItemComponent(null, e);
49400        closeArray();
49401      };
49402  }
49403
49404  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponent(String name, Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
49405    if (element != null) {
49406      open(name);
49407      composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(element);
49408      close();
49409    }
49410  }
49411
49412  protected void composeQuestionnaireQuestionnaireItemEnableWhenComponentInner(Questionnaire.QuestionnaireItemEnableWhenComponent element) throws IOException {
49413      composeBackbone(element);
49414      if (element.hasQuestionElement()) {
49415        composeStringCore("question", element.getQuestionElement(), false);
49416        composeStringExtras("question", element.getQuestionElement(), false);
49417      }
49418      if (element.hasOperatorElement()) {
49419        composeEnumerationCore("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
49420        composeEnumerationExtras("operator", element.getOperatorElement(), new Questionnaire.QuestionnaireItemOperatorEnumFactory(), false);
49421      }
49422      if (element.hasAnswer()) {
49423        composeType("answer", element.getAnswer());
49424      }
49425  }
49426
49427  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponent(String name, Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
49428    if (element != null) {
49429      open(name);
49430      composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(element);
49431      close();
49432    }
49433  }
49434
49435  protected void composeQuestionnaireQuestionnaireItemAnswerOptionComponentInner(Questionnaire.QuestionnaireItemAnswerOptionComponent element) throws IOException {
49436      composeBackbone(element);
49437      if (element.hasValue()) {
49438        composeType("value", element.getValue());
49439      }
49440      if (element.hasInitialSelectedElement()) {
49441        composeBooleanCore("initialSelected", element.getInitialSelectedElement(), false);
49442        composeBooleanExtras("initialSelected", element.getInitialSelectedElement(), false);
49443      }
49444  }
49445
49446  protected void composeQuestionnaireQuestionnaireItemInitialComponent(String name, Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
49447    if (element != null) {
49448      open(name);
49449      composeQuestionnaireQuestionnaireItemInitialComponentInner(element);
49450      close();
49451    }
49452  }
49453
49454  protected void composeQuestionnaireQuestionnaireItemInitialComponentInner(Questionnaire.QuestionnaireItemInitialComponent element) throws IOException {
49455      composeBackbone(element);
49456      if (element.hasValue()) {
49457        composeType("value", element.getValue());
49458      }
49459  }
49460
49461  protected void composeQuestionnaireResponse(String name, QuestionnaireResponse element) throws IOException {
49462    if (element != null) {
49463      prop("resourceType", name);
49464      composeQuestionnaireResponseInner(element);
49465    }
49466  }
49467
49468  protected void composeQuestionnaireResponseInner(QuestionnaireResponse element) throws IOException {
49469      composeDomainResourceElements(element);
49470      if (element.hasIdentifier()) {
49471        composeIdentifier("identifier", element.getIdentifier());
49472      }
49473      if (element.hasBasedOn()) {
49474        openArray("basedOn");
49475        for (Reference e : element.getBasedOn()) 
49476          composeReference(null, e);
49477        closeArray();
49478      };
49479      if (element.hasPartOf()) {
49480        openArray("partOf");
49481        for (Reference e : element.getPartOf()) 
49482          composeReference(null, e);
49483        closeArray();
49484      };
49485      if (element.hasQuestionnaireElement()) {
49486        composeCanonicalCore("questionnaire", element.getQuestionnaireElement(), false);
49487        composeCanonicalExtras("questionnaire", element.getQuestionnaireElement(), false);
49488      }
49489      if (element.hasStatusElement()) {
49490        composeEnumerationCore("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
49491        composeEnumerationExtras("status", element.getStatusElement(), new QuestionnaireResponse.QuestionnaireResponseStatusEnumFactory(), false);
49492      }
49493      if (element.hasSubject()) {
49494        composeReference("subject", element.getSubject());
49495      }
49496      if (element.hasContext()) {
49497        composeReference("context", element.getContext());
49498      }
49499      if (element.hasAuthoredElement()) {
49500        composeDateTimeCore("authored", element.getAuthoredElement(), false);
49501        composeDateTimeExtras("authored", element.getAuthoredElement(), false);
49502      }
49503      if (element.hasAuthor()) {
49504        composeReference("author", element.getAuthor());
49505      }
49506      if (element.hasSource()) {
49507        composeReference("source", element.getSource());
49508      }
49509      if (element.hasItem()) {
49510        openArray("item");
49511        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
49512          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
49513        closeArray();
49514      };
49515  }
49516
49517  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
49518    if (element != null) {
49519      open(name);
49520      composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(element);
49521      close();
49522    }
49523  }
49524
49525  protected void composeQuestionnaireResponseQuestionnaireResponseItemComponentInner(QuestionnaireResponse.QuestionnaireResponseItemComponent element) throws IOException {
49526      composeBackbone(element);
49527      if (element.hasLinkIdElement()) {
49528        composeStringCore("linkId", element.getLinkIdElement(), false);
49529        composeStringExtras("linkId", element.getLinkIdElement(), false);
49530      }
49531      if (element.hasDefinitionElement()) {
49532        composeUriCore("definition", element.getDefinitionElement(), false);
49533        composeUriExtras("definition", element.getDefinitionElement(), false);
49534      }
49535      if (element.hasTextElement()) {
49536        composeStringCore("text", element.getTextElement(), false);
49537        composeStringExtras("text", element.getTextElement(), false);
49538      }
49539      if (element.hasAnswer()) {
49540        openArray("answer");
49541        for (QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent e : element.getAnswer()) 
49542          composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(null, e);
49543        closeArray();
49544      };
49545      if (element.hasItem()) {
49546        openArray("item");
49547        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
49548          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
49549        closeArray();
49550      };
49551  }
49552
49553  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponent(String name, QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
49554    if (element != null) {
49555      open(name);
49556      composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(element);
49557      close();
49558    }
49559  }
49560
49561  protected void composeQuestionnaireResponseQuestionnaireResponseItemAnswerComponentInner(QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent element) throws IOException {
49562      composeBackbone(element);
49563      if (element.hasValue()) {
49564        composeType("value", element.getValue());
49565      }
49566      if (element.hasItem()) {
49567        openArray("item");
49568        for (QuestionnaireResponse.QuestionnaireResponseItemComponent e : element.getItem()) 
49569          composeQuestionnaireResponseQuestionnaireResponseItemComponent(null, e);
49570        closeArray();
49571      };
49572  }
49573
49574  protected void composeRelatedPerson(String name, RelatedPerson element) throws IOException {
49575    if (element != null) {
49576      prop("resourceType", name);
49577      composeRelatedPersonInner(element);
49578    }
49579  }
49580
49581  protected void composeRelatedPersonInner(RelatedPerson element) throws IOException {
49582      composeDomainResourceElements(element);
49583      if (element.hasIdentifier()) {
49584        openArray("identifier");
49585        for (Identifier e : element.getIdentifier()) 
49586          composeIdentifier(null, e);
49587        closeArray();
49588      };
49589      if (element.hasActiveElement()) {
49590        composeBooleanCore("active", element.getActiveElement(), false);
49591        composeBooleanExtras("active", element.getActiveElement(), false);
49592      }
49593      if (element.hasPatient()) {
49594        composeReference("patient", element.getPatient());
49595      }
49596      if (element.hasRelationship()) {
49597        openArray("relationship");
49598        for (CodeableConcept e : element.getRelationship()) 
49599          composeCodeableConcept(null, e);
49600        closeArray();
49601      };
49602      if (element.hasName()) {
49603        openArray("name");
49604        for (HumanName e : element.getName()) 
49605          composeHumanName(null, e);
49606        closeArray();
49607      };
49608      if (element.hasTelecom()) {
49609        openArray("telecom");
49610        for (ContactPoint e : element.getTelecom()) 
49611          composeContactPoint(null, e);
49612        closeArray();
49613      };
49614      if (element.hasGenderElement()) {
49615        composeEnumerationCore("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49616        composeEnumerationExtras("gender", element.getGenderElement(), new Enumerations.AdministrativeGenderEnumFactory(), false);
49617      }
49618      if (element.hasBirthDateElement()) {
49619        composeDateCore("birthDate", element.getBirthDateElement(), false);
49620        composeDateExtras("birthDate", element.getBirthDateElement(), false);
49621      }
49622      if (element.hasAddress()) {
49623        openArray("address");
49624        for (Address e : element.getAddress()) 
49625          composeAddress(null, e);
49626        closeArray();
49627      };
49628      if (element.hasPhoto()) {
49629        openArray("photo");
49630        for (Attachment e : element.getPhoto()) 
49631          composeAttachment(null, e);
49632        closeArray();
49633      };
49634      if (element.hasPeriod()) {
49635        composePeriod("period", element.getPeriod());
49636      }
49637  }
49638
49639  protected void composeRequestGroup(String name, RequestGroup element) throws IOException {
49640    if (element != null) {
49641      prop("resourceType", name);
49642      composeRequestGroupInner(element);
49643    }
49644  }
49645
49646  protected void composeRequestGroupInner(RequestGroup element) throws IOException {
49647      composeDomainResourceElements(element);
49648      if (element.hasIdentifier()) {
49649        openArray("identifier");
49650        for (Identifier e : element.getIdentifier()) 
49651          composeIdentifier(null, e);
49652        closeArray();
49653      };
49654      if (element.hasInstantiatesCanonical()) {
49655        openArray("instantiatesCanonical");
49656        for (CanonicalType e : element.getInstantiatesCanonical()) 
49657          composeCanonicalCore(null, e, true);
49658        closeArray();
49659        if (anyHasExtras(element.getInstantiatesCanonical())) {
49660          openArray("_instantiatesCanonical");
49661          for (CanonicalType e : element.getInstantiatesCanonical()) 
49662            composeCanonicalExtras(null, e, true);
49663          closeArray();
49664        }
49665      };
49666      if (element.hasInstantiatesUri()) {
49667        openArray("instantiatesUri");
49668        for (UriType e : element.getInstantiatesUri()) 
49669          composeUriCore(null, e, true);
49670        closeArray();
49671        if (anyHasExtras(element.getInstantiatesUri())) {
49672          openArray("_instantiatesUri");
49673          for (UriType e : element.getInstantiatesUri()) 
49674            composeUriExtras(null, e, true);
49675          closeArray();
49676        }
49677      };
49678      if (element.hasBasedOn()) {
49679        openArray("basedOn");
49680        for (Reference e : element.getBasedOn()) 
49681          composeReference(null, e);
49682        closeArray();
49683      };
49684      if (element.hasReplaces()) {
49685        openArray("replaces");
49686        for (Reference e : element.getReplaces()) 
49687          composeReference(null, e);
49688        closeArray();
49689      };
49690      if (element.hasGroupIdentifier()) {
49691        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
49692      }
49693      if (element.hasStatusElement()) {
49694        composeEnumerationCore("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
49695        composeEnumerationExtras("status", element.getStatusElement(), new RequestGroup.RequestStatusEnumFactory(), false);
49696      }
49697      if (element.hasIntentElement()) {
49698        composeEnumerationCore("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
49699        composeEnumerationExtras("intent", element.getIntentElement(), new RequestGroup.RequestIntentEnumFactory(), false);
49700      }
49701      if (element.hasPriorityElement()) {
49702        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
49703        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
49704      }
49705      if (element.hasCode()) {
49706        composeCodeableConcept("code", element.getCode());
49707      }
49708      if (element.hasSubject()) {
49709        composeReference("subject", element.getSubject());
49710      }
49711      if (element.hasContext()) {
49712        composeReference("context", element.getContext());
49713      }
49714      if (element.hasAuthoredOnElement()) {
49715        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
49716        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
49717      }
49718      if (element.hasAuthor()) {
49719        composeReference("author", element.getAuthor());
49720      }
49721      if (element.hasReasonCode()) {
49722        openArray("reasonCode");
49723        for (CodeableConcept e : element.getReasonCode()) 
49724          composeCodeableConcept(null, e);
49725        closeArray();
49726      };
49727      if (element.hasReasonReference()) {
49728        openArray("reasonReference");
49729        for (Reference e : element.getReasonReference()) 
49730          composeReference(null, e);
49731        closeArray();
49732      };
49733      if (element.hasNote()) {
49734        openArray("note");
49735        for (Annotation e : element.getNote()) 
49736          composeAnnotation(null, e);
49737        closeArray();
49738      };
49739      if (element.hasAction()) {
49740        openArray("action");
49741        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
49742          composeRequestGroupRequestGroupActionComponent(null, e);
49743        closeArray();
49744      };
49745  }
49746
49747  protected void composeRequestGroupRequestGroupActionComponent(String name, RequestGroup.RequestGroupActionComponent element) throws IOException {
49748    if (element != null) {
49749      open(name);
49750      composeRequestGroupRequestGroupActionComponentInner(element);
49751      close();
49752    }
49753  }
49754
49755  protected void composeRequestGroupRequestGroupActionComponentInner(RequestGroup.RequestGroupActionComponent element) throws IOException {
49756      composeBackbone(element);
49757      if (element.hasPrefixElement()) {
49758        composeStringCore("prefix", element.getPrefixElement(), false);
49759        composeStringExtras("prefix", element.getPrefixElement(), false);
49760      }
49761      if (element.hasTitleElement()) {
49762        composeStringCore("title", element.getTitleElement(), false);
49763        composeStringExtras("title", element.getTitleElement(), false);
49764      }
49765      if (element.hasDescriptionElement()) {
49766        composeStringCore("description", element.getDescriptionElement(), false);
49767        composeStringExtras("description", element.getDescriptionElement(), false);
49768      }
49769      if (element.hasTextEquivalentElement()) {
49770        composeStringCore("textEquivalent", element.getTextEquivalentElement(), false);
49771        composeStringExtras("textEquivalent", element.getTextEquivalentElement(), false);
49772      }
49773      if (element.hasPriorityElement()) {
49774        composeEnumerationCore("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
49775        composeEnumerationExtras("priority", element.getPriorityElement(), new RequestGroup.RequestPriorityEnumFactory(), false);
49776      }
49777      if (element.hasCode()) {
49778        openArray("code");
49779        for (CodeableConcept e : element.getCode()) 
49780          composeCodeableConcept(null, e);
49781        closeArray();
49782      };
49783      if (element.hasDocumentation()) {
49784        openArray("documentation");
49785        for (RelatedArtifact e : element.getDocumentation()) 
49786          composeRelatedArtifact(null, e);
49787        closeArray();
49788      };
49789      if (element.hasCondition()) {
49790        openArray("condition");
49791        for (RequestGroup.RequestGroupActionConditionComponent e : element.getCondition()) 
49792          composeRequestGroupRequestGroupActionConditionComponent(null, e);
49793        closeArray();
49794      };
49795      if (element.hasRelatedAction()) {
49796        openArray("relatedAction");
49797        for (RequestGroup.RequestGroupActionRelatedActionComponent e : element.getRelatedAction()) 
49798          composeRequestGroupRequestGroupActionRelatedActionComponent(null, e);
49799        closeArray();
49800      };
49801      if (element.hasTiming()) {
49802        composeType("timing", element.getTiming());
49803      }
49804      if (element.hasParticipant()) {
49805        openArray("participant");
49806        for (Reference e : element.getParticipant()) 
49807          composeReference(null, e);
49808        closeArray();
49809      };
49810      if (element.hasType()) {
49811        composeCodeableConcept("type", element.getType());
49812      }
49813      if (element.hasGroupingBehaviorElement()) {
49814        composeEnumerationCore("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
49815        composeEnumerationExtras("groupingBehavior", element.getGroupingBehaviorElement(), new RequestGroup.ActionGroupingBehaviorEnumFactory(), false);
49816      }
49817      if (element.hasSelectionBehaviorElement()) {
49818        composeEnumerationCore("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
49819        composeEnumerationExtras("selectionBehavior", element.getSelectionBehaviorElement(), new RequestGroup.ActionSelectionBehaviorEnumFactory(), false);
49820      }
49821      if (element.hasRequiredBehaviorElement()) {
49822        composeEnumerationCore("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
49823        composeEnumerationExtras("requiredBehavior", element.getRequiredBehaviorElement(), new RequestGroup.ActionRequiredBehaviorEnumFactory(), false);
49824      }
49825      if (element.hasPrecheckBehaviorElement()) {
49826        composeEnumerationCore("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
49827        composeEnumerationExtras("precheckBehavior", element.getPrecheckBehaviorElement(), new RequestGroup.ActionPrecheckBehaviorEnumFactory(), false);
49828      }
49829      if (element.hasCardinalityBehaviorElement()) {
49830        composeEnumerationCore("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
49831        composeEnumerationExtras("cardinalityBehavior", element.getCardinalityBehaviorElement(), new RequestGroup.ActionCardinalityBehaviorEnumFactory(), false);
49832      }
49833      if (element.hasResource()) {
49834        composeReference("resource", element.getResource());
49835      }
49836      if (element.hasAction()) {
49837        openArray("action");
49838        for (RequestGroup.RequestGroupActionComponent e : element.getAction()) 
49839          composeRequestGroupRequestGroupActionComponent(null, e);
49840        closeArray();
49841      };
49842  }
49843
49844  protected void composeRequestGroupRequestGroupActionConditionComponent(String name, RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
49845    if (element != null) {
49846      open(name);
49847      composeRequestGroupRequestGroupActionConditionComponentInner(element);
49848      close();
49849    }
49850  }
49851
49852  protected void composeRequestGroupRequestGroupActionConditionComponentInner(RequestGroup.RequestGroupActionConditionComponent element) throws IOException {
49853      composeBackbone(element);
49854      if (element.hasKindElement()) {
49855        composeEnumerationCore("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
49856        composeEnumerationExtras("kind", element.getKindElement(), new RequestGroup.ActionConditionKindEnumFactory(), false);
49857      }
49858      if (element.hasDescriptionElement()) {
49859        composeStringCore("description", element.getDescriptionElement(), false);
49860        composeStringExtras("description", element.getDescriptionElement(), false);
49861      }
49862      if (element.hasLanguageElement()) {
49863        composeStringCore("language", element.getLanguageElement(), false);
49864        composeStringExtras("language", element.getLanguageElement(), false);
49865      }
49866      if (element.hasExpressionElement()) {
49867        composeStringCore("expression", element.getExpressionElement(), false);
49868        composeStringExtras("expression", element.getExpressionElement(), false);
49869      }
49870  }
49871
49872  protected void composeRequestGroupRequestGroupActionRelatedActionComponent(String name, RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
49873    if (element != null) {
49874      open(name);
49875      composeRequestGroupRequestGroupActionRelatedActionComponentInner(element);
49876      close();
49877    }
49878  }
49879
49880  protected void composeRequestGroupRequestGroupActionRelatedActionComponentInner(RequestGroup.RequestGroupActionRelatedActionComponent element) throws IOException {
49881      composeBackbone(element);
49882      if (element.hasActionIdElement()) {
49883        composeIdCore("actionId", element.getActionIdElement(), false);
49884        composeIdExtras("actionId", element.getActionIdElement(), false);
49885      }
49886      if (element.hasRelationshipElement()) {
49887        composeEnumerationCore("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
49888        composeEnumerationExtras("relationship", element.getRelationshipElement(), new RequestGroup.ActionRelationshipTypeEnumFactory(), false);
49889      }
49890      if (element.hasOffset()) {
49891        composeType("offset", element.getOffset());
49892      }
49893  }
49894
49895  protected void composeResearchStudy(String name, ResearchStudy element) throws IOException {
49896    if (element != null) {
49897      prop("resourceType", name);
49898      composeResearchStudyInner(element);
49899    }
49900  }
49901
49902  protected void composeResearchStudyInner(ResearchStudy element) throws IOException {
49903      composeDomainResourceElements(element);
49904      if (element.hasIdentifier()) {
49905        openArray("identifier");
49906        for (Identifier e : element.getIdentifier()) 
49907          composeIdentifier(null, e);
49908        closeArray();
49909      };
49910      if (element.hasTitleElement()) {
49911        composeStringCore("title", element.getTitleElement(), false);
49912        composeStringExtras("title", element.getTitleElement(), false);
49913      }
49914      if (element.hasProtocol()) {
49915        openArray("protocol");
49916        for (Reference e : element.getProtocol()) 
49917          composeReference(null, e);
49918        closeArray();
49919      };
49920      if (element.hasPartOf()) {
49921        openArray("partOf");
49922        for (Reference e : element.getPartOf()) 
49923          composeReference(null, e);
49924        closeArray();
49925      };
49926      if (element.hasStatusElement()) {
49927        composeEnumerationCore("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
49928        composeEnumerationExtras("status", element.getStatusElement(), new ResearchStudy.ResearchStudyStatusEnumFactory(), false);
49929      }
49930      if (element.hasPrimaryPurposeType()) {
49931        composeCodeableConcept("primaryPurposeType", element.getPrimaryPurposeType());
49932      }
49933      if (element.hasPhase()) {
49934        composeCodeableConcept("phase", element.getPhase());
49935      }
49936      if (element.hasCategory()) {
49937        openArray("category");
49938        for (CodeableConcept e : element.getCategory()) 
49939          composeCodeableConcept(null, e);
49940        closeArray();
49941      };
49942      if (element.hasFocus()) {
49943        openArray("focus");
49944        for (CodeableConcept e : element.getFocus()) 
49945          composeCodeableConcept(null, e);
49946        closeArray();
49947      };
49948      if (element.hasCondition()) {
49949        openArray("condition");
49950        for (CodeableConcept e : element.getCondition()) 
49951          composeCodeableConcept(null, e);
49952        closeArray();
49953      };
49954      if (element.hasContact()) {
49955        openArray("contact");
49956        for (ContactDetail e : element.getContact()) 
49957          composeContactDetail(null, e);
49958        closeArray();
49959      };
49960      if (element.hasRelatedArtifact()) {
49961        openArray("relatedArtifact");
49962        for (RelatedArtifact e : element.getRelatedArtifact()) 
49963          composeRelatedArtifact(null, e);
49964        closeArray();
49965      };
49966      if (element.hasKeyword()) {
49967        openArray("keyword");
49968        for (CodeableConcept e : element.getKeyword()) 
49969          composeCodeableConcept(null, e);
49970        closeArray();
49971      };
49972      if (element.hasLocation()) {
49973        openArray("location");
49974        for (CodeableConcept e : element.getLocation()) 
49975          composeCodeableConcept(null, e);
49976        closeArray();
49977      };
49978      if (element.hasDescriptionElement()) {
49979        composeMarkdownCore("description", element.getDescriptionElement(), false);
49980        composeMarkdownExtras("description", element.getDescriptionElement(), false);
49981      }
49982      if (element.hasEnrollment()) {
49983        openArray("enrollment");
49984        for (Reference e : element.getEnrollment()) 
49985          composeReference(null, e);
49986        closeArray();
49987      };
49988      if (element.hasPeriod()) {
49989        composePeriod("period", element.getPeriod());
49990      }
49991      if (element.hasSponsor()) {
49992        composeReference("sponsor", element.getSponsor());
49993      }
49994      if (element.hasPrincipalInvestigator()) {
49995        composeReference("principalInvestigator", element.getPrincipalInvestigator());
49996      }
49997      if (element.hasSite()) {
49998        openArray("site");
49999        for (Reference e : element.getSite()) 
50000          composeReference(null, e);
50001        closeArray();
50002      };
50003      if (element.hasReasonStopped()) {
50004        composeCodeableConcept("reasonStopped", element.getReasonStopped());
50005      }
50006      if (element.hasNote()) {
50007        openArray("note");
50008        for (Annotation e : element.getNote()) 
50009          composeAnnotation(null, e);
50010        closeArray();
50011      };
50012      if (element.hasArm()) {
50013        openArray("arm");
50014        for (ResearchStudy.ResearchStudyArmComponent e : element.getArm()) 
50015          composeResearchStudyResearchStudyArmComponent(null, e);
50016        closeArray();
50017      };
50018      if (element.hasObjective()) {
50019        openArray("objective");
50020        for (ResearchStudy.ResearchStudyObjectiveComponent e : element.getObjective()) 
50021          composeResearchStudyResearchStudyObjectiveComponent(null, e);
50022        closeArray();
50023      };
50024  }
50025
50026  protected void composeResearchStudyResearchStudyArmComponent(String name, ResearchStudy.ResearchStudyArmComponent element) throws IOException {
50027    if (element != null) {
50028      open(name);
50029      composeResearchStudyResearchStudyArmComponentInner(element);
50030      close();
50031    }
50032  }
50033
50034  protected void composeResearchStudyResearchStudyArmComponentInner(ResearchStudy.ResearchStudyArmComponent element) throws IOException {
50035      composeBackbone(element);
50036      if (element.hasNameElement()) {
50037        composeStringCore("name", element.getNameElement(), false);
50038        composeStringExtras("name", element.getNameElement(), false);
50039      }
50040      if (element.hasType()) {
50041        composeCodeableConcept("type", element.getType());
50042      }
50043      if (element.hasDescriptionElement()) {
50044        composeStringCore("description", element.getDescriptionElement(), false);
50045        composeStringExtras("description", element.getDescriptionElement(), false);
50046      }
50047  }
50048
50049  protected void composeResearchStudyResearchStudyObjectiveComponent(String name, ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
50050    if (element != null) {
50051      open(name);
50052      composeResearchStudyResearchStudyObjectiveComponentInner(element);
50053      close();
50054    }
50055  }
50056
50057  protected void composeResearchStudyResearchStudyObjectiveComponentInner(ResearchStudy.ResearchStudyObjectiveComponent element) throws IOException {
50058      composeBackbone(element);
50059      if (element.hasNameElement()) {
50060        composeStringCore("name", element.getNameElement(), false);
50061        composeStringExtras("name", element.getNameElement(), false);
50062      }
50063      if (element.hasType()) {
50064        composeCodeableConcept("type", element.getType());
50065      }
50066  }
50067
50068  protected void composeResearchSubject(String name, ResearchSubject element) throws IOException {
50069    if (element != null) {
50070      prop("resourceType", name);
50071      composeResearchSubjectInner(element);
50072    }
50073  }
50074
50075  protected void composeResearchSubjectInner(ResearchSubject element) throws IOException {
50076      composeDomainResourceElements(element);
50077      if (element.hasIdentifier()) {
50078        openArray("identifier");
50079        for (Identifier e : element.getIdentifier()) 
50080          composeIdentifier(null, e);
50081        closeArray();
50082      };
50083      if (element.hasStatusElement()) {
50084        composeEnumerationCore("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
50085        composeEnumerationExtras("status", element.getStatusElement(), new ResearchSubject.ResearchSubjectStatusEnumFactory(), false);
50086      }
50087      if (element.hasPeriod()) {
50088        composePeriod("period", element.getPeriod());
50089      }
50090      if (element.hasStudy()) {
50091        composeReference("study", element.getStudy());
50092      }
50093      if (element.hasIndividual()) {
50094        composeReference("individual", element.getIndividual());
50095      }
50096      if (element.hasAssignedArmElement()) {
50097        composeStringCore("assignedArm", element.getAssignedArmElement(), false);
50098        composeStringExtras("assignedArm", element.getAssignedArmElement(), false);
50099      }
50100      if (element.hasActualArmElement()) {
50101        composeStringCore("actualArm", element.getActualArmElement(), false);
50102        composeStringExtras("actualArm", element.getActualArmElement(), false);
50103      }
50104      if (element.hasConsent()) {
50105        composeReference("consent", element.getConsent());
50106      }
50107  }
50108
50109  protected void composeRiskAssessment(String name, RiskAssessment element) throws IOException {
50110    if (element != null) {
50111      prop("resourceType", name);
50112      composeRiskAssessmentInner(element);
50113    }
50114  }
50115
50116  protected void composeRiskAssessmentInner(RiskAssessment element) throws IOException {
50117      composeDomainResourceElements(element);
50118      if (element.hasIdentifier()) {
50119        openArray("identifier");
50120        for (Identifier e : element.getIdentifier()) 
50121          composeIdentifier(null, e);
50122        closeArray();
50123      };
50124      if (element.hasBasedOn()) {
50125        composeReference("basedOn", element.getBasedOn());
50126      }
50127      if (element.hasParent()) {
50128        composeReference("parent", element.getParent());
50129      }
50130      if (element.hasStatusElement()) {
50131        composeEnumerationCore("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
50132        composeEnumerationExtras("status", element.getStatusElement(), new RiskAssessment.RiskAssessmentStatusEnumFactory(), false);
50133      }
50134      if (element.hasMethod()) {
50135        composeCodeableConcept("method", element.getMethod());
50136      }
50137      if (element.hasCode()) {
50138        composeCodeableConcept("code", element.getCode());
50139      }
50140      if (element.hasSubject()) {
50141        composeReference("subject", element.getSubject());
50142      }
50143      if (element.hasContext()) {
50144        composeReference("context", element.getContext());
50145      }
50146      if (element.hasOccurrence()) {
50147        composeType("occurrence", element.getOccurrence());
50148      }
50149      if (element.hasCondition()) {
50150        composeReference("condition", element.getCondition());
50151      }
50152      if (element.hasPerformer()) {
50153        composeReference("performer", element.getPerformer());
50154      }
50155      if (element.hasReasonCode()) {
50156        openArray("reasonCode");
50157        for (CodeableConcept e : element.getReasonCode()) 
50158          composeCodeableConcept(null, e);
50159        closeArray();
50160      };
50161      if (element.hasReasonReference()) {
50162        openArray("reasonReference");
50163        for (Reference e : element.getReasonReference()) 
50164          composeReference(null, e);
50165        closeArray();
50166      };
50167      if (element.hasBasis()) {
50168        openArray("basis");
50169        for (Reference e : element.getBasis()) 
50170          composeReference(null, e);
50171        closeArray();
50172      };
50173      if (element.hasPrediction()) {
50174        openArray("prediction");
50175        for (RiskAssessment.RiskAssessmentPredictionComponent e : element.getPrediction()) 
50176          composeRiskAssessmentRiskAssessmentPredictionComponent(null, e);
50177        closeArray();
50178      };
50179      if (element.hasMitigationElement()) {
50180        composeStringCore("mitigation", element.getMitigationElement(), false);
50181        composeStringExtras("mitigation", element.getMitigationElement(), false);
50182      }
50183      if (element.hasNote()) {
50184        openArray("note");
50185        for (Annotation e : element.getNote()) 
50186          composeAnnotation(null, e);
50187        closeArray();
50188      };
50189  }
50190
50191  protected void composeRiskAssessmentRiskAssessmentPredictionComponent(String name, RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
50192    if (element != null) {
50193      open(name);
50194      composeRiskAssessmentRiskAssessmentPredictionComponentInner(element);
50195      close();
50196    }
50197  }
50198
50199  protected void composeRiskAssessmentRiskAssessmentPredictionComponentInner(RiskAssessment.RiskAssessmentPredictionComponent element) throws IOException {
50200      composeBackbone(element);
50201      if (element.hasOutcome()) {
50202        composeCodeableConcept("outcome", element.getOutcome());
50203      }
50204      if (element.hasProbability()) {
50205        composeType("probability", element.getProbability());
50206      }
50207      if (element.hasQualitativeRisk()) {
50208        composeCodeableConcept("qualitativeRisk", element.getQualitativeRisk());
50209      }
50210      if (element.hasRelativeRiskElement()) {
50211        composeDecimalCore("relativeRisk", element.getRelativeRiskElement(), false);
50212        composeDecimalExtras("relativeRisk", element.getRelativeRiskElement(), false);
50213      }
50214      if (element.hasWhen()) {
50215        composeType("when", element.getWhen());
50216      }
50217      if (element.hasRationaleElement()) {
50218        composeStringCore("rationale", element.getRationaleElement(), false);
50219        composeStringExtras("rationale", element.getRationaleElement(), false);
50220      }
50221  }
50222
50223  protected void composeSchedule(String name, Schedule element) throws IOException {
50224    if (element != null) {
50225      prop("resourceType", name);
50226      composeScheduleInner(element);
50227    }
50228  }
50229
50230  protected void composeScheduleInner(Schedule element) throws IOException {
50231      composeDomainResourceElements(element);
50232      if (element.hasIdentifier()) {
50233        openArray("identifier");
50234        for (Identifier e : element.getIdentifier()) 
50235          composeIdentifier(null, e);
50236        closeArray();
50237      };
50238      if (element.hasActiveElement()) {
50239        composeBooleanCore("active", element.getActiveElement(), false);
50240        composeBooleanExtras("active", element.getActiveElement(), false);
50241      }
50242      if (element.hasServiceCategory()) {
50243        openArray("serviceCategory");
50244        for (CodeableConcept e : element.getServiceCategory()) 
50245          composeCodeableConcept(null, e);
50246        closeArray();
50247      };
50248      if (element.hasServiceType()) {
50249        openArray("serviceType");
50250        for (CodeableConcept e : element.getServiceType()) 
50251          composeCodeableConcept(null, e);
50252        closeArray();
50253      };
50254      if (element.hasSpecialty()) {
50255        openArray("specialty");
50256        for (CodeableConcept e : element.getSpecialty()) 
50257          composeCodeableConcept(null, e);
50258        closeArray();
50259      };
50260      if (element.hasActor()) {
50261        openArray("actor");
50262        for (Reference e : element.getActor()) 
50263          composeReference(null, e);
50264        closeArray();
50265      };
50266      if (element.hasPlanningHorizon()) {
50267        composePeriod("planningHorizon", element.getPlanningHorizon());
50268      }
50269      if (element.hasCommentElement()) {
50270        composeStringCore("comment", element.getCommentElement(), false);
50271        composeStringExtras("comment", element.getCommentElement(), false);
50272      }
50273  }
50274
50275  protected void composeSearchParameter(String name, SearchParameter element) throws IOException {
50276    if (element != null) {
50277      prop("resourceType", name);
50278      composeSearchParameterInner(element);
50279    }
50280  }
50281
50282  protected void composeSearchParameterInner(SearchParameter element) throws IOException {
50283      composeDomainResourceElements(element);
50284      if (element.hasUrlElement()) {
50285        composeUriCore("url", element.getUrlElement(), false);
50286        composeUriExtras("url", element.getUrlElement(), false);
50287      }
50288      if (element.hasVersionElement()) {
50289        composeStringCore("version", element.getVersionElement(), false);
50290        composeStringExtras("version", element.getVersionElement(), false);
50291      }
50292      if (element.hasNameElement()) {
50293        composeStringCore("name", element.getNameElement(), false);
50294        composeStringExtras("name", element.getNameElement(), false);
50295      }
50296      if (element.hasDerivedFromElement()) {
50297        composeCanonicalCore("derivedFrom", element.getDerivedFromElement(), false);
50298        composeCanonicalExtras("derivedFrom", element.getDerivedFromElement(), false);
50299      }
50300      if (element.hasStatusElement()) {
50301        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50302        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
50303      }
50304      if (element.hasExperimentalElement()) {
50305        composeBooleanCore("experimental", element.getExperimentalElement(), false);
50306        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
50307      }
50308      if (element.hasDateElement()) {
50309        composeDateTimeCore("date", element.getDateElement(), false);
50310        composeDateTimeExtras("date", element.getDateElement(), false);
50311      }
50312      if (element.hasPublisherElement()) {
50313        composeStringCore("publisher", element.getPublisherElement(), false);
50314        composeStringExtras("publisher", element.getPublisherElement(), false);
50315      }
50316      if (element.hasContact()) {
50317        openArray("contact");
50318        for (ContactDetail e : element.getContact()) 
50319          composeContactDetail(null, e);
50320        closeArray();
50321      };
50322      if (element.hasDescriptionElement()) {
50323        composeMarkdownCore("description", element.getDescriptionElement(), false);
50324        composeMarkdownExtras("description", element.getDescriptionElement(), false);
50325      }
50326      if (element.hasUseContext()) {
50327        openArray("useContext");
50328        for (UsageContext e : element.getUseContext()) 
50329          composeUsageContext(null, e);
50330        closeArray();
50331      };
50332      if (element.hasJurisdiction()) {
50333        openArray("jurisdiction");
50334        for (CodeableConcept e : element.getJurisdiction()) 
50335          composeCodeableConcept(null, e);
50336        closeArray();
50337      };
50338      if (element.hasPurposeElement()) {
50339        composeMarkdownCore("purpose", element.getPurposeElement(), false);
50340        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
50341      }
50342      if (element.hasCodeElement()) {
50343        composeCodeCore("code", element.getCodeElement(), false);
50344        composeCodeExtras("code", element.getCodeElement(), false);
50345      }
50346      if (element.hasBase()) {
50347        openArray("base");
50348        for (CodeType e : element.getBase()) 
50349          composeCodeCore(null, e, true);
50350        closeArray();
50351        if (anyHasExtras(element.getBase())) {
50352          openArray("_base");
50353          for (CodeType e : element.getBase()) 
50354            composeCodeExtras(null, e, true);
50355          closeArray();
50356        }
50357      };
50358      if (element.hasTypeElement()) {
50359        composeEnumerationCore("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
50360        composeEnumerationExtras("type", element.getTypeElement(), new Enumerations.SearchParamTypeEnumFactory(), false);
50361      }
50362      if (element.hasExpressionElement()) {
50363        composeStringCore("expression", element.getExpressionElement(), false);
50364        composeStringExtras("expression", element.getExpressionElement(), false);
50365      }
50366      if (element.hasXpathElement()) {
50367        composeStringCore("xpath", element.getXpathElement(), false);
50368        composeStringExtras("xpath", element.getXpathElement(), false);
50369      }
50370      if (element.hasXpathUsageElement()) {
50371        composeEnumerationCore("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
50372        composeEnumerationExtras("xpathUsage", element.getXpathUsageElement(), new SearchParameter.XPathUsageTypeEnumFactory(), false);
50373      }
50374      if (element.hasTarget()) {
50375        openArray("target");
50376        for (CodeType e : element.getTarget()) 
50377          composeCodeCore(null, e, true);
50378        closeArray();
50379        if (anyHasExtras(element.getTarget())) {
50380          openArray("_target");
50381          for (CodeType e : element.getTarget()) 
50382            composeCodeExtras(null, e, true);
50383          closeArray();
50384        }
50385      };
50386      if (element.hasMultipleOrElement()) {
50387        composeBooleanCore("multipleOr", element.getMultipleOrElement(), false);
50388        composeBooleanExtras("multipleOr", element.getMultipleOrElement(), false);
50389      }
50390      if (element.hasMultipleAndElement()) {
50391        composeBooleanCore("multipleAnd", element.getMultipleAndElement(), false);
50392        composeBooleanExtras("multipleAnd", element.getMultipleAndElement(), false);
50393      }
50394      if (element.hasComparator()) {
50395        openArray("comparator");
50396        for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
50397          composeEnumerationCore(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
50398        closeArray();
50399        if (anyHasExtras(element.getComparator())) {
50400          openArray("_comparator");
50401          for (Enumeration<SearchParameter.SearchComparator> e : element.getComparator()) 
50402            composeEnumerationExtras(null, e, new SearchParameter.SearchComparatorEnumFactory(), true);
50403          closeArray();
50404        }
50405      };
50406      if (element.hasModifier()) {
50407        openArray("modifier");
50408        for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
50409          composeEnumerationCore(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
50410        closeArray();
50411        if (anyHasExtras(element.getModifier())) {
50412          openArray("_modifier");
50413          for (Enumeration<SearchParameter.SearchModifierCode> e : element.getModifier()) 
50414            composeEnumerationExtras(null, e, new SearchParameter.SearchModifierCodeEnumFactory(), true);
50415          closeArray();
50416        }
50417      };
50418      if (element.hasChain()) {
50419        openArray("chain");
50420        for (StringType e : element.getChain()) 
50421          composeStringCore(null, e, true);
50422        closeArray();
50423        if (anyHasExtras(element.getChain())) {
50424          openArray("_chain");
50425          for (StringType e : element.getChain()) 
50426            composeStringExtras(null, e, true);
50427          closeArray();
50428        }
50429      };
50430      if (element.hasComponent()) {
50431        openArray("component");
50432        for (SearchParameter.SearchParameterComponentComponent e : element.getComponent()) 
50433          composeSearchParameterSearchParameterComponentComponent(null, e);
50434        closeArray();
50435      };
50436  }
50437
50438  protected void composeSearchParameterSearchParameterComponentComponent(String name, SearchParameter.SearchParameterComponentComponent element) throws IOException {
50439    if (element != null) {
50440      open(name);
50441      composeSearchParameterSearchParameterComponentComponentInner(element);
50442      close();
50443    }
50444  }
50445
50446  protected void composeSearchParameterSearchParameterComponentComponentInner(SearchParameter.SearchParameterComponentComponent element) throws IOException {
50447      composeBackbone(element);
50448      if (element.hasDefinitionElement()) {
50449        composeCanonicalCore("definition", element.getDefinitionElement(), false);
50450        composeCanonicalExtras("definition", element.getDefinitionElement(), false);
50451      }
50452      if (element.hasExpressionElement()) {
50453        composeStringCore("expression", element.getExpressionElement(), false);
50454        composeStringExtras("expression", element.getExpressionElement(), false);
50455      }
50456  }
50457
50458  protected void composeSequence(String name, Sequence element) throws IOException {
50459    if (element != null) {
50460      prop("resourceType", name);
50461      composeSequenceInner(element);
50462    }
50463  }
50464
50465  protected void composeSequenceInner(Sequence element) throws IOException {
50466      composeDomainResourceElements(element);
50467      if (element.hasIdentifier()) {
50468        openArray("identifier");
50469        for (Identifier e : element.getIdentifier()) 
50470          composeIdentifier(null, e);
50471        closeArray();
50472      };
50473      if (element.hasTypeElement()) {
50474        composeEnumerationCore("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
50475        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.SequenceTypeEnumFactory(), false);
50476      }
50477      if (element.hasCoordinateSystemElement()) {
50478        composeIntegerCore("coordinateSystem", element.getCoordinateSystemElement(), false);
50479        composeIntegerExtras("coordinateSystem", element.getCoordinateSystemElement(), false);
50480      }
50481      if (element.hasPatient()) {
50482        composeReference("patient", element.getPatient());
50483      }
50484      if (element.hasSpecimen()) {
50485        composeReference("specimen", element.getSpecimen());
50486      }
50487      if (element.hasDevice()) {
50488        composeReference("device", element.getDevice());
50489      }
50490      if (element.hasPerformer()) {
50491        composeReference("performer", element.getPerformer());
50492      }
50493      if (element.hasQuantity()) {
50494        composeQuantity("quantity", element.getQuantity());
50495      }
50496      if (element.hasReferenceSeq()) {
50497        composeSequenceSequenceReferenceSeqComponent("referenceSeq", element.getReferenceSeq());
50498      }
50499      if (element.hasVariant()) {
50500        openArray("variant");
50501        for (Sequence.SequenceVariantComponent e : element.getVariant()) 
50502          composeSequenceSequenceVariantComponent(null, e);
50503        closeArray();
50504      };
50505      if (element.hasObservedSeqElement()) {
50506        composeStringCore("observedSeq", element.getObservedSeqElement(), false);
50507        composeStringExtras("observedSeq", element.getObservedSeqElement(), false);
50508      }
50509      if (element.hasQuality()) {
50510        openArray("quality");
50511        for (Sequence.SequenceQualityComponent e : element.getQuality()) 
50512          composeSequenceSequenceQualityComponent(null, e);
50513        closeArray();
50514      };
50515      if (element.hasReadCoverageElement()) {
50516        composeIntegerCore("readCoverage", element.getReadCoverageElement(), false);
50517        composeIntegerExtras("readCoverage", element.getReadCoverageElement(), false);
50518      }
50519      if (element.hasRepository()) {
50520        openArray("repository");
50521        for (Sequence.SequenceRepositoryComponent e : element.getRepository()) 
50522          composeSequenceSequenceRepositoryComponent(null, e);
50523        closeArray();
50524      };
50525      if (element.hasPointer()) {
50526        openArray("pointer");
50527        for (Reference e : element.getPointer()) 
50528          composeReference(null, e);
50529        closeArray();
50530      };
50531      if (element.hasStructureVariant()) {
50532        openArray("structureVariant");
50533        for (Sequence.SequenceStructureVariantComponent e : element.getStructureVariant()) 
50534          composeSequenceSequenceStructureVariantComponent(null, e);
50535        closeArray();
50536      };
50537  }
50538
50539  protected void composeSequenceSequenceReferenceSeqComponent(String name, Sequence.SequenceReferenceSeqComponent element) throws IOException {
50540    if (element != null) {
50541      open(name);
50542      composeSequenceSequenceReferenceSeqComponentInner(element);
50543      close();
50544    }
50545  }
50546
50547  protected void composeSequenceSequenceReferenceSeqComponentInner(Sequence.SequenceReferenceSeqComponent element) throws IOException {
50548      composeBackbone(element);
50549      if (element.hasChromosome()) {
50550        composeCodeableConcept("chromosome", element.getChromosome());
50551      }
50552      if (element.hasGenomeBuildElement()) {
50553        composeStringCore("genomeBuild", element.getGenomeBuildElement(), false);
50554        composeStringExtras("genomeBuild", element.getGenomeBuildElement(), false);
50555      }
50556      if (element.hasOrientationElement()) {
50557        composeEnumerationCore("orientation", element.getOrientationElement(), new Sequence.OrientationTypeEnumFactory(), false);
50558        composeEnumerationExtras("orientation", element.getOrientationElement(), new Sequence.OrientationTypeEnumFactory(), false);
50559      }
50560      if (element.hasReferenceSeqId()) {
50561        composeCodeableConcept("referenceSeqId", element.getReferenceSeqId());
50562      }
50563      if (element.hasReferenceSeqPointer()) {
50564        composeReference("referenceSeqPointer", element.getReferenceSeqPointer());
50565      }
50566      if (element.hasReferenceSeqStringElement()) {
50567        composeStringCore("referenceSeqString", element.getReferenceSeqStringElement(), false);
50568        composeStringExtras("referenceSeqString", element.getReferenceSeqStringElement(), false);
50569      }
50570      if (element.hasStrandElement()) {
50571        composeEnumerationCore("strand", element.getStrandElement(), new Sequence.StrandTypeEnumFactory(), false);
50572        composeEnumerationExtras("strand", element.getStrandElement(), new Sequence.StrandTypeEnumFactory(), false);
50573      }
50574      if (element.hasWindowStartElement()) {
50575        composeIntegerCore("windowStart", element.getWindowStartElement(), false);
50576        composeIntegerExtras("windowStart", element.getWindowStartElement(), false);
50577      }
50578      if (element.hasWindowEndElement()) {
50579        composeIntegerCore("windowEnd", element.getWindowEndElement(), false);
50580        composeIntegerExtras("windowEnd", element.getWindowEndElement(), false);
50581      }
50582  }
50583
50584  protected void composeSequenceSequenceVariantComponent(String name, Sequence.SequenceVariantComponent element) throws IOException {
50585    if (element != null) {
50586      open(name);
50587      composeSequenceSequenceVariantComponentInner(element);
50588      close();
50589    }
50590  }
50591
50592  protected void composeSequenceSequenceVariantComponentInner(Sequence.SequenceVariantComponent element) throws IOException {
50593      composeBackbone(element);
50594      if (element.hasStartElement()) {
50595        composeIntegerCore("start", element.getStartElement(), false);
50596        composeIntegerExtras("start", element.getStartElement(), false);
50597      }
50598      if (element.hasEndElement()) {
50599        composeIntegerCore("end", element.getEndElement(), false);
50600        composeIntegerExtras("end", element.getEndElement(), false);
50601      }
50602      if (element.hasObservedAlleleElement()) {
50603        composeStringCore("observedAllele", element.getObservedAlleleElement(), false);
50604        composeStringExtras("observedAllele", element.getObservedAlleleElement(), false);
50605      }
50606      if (element.hasReferenceAlleleElement()) {
50607        composeStringCore("referenceAllele", element.getReferenceAlleleElement(), false);
50608        composeStringExtras("referenceAllele", element.getReferenceAlleleElement(), false);
50609      }
50610      if (element.hasCigarElement()) {
50611        composeStringCore("cigar", element.getCigarElement(), false);
50612        composeStringExtras("cigar", element.getCigarElement(), false);
50613      }
50614      if (element.hasVariantPointer()) {
50615        composeReference("variantPointer", element.getVariantPointer());
50616      }
50617  }
50618
50619  protected void composeSequenceSequenceQualityComponent(String name, Sequence.SequenceQualityComponent element) throws IOException {
50620    if (element != null) {
50621      open(name);
50622      composeSequenceSequenceQualityComponentInner(element);
50623      close();
50624    }
50625  }
50626
50627  protected void composeSequenceSequenceQualityComponentInner(Sequence.SequenceQualityComponent element) throws IOException {
50628      composeBackbone(element);
50629      if (element.hasTypeElement()) {
50630        composeEnumerationCore("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory(), false);
50631        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.QualityTypeEnumFactory(), false);
50632      }
50633      if (element.hasStandardSequence()) {
50634        composeCodeableConcept("standardSequence", element.getStandardSequence());
50635      }
50636      if (element.hasStartElement()) {
50637        composeIntegerCore("start", element.getStartElement(), false);
50638        composeIntegerExtras("start", element.getStartElement(), false);
50639      }
50640      if (element.hasEndElement()) {
50641        composeIntegerCore("end", element.getEndElement(), false);
50642        composeIntegerExtras("end", element.getEndElement(), false);
50643      }
50644      if (element.hasScore()) {
50645        composeQuantity("score", element.getScore());
50646      }
50647      if (element.hasMethod()) {
50648        composeCodeableConcept("method", element.getMethod());
50649      }
50650      if (element.hasTruthTPElement()) {
50651        composeDecimalCore("truthTP", element.getTruthTPElement(), false);
50652        composeDecimalExtras("truthTP", element.getTruthTPElement(), false);
50653      }
50654      if (element.hasQueryTPElement()) {
50655        composeDecimalCore("queryTP", element.getQueryTPElement(), false);
50656        composeDecimalExtras("queryTP", element.getQueryTPElement(), false);
50657      }
50658      if (element.hasTruthFNElement()) {
50659        composeDecimalCore("truthFN", element.getTruthFNElement(), false);
50660        composeDecimalExtras("truthFN", element.getTruthFNElement(), false);
50661      }
50662      if (element.hasQueryFPElement()) {
50663        composeDecimalCore("queryFP", element.getQueryFPElement(), false);
50664        composeDecimalExtras("queryFP", element.getQueryFPElement(), false);
50665      }
50666      if (element.hasGtFPElement()) {
50667        composeDecimalCore("gtFP", element.getGtFPElement(), false);
50668        composeDecimalExtras("gtFP", element.getGtFPElement(), false);
50669      }
50670      if (element.hasPrecisionElement()) {
50671        composeDecimalCore("precision", element.getPrecisionElement(), false);
50672        composeDecimalExtras("precision", element.getPrecisionElement(), false);
50673      }
50674      if (element.hasRecallElement()) {
50675        composeDecimalCore("recall", element.getRecallElement(), false);
50676        composeDecimalExtras("recall", element.getRecallElement(), false);
50677      }
50678      if (element.hasFScoreElement()) {
50679        composeDecimalCore("fScore", element.getFScoreElement(), false);
50680        composeDecimalExtras("fScore", element.getFScoreElement(), false);
50681      }
50682      if (element.hasRoc()) {
50683        composeSequenceSequenceQualityRocComponent("roc", element.getRoc());
50684      }
50685  }
50686
50687  protected void composeSequenceSequenceQualityRocComponent(String name, Sequence.SequenceQualityRocComponent element) throws IOException {
50688    if (element != null) {
50689      open(name);
50690      composeSequenceSequenceQualityRocComponentInner(element);
50691      close();
50692    }
50693  }
50694
50695  protected void composeSequenceSequenceQualityRocComponentInner(Sequence.SequenceQualityRocComponent element) throws IOException {
50696      composeBackbone(element);
50697      if (element.hasScore()) {
50698        openArray("score");
50699        for (IntegerType e : element.getScore()) 
50700          composeIntegerCore(null, e, true);
50701        closeArray();
50702        if (anyHasExtras(element.getScore())) {
50703          openArray("_score");
50704          for (IntegerType e : element.getScore()) 
50705            composeIntegerExtras(null, e, true);
50706          closeArray();
50707        }
50708      };
50709      if (element.hasNumTP()) {
50710        openArray("numTP");
50711        for (IntegerType e : element.getNumTP()) 
50712          composeIntegerCore(null, e, true);
50713        closeArray();
50714        if (anyHasExtras(element.getNumTP())) {
50715          openArray("_numTP");
50716          for (IntegerType e : element.getNumTP()) 
50717            composeIntegerExtras(null, e, true);
50718          closeArray();
50719        }
50720      };
50721      if (element.hasNumFP()) {
50722        openArray("numFP");
50723        for (IntegerType e : element.getNumFP()) 
50724          composeIntegerCore(null, e, true);
50725        closeArray();
50726        if (anyHasExtras(element.getNumFP())) {
50727          openArray("_numFP");
50728          for (IntegerType e : element.getNumFP()) 
50729            composeIntegerExtras(null, e, true);
50730          closeArray();
50731        }
50732      };
50733      if (element.hasNumFN()) {
50734        openArray("numFN");
50735        for (IntegerType e : element.getNumFN()) 
50736          composeIntegerCore(null, e, true);
50737        closeArray();
50738        if (anyHasExtras(element.getNumFN())) {
50739          openArray("_numFN");
50740          for (IntegerType e : element.getNumFN()) 
50741            composeIntegerExtras(null, e, true);
50742          closeArray();
50743        }
50744      };
50745      if (element.hasPrecision()) {
50746        openArray("precision");
50747        for (DecimalType e : element.getPrecision()) 
50748          composeDecimalCore(null, e, true);
50749        closeArray();
50750        if (anyHasExtras(element.getPrecision())) {
50751          openArray("_precision");
50752          for (DecimalType e : element.getPrecision()) 
50753            composeDecimalExtras(null, e, true);
50754          closeArray();
50755        }
50756      };
50757      if (element.hasSensitivity()) {
50758        openArray("sensitivity");
50759        for (DecimalType e : element.getSensitivity()) 
50760          composeDecimalCore(null, e, true);
50761        closeArray();
50762        if (anyHasExtras(element.getSensitivity())) {
50763          openArray("_sensitivity");
50764          for (DecimalType e : element.getSensitivity()) 
50765            composeDecimalExtras(null, e, true);
50766          closeArray();
50767        }
50768      };
50769      if (element.hasFMeasure()) {
50770        openArray("fMeasure");
50771        for (DecimalType e : element.getFMeasure()) 
50772          composeDecimalCore(null, e, true);
50773        closeArray();
50774        if (anyHasExtras(element.getFMeasure())) {
50775          openArray("_fMeasure");
50776          for (DecimalType e : element.getFMeasure()) 
50777            composeDecimalExtras(null, e, true);
50778          closeArray();
50779        }
50780      };
50781  }
50782
50783  protected void composeSequenceSequenceRepositoryComponent(String name, Sequence.SequenceRepositoryComponent element) throws IOException {
50784    if (element != null) {
50785      open(name);
50786      composeSequenceSequenceRepositoryComponentInner(element);
50787      close();
50788    }
50789  }
50790
50791  protected void composeSequenceSequenceRepositoryComponentInner(Sequence.SequenceRepositoryComponent element) throws IOException {
50792      composeBackbone(element);
50793      if (element.hasTypeElement()) {
50794        composeEnumerationCore("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory(), false);
50795        composeEnumerationExtras("type", element.getTypeElement(), new Sequence.RepositoryTypeEnumFactory(), false);
50796      }
50797      if (element.hasUrlElement()) {
50798        composeUriCore("url", element.getUrlElement(), false);
50799        composeUriExtras("url", element.getUrlElement(), false);
50800      }
50801      if (element.hasNameElement()) {
50802        composeStringCore("name", element.getNameElement(), false);
50803        composeStringExtras("name", element.getNameElement(), false);
50804      }
50805      if (element.hasDatasetIdElement()) {
50806        composeStringCore("datasetId", element.getDatasetIdElement(), false);
50807        composeStringExtras("datasetId", element.getDatasetIdElement(), false);
50808      }
50809      if (element.hasVariantsetIdElement()) {
50810        composeStringCore("variantsetId", element.getVariantsetIdElement(), false);
50811        composeStringExtras("variantsetId", element.getVariantsetIdElement(), false);
50812      }
50813      if (element.hasReadsetIdElement()) {
50814        composeStringCore("readsetId", element.getReadsetIdElement(), false);
50815        composeStringExtras("readsetId", element.getReadsetIdElement(), false);
50816      }
50817  }
50818
50819  protected void composeSequenceSequenceStructureVariantComponent(String name, Sequence.SequenceStructureVariantComponent element) throws IOException {
50820    if (element != null) {
50821      open(name);
50822      composeSequenceSequenceStructureVariantComponentInner(element);
50823      close();
50824    }
50825  }
50826
50827  protected void composeSequenceSequenceStructureVariantComponentInner(Sequence.SequenceStructureVariantComponent element) throws IOException {
50828      composeBackbone(element);
50829      if (element.hasPrecisionElement()) {
50830        composeStringCore("precision", element.getPrecisionElement(), false);
50831        composeStringExtras("precision", element.getPrecisionElement(), false);
50832      }
50833      if (element.hasReportedaCGHRatioElement()) {
50834        composeDecimalCore("reportedaCGHRatio", element.getReportedaCGHRatioElement(), false);
50835        composeDecimalExtras("reportedaCGHRatio", element.getReportedaCGHRatioElement(), false);
50836      }
50837      if (element.hasLengthElement()) {
50838        composeIntegerCore("length", element.getLengthElement(), false);
50839        composeIntegerExtras("length", element.getLengthElement(), false);
50840      }
50841      if (element.hasOuter()) {
50842        composeSequenceSequenceStructureVariantOuterComponent("outer", element.getOuter());
50843      }
50844      if (element.hasInner()) {
50845        composeSequenceSequenceStructureVariantInnerComponent("inner", element.getInner());
50846      }
50847  }
50848
50849  protected void composeSequenceSequenceStructureVariantOuterComponent(String name, Sequence.SequenceStructureVariantOuterComponent element) throws IOException {
50850    if (element != null) {
50851      open(name);
50852      composeSequenceSequenceStructureVariantOuterComponentInner(element);
50853      close();
50854    }
50855  }
50856
50857  protected void composeSequenceSequenceStructureVariantOuterComponentInner(Sequence.SequenceStructureVariantOuterComponent element) throws IOException {
50858      composeBackbone(element);
50859      if (element.hasStartElement()) {
50860        composeIntegerCore("start", element.getStartElement(), false);
50861        composeIntegerExtras("start", element.getStartElement(), false);
50862      }
50863      if (element.hasEndElement()) {
50864        composeIntegerCore("end", element.getEndElement(), false);
50865        composeIntegerExtras("end", element.getEndElement(), false);
50866      }
50867  }
50868
50869  protected void composeSequenceSequenceStructureVariantInnerComponent(String name, Sequence.SequenceStructureVariantInnerComponent element) throws IOException {
50870    if (element != null) {
50871      open(name);
50872      composeSequenceSequenceStructureVariantInnerComponentInner(element);
50873      close();
50874    }
50875  }
50876
50877  protected void composeSequenceSequenceStructureVariantInnerComponentInner(Sequence.SequenceStructureVariantInnerComponent element) throws IOException {
50878      composeBackbone(element);
50879      if (element.hasStartElement()) {
50880        composeIntegerCore("start", element.getStartElement(), false);
50881        composeIntegerExtras("start", element.getStartElement(), false);
50882      }
50883      if (element.hasEndElement()) {
50884        composeIntegerCore("end", element.getEndElement(), false);
50885        composeIntegerExtras("end", element.getEndElement(), false);
50886      }
50887  }
50888
50889  protected void composeServiceRequest(String name, ServiceRequest element) throws IOException {
50890    if (element != null) {
50891      prop("resourceType", name);
50892      composeServiceRequestInner(element);
50893    }
50894  }
50895
50896  protected void composeServiceRequestInner(ServiceRequest element) throws IOException {
50897      composeDomainResourceElements(element);
50898      if (element.hasIdentifier()) {
50899        openArray("identifier");
50900        for (Identifier e : element.getIdentifier()) 
50901          composeIdentifier(null, e);
50902        closeArray();
50903      };
50904      if (element.hasInstantiatesCanonical()) {
50905        openArray("instantiatesCanonical");
50906        for (CanonicalType e : element.getInstantiatesCanonical()) 
50907          composeCanonicalCore(null, e, true);
50908        closeArray();
50909        if (anyHasExtras(element.getInstantiatesCanonical())) {
50910          openArray("_instantiatesCanonical");
50911          for (CanonicalType e : element.getInstantiatesCanonical()) 
50912            composeCanonicalExtras(null, e, true);
50913          closeArray();
50914        }
50915      };
50916      if (element.hasInstantiatesUri()) {
50917        openArray("instantiatesUri");
50918        for (UriType e : element.getInstantiatesUri()) 
50919          composeUriCore(null, e, true);
50920        closeArray();
50921        if (anyHasExtras(element.getInstantiatesUri())) {
50922          openArray("_instantiatesUri");
50923          for (UriType e : element.getInstantiatesUri()) 
50924            composeUriExtras(null, e, true);
50925          closeArray();
50926        }
50927      };
50928      if (element.hasBasedOn()) {
50929        openArray("basedOn");
50930        for (Reference e : element.getBasedOn()) 
50931          composeReference(null, e);
50932        closeArray();
50933      };
50934      if (element.hasReplaces()) {
50935        openArray("replaces");
50936        for (Reference e : element.getReplaces()) 
50937          composeReference(null, e);
50938        closeArray();
50939      };
50940      if (element.hasRequisition()) {
50941        composeIdentifier("requisition", element.getRequisition());
50942      }
50943      if (element.hasStatusElement()) {
50944        composeEnumerationCore("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
50945        composeEnumerationExtras("status", element.getStatusElement(), new ServiceRequest.ServiceRequestStatusEnumFactory(), false);
50946      }
50947      if (element.hasIntentElement()) {
50948        composeEnumerationCore("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
50949        composeEnumerationExtras("intent", element.getIntentElement(), new ServiceRequest.ServiceRequestIntentEnumFactory(), false);
50950      }
50951      if (element.hasCategory()) {
50952        openArray("category");
50953        for (CodeableConcept e : element.getCategory()) 
50954          composeCodeableConcept(null, e);
50955        closeArray();
50956      };
50957      if (element.hasPriorityElement()) {
50958        composeEnumerationCore("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
50959        composeEnumerationExtras("priority", element.getPriorityElement(), new ServiceRequest.ServiceRequestPriorityEnumFactory(), false);
50960      }
50961      if (element.hasDoNotPerformElement()) {
50962        composeBooleanCore("doNotPerform", element.getDoNotPerformElement(), false);
50963        composeBooleanExtras("doNotPerform", element.getDoNotPerformElement(), false);
50964      }
50965      if (element.hasCode()) {
50966        composeCodeableConcept("code", element.getCode());
50967      }
50968      if (element.hasOrderDetail()) {
50969        openArray("orderDetail");
50970        for (CodeableConcept e : element.getOrderDetail()) 
50971          composeCodeableConcept(null, e);
50972        closeArray();
50973      };
50974      if (element.hasQuantity()) {
50975        composeType("quantity", element.getQuantity());
50976      }
50977      if (element.hasSubject()) {
50978        composeReference("subject", element.getSubject());
50979      }
50980      if (element.hasContext()) {
50981        composeReference("context", element.getContext());
50982      }
50983      if (element.hasOccurrence()) {
50984        composeType("occurrence", element.getOccurrence());
50985      }
50986      if (element.hasAsNeeded()) {
50987        composeType("asNeeded", element.getAsNeeded());
50988      }
50989      if (element.hasAuthoredOnElement()) {
50990        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
50991        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
50992      }
50993      if (element.hasRequester()) {
50994        composeReference("requester", element.getRequester());
50995      }
50996      if (element.hasPerformerType()) {
50997        composeCodeableConcept("performerType", element.getPerformerType());
50998      }
50999      if (element.hasPerformer()) {
51000        openArray("performer");
51001        for (Reference e : element.getPerformer()) 
51002          composeReference(null, e);
51003        closeArray();
51004      };
51005      if (element.hasLocationCode()) {
51006        openArray("locationCode");
51007        for (CodeableConcept e : element.getLocationCode()) 
51008          composeCodeableConcept(null, e);
51009        closeArray();
51010      };
51011      if (element.hasLocationReference()) {
51012        openArray("locationReference");
51013        for (Reference e : element.getLocationReference()) 
51014          composeReference(null, e);
51015        closeArray();
51016      };
51017      if (element.hasReasonCode()) {
51018        openArray("reasonCode");
51019        for (CodeableConcept e : element.getReasonCode()) 
51020          composeCodeableConcept(null, e);
51021        closeArray();
51022      };
51023      if (element.hasReasonReference()) {
51024        openArray("reasonReference");
51025        for (Reference e : element.getReasonReference()) 
51026          composeReference(null, e);
51027        closeArray();
51028      };
51029      if (element.hasInsurance()) {
51030        openArray("insurance");
51031        for (Reference e : element.getInsurance()) 
51032          composeReference(null, e);
51033        closeArray();
51034      };
51035      if (element.hasSupportingInfo()) {
51036        openArray("supportingInfo");
51037        for (Reference e : element.getSupportingInfo()) 
51038          composeReference(null, e);
51039        closeArray();
51040      };
51041      if (element.hasSpecimen()) {
51042        openArray("specimen");
51043        for (Reference e : element.getSpecimen()) 
51044          composeReference(null, e);
51045        closeArray();
51046      };
51047      if (element.hasBodySite()) {
51048        openArray("bodySite");
51049        for (CodeableConcept e : element.getBodySite()) 
51050          composeCodeableConcept(null, e);
51051        closeArray();
51052      };
51053      if (element.hasNote()) {
51054        openArray("note");
51055        for (Annotation e : element.getNote()) 
51056          composeAnnotation(null, e);
51057        closeArray();
51058      };
51059      if (element.hasPatientInstructionElement()) {
51060        composeStringCore("patientInstruction", element.getPatientInstructionElement(), false);
51061        composeStringExtras("patientInstruction", element.getPatientInstructionElement(), false);
51062      }
51063      if (element.hasRelevantHistory()) {
51064        openArray("relevantHistory");
51065        for (Reference e : element.getRelevantHistory()) 
51066          composeReference(null, e);
51067        closeArray();
51068      };
51069  }
51070
51071  protected void composeSlot(String name, Slot element) throws IOException {
51072    if (element != null) {
51073      prop("resourceType", name);
51074      composeSlotInner(element);
51075    }
51076  }
51077
51078  protected void composeSlotInner(Slot element) throws IOException {
51079      composeDomainResourceElements(element);
51080      if (element.hasIdentifier()) {
51081        openArray("identifier");
51082        for (Identifier e : element.getIdentifier()) 
51083          composeIdentifier(null, e);
51084        closeArray();
51085      };
51086      if (element.hasServiceCategory()) {
51087        openArray("serviceCategory");
51088        for (CodeableConcept e : element.getServiceCategory()) 
51089          composeCodeableConcept(null, e);
51090        closeArray();
51091      };
51092      if (element.hasServiceType()) {
51093        openArray("serviceType");
51094        for (CodeableConcept e : element.getServiceType()) 
51095          composeCodeableConcept(null, e);
51096        closeArray();
51097      };
51098      if (element.hasSpecialty()) {
51099        openArray("specialty");
51100        for (CodeableConcept e : element.getSpecialty()) 
51101          composeCodeableConcept(null, e);
51102        closeArray();
51103      };
51104      if (element.hasAppointmentType()) {
51105        composeCodeableConcept("appointmentType", element.getAppointmentType());
51106      }
51107      if (element.hasSchedule()) {
51108        composeReference("schedule", element.getSchedule());
51109      }
51110      if (element.hasStatusElement()) {
51111        composeEnumerationCore("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
51112        composeEnumerationExtras("status", element.getStatusElement(), new Slot.SlotStatusEnumFactory(), false);
51113      }
51114      if (element.hasStartElement()) {
51115        composeInstantCore("start", element.getStartElement(), false);
51116        composeInstantExtras("start", element.getStartElement(), false);
51117      }
51118      if (element.hasEndElement()) {
51119        composeInstantCore("end", element.getEndElement(), false);
51120        composeInstantExtras("end", element.getEndElement(), false);
51121      }
51122      if (element.hasOverbookedElement()) {
51123        composeBooleanCore("overbooked", element.getOverbookedElement(), false);
51124        composeBooleanExtras("overbooked", element.getOverbookedElement(), false);
51125      }
51126      if (element.hasCommentElement()) {
51127        composeStringCore("comment", element.getCommentElement(), false);
51128        composeStringExtras("comment", element.getCommentElement(), false);
51129      }
51130  }
51131
51132  protected void composeSpecimen(String name, Specimen element) throws IOException {
51133    if (element != null) {
51134      prop("resourceType", name);
51135      composeSpecimenInner(element);
51136    }
51137  }
51138
51139  protected void composeSpecimenInner(Specimen element) throws IOException {
51140      composeDomainResourceElements(element);
51141      if (element.hasIdentifier()) {
51142        openArray("identifier");
51143        for (Identifier e : element.getIdentifier()) 
51144          composeIdentifier(null, e);
51145        closeArray();
51146      };
51147      if (element.hasAccessionIdentifier()) {
51148        composeIdentifier("accessionIdentifier", element.getAccessionIdentifier());
51149      }
51150      if (element.hasStatusElement()) {
51151        composeEnumerationCore("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
51152        composeEnumerationExtras("status", element.getStatusElement(), new Specimen.SpecimenStatusEnumFactory(), false);
51153      }
51154      if (element.hasType()) {
51155        composeCodeableConcept("type", element.getType());
51156      }
51157      if (element.hasSubject()) {
51158        composeReference("subject", element.getSubject());
51159      }
51160      if (element.hasReceivedTimeElement()) {
51161        composeDateTimeCore("receivedTime", element.getReceivedTimeElement(), false);
51162        composeDateTimeExtras("receivedTime", element.getReceivedTimeElement(), false);
51163      }
51164      if (element.hasParent()) {
51165        openArray("parent");
51166        for (Reference e : element.getParent()) 
51167          composeReference(null, e);
51168        closeArray();
51169      };
51170      if (element.hasRequest()) {
51171        openArray("request");
51172        for (Reference e : element.getRequest()) 
51173          composeReference(null, e);
51174        closeArray();
51175      };
51176      if (element.hasCollection()) {
51177        composeSpecimenSpecimenCollectionComponent("collection", element.getCollection());
51178      }
51179      if (element.hasProcessing()) {
51180        openArray("processing");
51181        for (Specimen.SpecimenProcessingComponent e : element.getProcessing()) 
51182          composeSpecimenSpecimenProcessingComponent(null, e);
51183        closeArray();
51184      };
51185      if (element.hasContainer()) {
51186        openArray("container");
51187        for (Specimen.SpecimenContainerComponent e : element.getContainer()) 
51188          composeSpecimenSpecimenContainerComponent(null, e);
51189        closeArray();
51190      };
51191      if (element.hasCondition()) {
51192        openArray("condition");
51193        for (CodeableConcept e : element.getCondition()) 
51194          composeCodeableConcept(null, e);
51195        closeArray();
51196      };
51197      if (element.hasNote()) {
51198        openArray("note");
51199        for (Annotation e : element.getNote()) 
51200          composeAnnotation(null, e);
51201        closeArray();
51202      };
51203  }
51204
51205  protected void composeSpecimenSpecimenCollectionComponent(String name, Specimen.SpecimenCollectionComponent element) throws IOException {
51206    if (element != null) {
51207      open(name);
51208      composeSpecimenSpecimenCollectionComponentInner(element);
51209      close();
51210    }
51211  }
51212
51213  protected void composeSpecimenSpecimenCollectionComponentInner(Specimen.SpecimenCollectionComponent element) throws IOException {
51214      composeBackbone(element);
51215      if (element.hasCollector()) {
51216        composeReference("collector", element.getCollector());
51217      }
51218      if (element.hasCollected()) {
51219        composeType("collected", element.getCollected());
51220      }
51221      if (element.hasDuration()) {
51222        composeDuration("duration", element.getDuration());
51223      }
51224      if (element.hasQuantity()) {
51225        composeQuantity("quantity", element.getQuantity());
51226      }
51227      if (element.hasMethod()) {
51228        composeCodeableConcept("method", element.getMethod());
51229      }
51230      if (element.hasBodySite()) {
51231        composeCodeableConcept("bodySite", element.getBodySite());
51232      }
51233      if (element.hasFastingStatus()) {
51234        composeType("fastingStatus", element.getFastingStatus());
51235      }
51236  }
51237
51238  protected void composeSpecimenSpecimenProcessingComponent(String name, Specimen.SpecimenProcessingComponent element) throws IOException {
51239    if (element != null) {
51240      open(name);
51241      composeSpecimenSpecimenProcessingComponentInner(element);
51242      close();
51243    }
51244  }
51245
51246  protected void composeSpecimenSpecimenProcessingComponentInner(Specimen.SpecimenProcessingComponent element) throws IOException {
51247      composeBackbone(element);
51248      if (element.hasDescriptionElement()) {
51249        composeStringCore("description", element.getDescriptionElement(), false);
51250        composeStringExtras("description", element.getDescriptionElement(), false);
51251      }
51252      if (element.hasProcedure()) {
51253        composeCodeableConcept("procedure", element.getProcedure());
51254      }
51255      if (element.hasAdditive()) {
51256        openArray("additive");
51257        for (Reference e : element.getAdditive()) 
51258          composeReference(null, e);
51259        closeArray();
51260      };
51261      if (element.hasTime()) {
51262        composeType("time", element.getTime());
51263      }
51264  }
51265
51266  protected void composeSpecimenSpecimenContainerComponent(String name, Specimen.SpecimenContainerComponent element) throws IOException {
51267    if (element != null) {
51268      open(name);
51269      composeSpecimenSpecimenContainerComponentInner(element);
51270      close();
51271    }
51272  }
51273
51274  protected void composeSpecimenSpecimenContainerComponentInner(Specimen.SpecimenContainerComponent element) throws IOException {
51275      composeBackbone(element);
51276      if (element.hasIdentifier()) {
51277        openArray("identifier");
51278        for (Identifier e : element.getIdentifier()) 
51279          composeIdentifier(null, e);
51280        closeArray();
51281      };
51282      if (element.hasDescriptionElement()) {
51283        composeStringCore("description", element.getDescriptionElement(), false);
51284        composeStringExtras("description", element.getDescriptionElement(), false);
51285      }
51286      if (element.hasType()) {
51287        composeCodeableConcept("type", element.getType());
51288      }
51289      if (element.hasCapacity()) {
51290        composeQuantity("capacity", element.getCapacity());
51291      }
51292      if (element.hasSpecimenQuantity()) {
51293        composeQuantity("specimenQuantity", element.getSpecimenQuantity());
51294      }
51295      if (element.hasAdditive()) {
51296        composeType("additive", element.getAdditive());
51297      }
51298  }
51299
51300  protected void composeSpecimenDefinition(String name, SpecimenDefinition element) throws IOException {
51301    if (element != null) {
51302      prop("resourceType", name);
51303      composeSpecimenDefinitionInner(element);
51304    }
51305  }
51306
51307  protected void composeSpecimenDefinitionInner(SpecimenDefinition element) throws IOException {
51308      composeDomainResourceElements(element);
51309      if (element.hasIdentifier()) {
51310        composeIdentifier("identifier", element.getIdentifier());
51311      }
51312      if (element.hasTypeCollected()) {
51313        composeCodeableConcept("typeCollected", element.getTypeCollected());
51314      }
51315      if (element.hasPatientPreparationElement()) {
51316        composeStringCore("patientPreparation", element.getPatientPreparationElement(), false);
51317        composeStringExtras("patientPreparation", element.getPatientPreparationElement(), false);
51318      }
51319      if (element.hasTimeAspectElement()) {
51320        composeStringCore("timeAspect", element.getTimeAspectElement(), false);
51321        composeStringExtras("timeAspect", element.getTimeAspectElement(), false);
51322      }
51323      if (element.hasCollection()) {
51324        openArray("collection");
51325        for (CodeableConcept e : element.getCollection()) 
51326          composeCodeableConcept(null, e);
51327        closeArray();
51328      };
51329      if (element.hasTypeTested()) {
51330        openArray("typeTested");
51331        for (SpecimenDefinition.SpecimenDefinitionTypeTestedComponent e : element.getTypeTested()) 
51332          composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(null, e);
51333        closeArray();
51334      };
51335  }
51336
51337  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
51338    if (element != null) {
51339      open(name);
51340      composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(element);
51341      close();
51342    }
51343  }
51344
51345  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedComponent element) throws IOException {
51346      composeBackbone(element);
51347      if (element.hasIsDerivedElement()) {
51348        composeBooleanCore("isDerived", element.getIsDerivedElement(), false);
51349        composeBooleanExtras("isDerived", element.getIsDerivedElement(), false);
51350      }
51351      if (element.hasType()) {
51352        composeCodeableConcept("type", element.getType());
51353      }
51354      if (element.hasPreferenceElement()) {
51355        composeEnumerationCore("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
51356        composeEnumerationExtras("preference", element.getPreferenceElement(), new SpecimenDefinition.SpecimenContainedPreferenceEnumFactory(), false);
51357      }
51358      if (element.hasContainer()) {
51359        composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent("container", element.getContainer());
51360      }
51361      if (element.hasRequirementElement()) {
51362        composeStringCore("requirement", element.getRequirementElement(), false);
51363        composeStringExtras("requirement", element.getRequirementElement(), false);
51364      }
51365      if (element.hasRetentionTime()) {
51366        composeDuration("retentionTime", element.getRetentionTime());
51367      }
51368      if (element.hasRejectionCriterion()) {
51369        openArray("rejectionCriterion");
51370        for (CodeableConcept e : element.getRejectionCriterion()) 
51371          composeCodeableConcept(null, e);
51372        closeArray();
51373      };
51374      if (element.hasHandling()) {
51375        openArray("handling");
51376        for (SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent e : element.getHandling()) 
51377          composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(null, e);
51378        closeArray();
51379      };
51380  }
51381
51382  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
51383    if (element != null) {
51384      open(name);
51385      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(element);
51386      close();
51387    }
51388  }
51389
51390  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerComponent element) throws IOException {
51391      composeBackbone(element);
51392      if (element.hasMaterial()) {
51393        composeCodeableConcept("material", element.getMaterial());
51394      }
51395      if (element.hasType()) {
51396        composeCodeableConcept("type", element.getType());
51397      }
51398      if (element.hasCap()) {
51399        composeCodeableConcept("cap", element.getCap());
51400      }
51401      if (element.hasDescriptionElement()) {
51402        composeStringCore("description", element.getDescriptionElement(), false);
51403        composeStringExtras("description", element.getDescriptionElement(), false);
51404      }
51405      if (element.hasCapacity()) {
51406        composeQuantity("capacity", element.getCapacity());
51407      }
51408      if (element.hasMinimumVolume()) {
51409        composeQuantity("minimumVolume", element.getMinimumVolume());
51410      }
51411      if (element.hasAdditive()) {
51412        openArray("additive");
51413        for (SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent e : element.getAdditive()) 
51414          composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(null, e);
51415        closeArray();
51416      };
51417      if (element.hasPreparationElement()) {
51418        composeStringCore("preparation", element.getPreparationElement(), false);
51419        composeStringExtras("preparation", element.getPreparationElement(), false);
51420      }
51421  }
51422
51423  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
51424    if (element != null) {
51425      open(name);
51426      composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(element);
51427      close();
51428    }
51429  }
51430
51431  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedContainerAdditiveComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedContainerAdditiveComponent element) throws IOException {
51432      composeBackbone(element);
51433      if (element.hasAdditive()) {
51434        composeType("additive", element.getAdditive());
51435      }
51436  }
51437
51438  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponent(String name, SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
51439    if (element != null) {
51440      open(name);
51441      composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(element);
51442      close();
51443    }
51444  }
51445
51446  protected void composeSpecimenDefinitionSpecimenDefinitionTypeTestedHandlingComponentInner(SpecimenDefinition.SpecimenDefinitionTypeTestedHandlingComponent element) throws IOException {
51447      composeBackbone(element);
51448      if (element.hasTemperatureQualifier()) {
51449        composeCodeableConcept("temperatureQualifier", element.getTemperatureQualifier());
51450      }
51451      if (element.hasTemperatureRange()) {
51452        composeRange("temperatureRange", element.getTemperatureRange());
51453      }
51454      if (element.hasMaxDuration()) {
51455        composeDuration("maxDuration", element.getMaxDuration());
51456      }
51457      if (element.hasInstructionElement()) {
51458        composeStringCore("instruction", element.getInstructionElement(), false);
51459        composeStringExtras("instruction", element.getInstructionElement(), false);
51460      }
51461  }
51462
51463  protected void composeStructureDefinition(String name, StructureDefinition element) throws IOException {
51464    if (element != null) {
51465      prop("resourceType", name);
51466      composeStructureDefinitionInner(element);
51467    }
51468  }
51469
51470  protected void composeStructureDefinitionInner(StructureDefinition element) throws IOException {
51471      composeDomainResourceElements(element);
51472      if (element.hasUrlElement()) {
51473        composeUriCore("url", element.getUrlElement(), false);
51474        composeUriExtras("url", element.getUrlElement(), false);
51475      }
51476      if (element.hasIdentifier()) {
51477        openArray("identifier");
51478        for (Identifier e : element.getIdentifier()) 
51479          composeIdentifier(null, e);
51480        closeArray();
51481      };
51482      if (element.hasVersionElement()) {
51483        composeStringCore("version", element.getVersionElement(), false);
51484        composeStringExtras("version", element.getVersionElement(), false);
51485      }
51486      if (element.hasNameElement()) {
51487        composeStringCore("name", element.getNameElement(), false);
51488        composeStringExtras("name", element.getNameElement(), false);
51489      }
51490      if (element.hasTitleElement()) {
51491        composeStringCore("title", element.getTitleElement(), false);
51492        composeStringExtras("title", element.getTitleElement(), false);
51493      }
51494      if (element.hasStatusElement()) {
51495        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51496        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51497      }
51498      if (element.hasExperimentalElement()) {
51499        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51500        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51501      }
51502      if (element.hasDateElement()) {
51503        composeDateTimeCore("date", element.getDateElement(), false);
51504        composeDateTimeExtras("date", element.getDateElement(), false);
51505      }
51506      if (element.hasPublisherElement()) {
51507        composeStringCore("publisher", element.getPublisherElement(), false);
51508        composeStringExtras("publisher", element.getPublisherElement(), false);
51509      }
51510      if (element.hasContact()) {
51511        openArray("contact");
51512        for (ContactDetail e : element.getContact()) 
51513          composeContactDetail(null, e);
51514        closeArray();
51515      };
51516      if (element.hasDescriptionElement()) {
51517        composeMarkdownCore("description", element.getDescriptionElement(), false);
51518        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51519      }
51520      if (element.hasUseContext()) {
51521        openArray("useContext");
51522        for (UsageContext e : element.getUseContext()) 
51523          composeUsageContext(null, e);
51524        closeArray();
51525      };
51526      if (element.hasJurisdiction()) {
51527        openArray("jurisdiction");
51528        for (CodeableConcept e : element.getJurisdiction()) 
51529          composeCodeableConcept(null, e);
51530        closeArray();
51531      };
51532      if (element.hasPurposeElement()) {
51533        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51534        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51535      }
51536      if (element.hasCopyrightElement()) {
51537        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51538        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51539      }
51540      if (element.hasKeyword()) {
51541        openArray("keyword");
51542        for (Coding e : element.getKeyword()) 
51543          composeCoding(null, e);
51544        closeArray();
51545      };
51546      if (element.hasFhirVersionElement()) {
51547        composeIdCore("fhirVersion", element.getFhirVersionElement(), false);
51548        composeIdExtras("fhirVersion", element.getFhirVersionElement(), false);
51549      }
51550      if (element.hasMapping()) {
51551        openArray("mapping");
51552        for (StructureDefinition.StructureDefinitionMappingComponent e : element.getMapping()) 
51553          composeStructureDefinitionStructureDefinitionMappingComponent(null, e);
51554        closeArray();
51555      };
51556      if (element.hasKindElement()) {
51557        composeEnumerationCore("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
51558        composeEnumerationExtras("kind", element.getKindElement(), new StructureDefinition.StructureDefinitionKindEnumFactory(), false);
51559      }
51560      if (element.hasAbstractElement()) {
51561        composeBooleanCore("abstract", element.getAbstractElement(), false);
51562        composeBooleanExtras("abstract", element.getAbstractElement(), false);
51563      }
51564      if (element.hasContext()) {
51565        openArray("context");
51566        for (StructureDefinition.StructureDefinitionContextComponent e : element.getContext()) 
51567          composeStructureDefinitionStructureDefinitionContextComponent(null, e);
51568        closeArray();
51569      };
51570      if (element.hasContextInvariant()) {
51571        openArray("contextInvariant");
51572        for (StringType e : element.getContextInvariant()) 
51573          composeStringCore(null, e, true);
51574        closeArray();
51575        if (anyHasExtras(element.getContextInvariant())) {
51576          openArray("_contextInvariant");
51577          for (StringType e : element.getContextInvariant()) 
51578            composeStringExtras(null, e, true);
51579          closeArray();
51580        }
51581      };
51582      if (element.hasTypeElement()) {
51583        composeUriCore("type", element.getTypeElement(), false);
51584        composeUriExtras("type", element.getTypeElement(), false);
51585      }
51586      if (element.hasBaseDefinitionElement()) {
51587        composeCanonicalCore("baseDefinition", element.getBaseDefinitionElement(), false);
51588        composeCanonicalExtras("baseDefinition", element.getBaseDefinitionElement(), false);
51589      }
51590      if (element.hasDerivationElement()) {
51591        composeEnumerationCore("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
51592        composeEnumerationExtras("derivation", element.getDerivationElement(), new StructureDefinition.TypeDerivationRuleEnumFactory(), false);
51593      }
51594      if (element.hasSnapshot()) {
51595        composeStructureDefinitionStructureDefinitionSnapshotComponent("snapshot", element.getSnapshot());
51596      }
51597      if (element.hasDifferential()) {
51598        composeStructureDefinitionStructureDefinitionDifferentialComponent("differential", element.getDifferential());
51599      }
51600  }
51601
51602  protected void composeStructureDefinitionStructureDefinitionMappingComponent(String name, StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
51603    if (element != null) {
51604      open(name);
51605      composeStructureDefinitionStructureDefinitionMappingComponentInner(element);
51606      close();
51607    }
51608  }
51609
51610  protected void composeStructureDefinitionStructureDefinitionMappingComponentInner(StructureDefinition.StructureDefinitionMappingComponent element) throws IOException {
51611      composeBackbone(element);
51612      if (element.hasIdentityElement()) {
51613        composeIdCore("identity", element.getIdentityElement(), false);
51614        composeIdExtras("identity", element.getIdentityElement(), false);
51615      }
51616      if (element.hasUriElement()) {
51617        composeUriCore("uri", element.getUriElement(), false);
51618        composeUriExtras("uri", element.getUriElement(), false);
51619      }
51620      if (element.hasNameElement()) {
51621        composeStringCore("name", element.getNameElement(), false);
51622        composeStringExtras("name", element.getNameElement(), false);
51623      }
51624      if (element.hasCommentElement()) {
51625        composeStringCore("comment", element.getCommentElement(), false);
51626        composeStringExtras("comment", element.getCommentElement(), false);
51627      }
51628  }
51629
51630  protected void composeStructureDefinitionStructureDefinitionContextComponent(String name, StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
51631    if (element != null) {
51632      open(name);
51633      composeStructureDefinitionStructureDefinitionContextComponentInner(element);
51634      close();
51635    }
51636  }
51637
51638  protected void composeStructureDefinitionStructureDefinitionContextComponentInner(StructureDefinition.StructureDefinitionContextComponent element) throws IOException {
51639      composeBackbone(element);
51640      if (element.hasTypeElement()) {
51641        composeEnumerationCore("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
51642        composeEnumerationExtras("type", element.getTypeElement(), new StructureDefinition.ExtensionContextTypeEnumFactory(), false);
51643      }
51644      if (element.hasExpressionElement()) {
51645        composeStringCore("expression", element.getExpressionElement(), false);
51646        composeStringExtras("expression", element.getExpressionElement(), false);
51647      }
51648  }
51649
51650  protected void composeStructureDefinitionStructureDefinitionSnapshotComponent(String name, StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
51651    if (element != null) {
51652      open(name);
51653      composeStructureDefinitionStructureDefinitionSnapshotComponentInner(element);
51654      close();
51655    }
51656  }
51657
51658  protected void composeStructureDefinitionStructureDefinitionSnapshotComponentInner(StructureDefinition.StructureDefinitionSnapshotComponent element) throws IOException {
51659      composeBackbone(element);
51660      if (element.hasElement()) {
51661        openArray("element");
51662        for (ElementDefinition e : element.getElement()) 
51663          composeElementDefinition(null, e);
51664        closeArray();
51665      };
51666  }
51667
51668  protected void composeStructureDefinitionStructureDefinitionDifferentialComponent(String name, StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
51669    if (element != null) {
51670      open(name);
51671      composeStructureDefinitionStructureDefinitionDifferentialComponentInner(element);
51672      close();
51673    }
51674  }
51675
51676  protected void composeStructureDefinitionStructureDefinitionDifferentialComponentInner(StructureDefinition.StructureDefinitionDifferentialComponent element) throws IOException {
51677      composeBackbone(element);
51678      if (element.hasElement()) {
51679        openArray("element");
51680        for (ElementDefinition e : element.getElement()) 
51681          composeElementDefinition(null, e);
51682        closeArray();
51683      };
51684  }
51685
51686  protected void composeStructureMap(String name, StructureMap element) throws IOException {
51687    if (element != null) {
51688      prop("resourceType", name);
51689      composeStructureMapInner(element);
51690    }
51691  }
51692
51693  protected void composeStructureMapInner(StructureMap element) throws IOException {
51694      composeDomainResourceElements(element);
51695      if (element.hasUrlElement()) {
51696        composeUriCore("url", element.getUrlElement(), false);
51697        composeUriExtras("url", element.getUrlElement(), false);
51698      }
51699      if (element.hasIdentifier()) {
51700        openArray("identifier");
51701        for (Identifier e : element.getIdentifier()) 
51702          composeIdentifier(null, e);
51703        closeArray();
51704      };
51705      if (element.hasVersionElement()) {
51706        composeStringCore("version", element.getVersionElement(), false);
51707        composeStringExtras("version", element.getVersionElement(), false);
51708      }
51709      if (element.hasNameElement()) {
51710        composeStringCore("name", element.getNameElement(), false);
51711        composeStringExtras("name", element.getNameElement(), false);
51712      }
51713      if (element.hasTitleElement()) {
51714        composeStringCore("title", element.getTitleElement(), false);
51715        composeStringExtras("title", element.getTitleElement(), false);
51716      }
51717      if (element.hasStatusElement()) {
51718        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51719        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
51720      }
51721      if (element.hasExperimentalElement()) {
51722        composeBooleanCore("experimental", element.getExperimentalElement(), false);
51723        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
51724      }
51725      if (element.hasDateElement()) {
51726        composeDateTimeCore("date", element.getDateElement(), false);
51727        composeDateTimeExtras("date", element.getDateElement(), false);
51728      }
51729      if (element.hasPublisherElement()) {
51730        composeStringCore("publisher", element.getPublisherElement(), false);
51731        composeStringExtras("publisher", element.getPublisherElement(), false);
51732      }
51733      if (element.hasContact()) {
51734        openArray("contact");
51735        for (ContactDetail e : element.getContact()) 
51736          composeContactDetail(null, e);
51737        closeArray();
51738      };
51739      if (element.hasDescriptionElement()) {
51740        composeMarkdownCore("description", element.getDescriptionElement(), false);
51741        composeMarkdownExtras("description", element.getDescriptionElement(), false);
51742      }
51743      if (element.hasUseContext()) {
51744        openArray("useContext");
51745        for (UsageContext e : element.getUseContext()) 
51746          composeUsageContext(null, e);
51747        closeArray();
51748      };
51749      if (element.hasJurisdiction()) {
51750        openArray("jurisdiction");
51751        for (CodeableConcept e : element.getJurisdiction()) 
51752          composeCodeableConcept(null, e);
51753        closeArray();
51754      };
51755      if (element.hasPurposeElement()) {
51756        composeMarkdownCore("purpose", element.getPurposeElement(), false);
51757        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
51758      }
51759      if (element.hasCopyrightElement()) {
51760        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
51761        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
51762      }
51763      if (element.hasStructure()) {
51764        openArray("structure");
51765        for (StructureMap.StructureMapStructureComponent e : element.getStructure()) 
51766          composeStructureMapStructureMapStructureComponent(null, e);
51767        closeArray();
51768      };
51769      if (element.hasImport()) {
51770        openArray("import");
51771        for (CanonicalType e : element.getImport()) 
51772          composeCanonicalCore(null, e, true);
51773        closeArray();
51774        if (anyHasExtras(element.getImport())) {
51775          openArray("_import");
51776          for (CanonicalType e : element.getImport()) 
51777            composeCanonicalExtras(null, e, true);
51778          closeArray();
51779        }
51780      };
51781      if (element.hasGroup()) {
51782        openArray("group");
51783        for (StructureMap.StructureMapGroupComponent e : element.getGroup()) 
51784          composeStructureMapStructureMapGroupComponent(null, e);
51785        closeArray();
51786      };
51787  }
51788
51789  protected void composeStructureMapStructureMapStructureComponent(String name, StructureMap.StructureMapStructureComponent element) throws IOException {
51790    if (element != null) {
51791      open(name);
51792      composeStructureMapStructureMapStructureComponentInner(element);
51793      close();
51794    }
51795  }
51796
51797  protected void composeStructureMapStructureMapStructureComponentInner(StructureMap.StructureMapStructureComponent element) throws IOException {
51798      composeBackbone(element);
51799      if (element.hasUrlElement()) {
51800        composeCanonicalCore("url", element.getUrlElement(), false);
51801        composeCanonicalExtras("url", element.getUrlElement(), false);
51802      }
51803      if (element.hasModeElement()) {
51804        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
51805        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapModelModeEnumFactory(), false);
51806      }
51807      if (element.hasAliasElement()) {
51808        composeStringCore("alias", element.getAliasElement(), false);
51809        composeStringExtras("alias", element.getAliasElement(), false);
51810      }
51811      if (element.hasDocumentationElement()) {
51812        composeStringCore("documentation", element.getDocumentationElement(), false);
51813        composeStringExtras("documentation", element.getDocumentationElement(), false);
51814      }
51815  }
51816
51817  protected void composeStructureMapStructureMapGroupComponent(String name, StructureMap.StructureMapGroupComponent element) throws IOException {
51818    if (element != null) {
51819      open(name);
51820      composeStructureMapStructureMapGroupComponentInner(element);
51821      close();
51822    }
51823  }
51824
51825  protected void composeStructureMapStructureMapGroupComponentInner(StructureMap.StructureMapGroupComponent element) throws IOException {
51826      composeBackbone(element);
51827      if (element.hasNameElement()) {
51828        composeIdCore("name", element.getNameElement(), false);
51829        composeIdExtras("name", element.getNameElement(), false);
51830      }
51831      if (element.hasExtendsElement()) {
51832        composeIdCore("extends", element.getExtendsElement(), false);
51833        composeIdExtras("extends", element.getExtendsElement(), false);
51834      }
51835      if (element.hasTypeModeElement()) {
51836        composeEnumerationCore("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
51837        composeEnumerationExtras("typeMode", element.getTypeModeElement(), new StructureMap.StructureMapGroupTypeModeEnumFactory(), false);
51838      }
51839      if (element.hasDocumentationElement()) {
51840        composeStringCore("documentation", element.getDocumentationElement(), false);
51841        composeStringExtras("documentation", element.getDocumentationElement(), false);
51842      }
51843      if (element.hasInput()) {
51844        openArray("input");
51845        for (StructureMap.StructureMapGroupInputComponent e : element.getInput()) 
51846          composeStructureMapStructureMapGroupInputComponent(null, e);
51847        closeArray();
51848      };
51849      if (element.hasRule()) {
51850        openArray("rule");
51851        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
51852          composeStructureMapStructureMapGroupRuleComponent(null, e);
51853        closeArray();
51854      };
51855  }
51856
51857  protected void composeStructureMapStructureMapGroupInputComponent(String name, StructureMap.StructureMapGroupInputComponent element) throws IOException {
51858    if (element != null) {
51859      open(name);
51860      composeStructureMapStructureMapGroupInputComponentInner(element);
51861      close();
51862    }
51863  }
51864
51865  protected void composeStructureMapStructureMapGroupInputComponentInner(StructureMap.StructureMapGroupInputComponent element) throws IOException {
51866      composeBackbone(element);
51867      if (element.hasNameElement()) {
51868        composeIdCore("name", element.getNameElement(), false);
51869        composeIdExtras("name", element.getNameElement(), false);
51870      }
51871      if (element.hasTypeElement()) {
51872        composeStringCore("type", element.getTypeElement(), false);
51873        composeStringExtras("type", element.getTypeElement(), false);
51874      }
51875      if (element.hasModeElement()) {
51876        composeEnumerationCore("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
51877        composeEnumerationExtras("mode", element.getModeElement(), new StructureMap.StructureMapInputModeEnumFactory(), false);
51878      }
51879      if (element.hasDocumentationElement()) {
51880        composeStringCore("documentation", element.getDocumentationElement(), false);
51881        composeStringExtras("documentation", element.getDocumentationElement(), false);
51882      }
51883  }
51884
51885  protected void composeStructureMapStructureMapGroupRuleComponent(String name, StructureMap.StructureMapGroupRuleComponent element) throws IOException {
51886    if (element != null) {
51887      open(name);
51888      composeStructureMapStructureMapGroupRuleComponentInner(element);
51889      close();
51890    }
51891  }
51892
51893  protected void composeStructureMapStructureMapGroupRuleComponentInner(StructureMap.StructureMapGroupRuleComponent element) throws IOException {
51894      composeBackbone(element);
51895      if (element.hasNameElement()) {
51896        composeIdCore("name", element.getNameElement(), false);
51897        composeIdExtras("name", element.getNameElement(), false);
51898      }
51899      if (element.hasSource()) {
51900        openArray("source");
51901        for (StructureMap.StructureMapGroupRuleSourceComponent e : element.getSource()) 
51902          composeStructureMapStructureMapGroupRuleSourceComponent(null, e);
51903        closeArray();
51904      };
51905      if (element.hasTarget()) {
51906        openArray("target");
51907        for (StructureMap.StructureMapGroupRuleTargetComponent e : element.getTarget()) 
51908          composeStructureMapStructureMapGroupRuleTargetComponent(null, e);
51909        closeArray();
51910      };
51911      if (element.hasRule()) {
51912        openArray("rule");
51913        for (StructureMap.StructureMapGroupRuleComponent e : element.getRule()) 
51914          composeStructureMapStructureMapGroupRuleComponent(null, e);
51915        closeArray();
51916      };
51917      if (element.hasDependent()) {
51918        openArray("dependent");
51919        for (StructureMap.StructureMapGroupRuleDependentComponent e : element.getDependent()) 
51920          composeStructureMapStructureMapGroupRuleDependentComponent(null, e);
51921        closeArray();
51922      };
51923      if (element.hasDocumentationElement()) {
51924        composeStringCore("documentation", element.getDocumentationElement(), false);
51925        composeStringExtras("documentation", element.getDocumentationElement(), false);
51926      }
51927  }
51928
51929  protected void composeStructureMapStructureMapGroupRuleSourceComponent(String name, StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
51930    if (element != null) {
51931      open(name);
51932      composeStructureMapStructureMapGroupRuleSourceComponentInner(element);
51933      close();
51934    }
51935  }
51936
51937  protected void composeStructureMapStructureMapGroupRuleSourceComponentInner(StructureMap.StructureMapGroupRuleSourceComponent element) throws IOException {
51938      composeBackbone(element);
51939      if (element.hasContextElement()) {
51940        composeIdCore("context", element.getContextElement(), false);
51941        composeIdExtras("context", element.getContextElement(), false);
51942      }
51943      if (element.hasMinElement()) {
51944        composeIntegerCore("min", element.getMinElement(), false);
51945        composeIntegerExtras("min", element.getMinElement(), false);
51946      }
51947      if (element.hasMaxElement()) {
51948        composeStringCore("max", element.getMaxElement(), false);
51949        composeStringExtras("max", element.getMaxElement(), false);
51950      }
51951      if (element.hasTypeElement()) {
51952        composeStringCore("type", element.getTypeElement(), false);
51953        composeStringExtras("type", element.getTypeElement(), false);
51954      }
51955      if (element.hasDefaultValue()) {
51956        composeType("defaultValue", element.getDefaultValue());
51957      }
51958      if (element.hasElementElement()) {
51959        composeStringCore("element", element.getElementElement(), false);
51960        composeStringExtras("element", element.getElementElement(), false);
51961      }
51962      if (element.hasListModeElement()) {
51963        composeEnumerationCore("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
51964        composeEnumerationExtras("listMode", element.getListModeElement(), new StructureMap.StructureMapSourceListModeEnumFactory(), false);
51965      }
51966      if (element.hasVariableElement()) {
51967        composeIdCore("variable", element.getVariableElement(), false);
51968        composeIdExtras("variable", element.getVariableElement(), false);
51969      }
51970      if (element.hasConditionElement()) {
51971        composeStringCore("condition", element.getConditionElement(), false);
51972        composeStringExtras("condition", element.getConditionElement(), false);
51973      }
51974      if (element.hasCheckElement()) {
51975        composeStringCore("check", element.getCheckElement(), false);
51976        composeStringExtras("check", element.getCheckElement(), false);
51977      }
51978      if (element.hasLogMessageElement()) {
51979        composeStringCore("logMessage", element.getLogMessageElement(), false);
51980        composeStringExtras("logMessage", element.getLogMessageElement(), false);
51981      }
51982  }
51983
51984  protected void composeStructureMapStructureMapGroupRuleTargetComponent(String name, StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
51985    if (element != null) {
51986      open(name);
51987      composeStructureMapStructureMapGroupRuleTargetComponentInner(element);
51988      close();
51989    }
51990  }
51991
51992  protected void composeStructureMapStructureMapGroupRuleTargetComponentInner(StructureMap.StructureMapGroupRuleTargetComponent element) throws IOException {
51993      composeBackbone(element);
51994      if (element.hasContextElement()) {
51995        composeIdCore("context", element.getContextElement(), false);
51996        composeIdExtras("context", element.getContextElement(), false);
51997      }
51998      if (element.hasContextTypeElement()) {
51999        composeEnumerationCore("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
52000        composeEnumerationExtras("contextType", element.getContextTypeElement(), new StructureMap.StructureMapContextTypeEnumFactory(), false);
52001      }
52002      if (element.hasElementElement()) {
52003        composeStringCore("element", element.getElementElement(), false);
52004        composeStringExtras("element", element.getElementElement(), false);
52005      }
52006      if (element.hasVariableElement()) {
52007        composeIdCore("variable", element.getVariableElement(), false);
52008        composeIdExtras("variable", element.getVariableElement(), false);
52009      }
52010      if (element.hasListMode()) {
52011        openArray("listMode");
52012        for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
52013          composeEnumerationCore(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
52014        closeArray();
52015        if (anyHasExtras(element.getListMode())) {
52016          openArray("_listMode");
52017          for (Enumeration<StructureMap.StructureMapTargetListMode> e : element.getListMode()) 
52018            composeEnumerationExtras(null, e, new StructureMap.StructureMapTargetListModeEnumFactory(), true);
52019          closeArray();
52020        }
52021      };
52022      if (element.hasListRuleIdElement()) {
52023        composeIdCore("listRuleId", element.getListRuleIdElement(), false);
52024        composeIdExtras("listRuleId", element.getListRuleIdElement(), false);
52025      }
52026      if (element.hasTransformElement()) {
52027        composeEnumerationCore("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
52028        composeEnumerationExtras("transform", element.getTransformElement(), new StructureMap.StructureMapTransformEnumFactory(), false);
52029      }
52030      if (element.hasParameter()) {
52031        openArray("parameter");
52032        for (StructureMap.StructureMapGroupRuleTargetParameterComponent e : element.getParameter()) 
52033          composeStructureMapStructureMapGroupRuleTargetParameterComponent(null, e);
52034        closeArray();
52035      };
52036  }
52037
52038  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponent(String name, StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
52039    if (element != null) {
52040      open(name);
52041      composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(element);
52042      close();
52043    }
52044  }
52045
52046  protected void composeStructureMapStructureMapGroupRuleTargetParameterComponentInner(StructureMap.StructureMapGroupRuleTargetParameterComponent element) throws IOException {
52047      composeBackbone(element);
52048      if (element.hasValue()) {
52049        composeType("value", element.getValue());
52050      }
52051  }
52052
52053  protected void composeStructureMapStructureMapGroupRuleDependentComponent(String name, StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
52054    if (element != null) {
52055      open(name);
52056      composeStructureMapStructureMapGroupRuleDependentComponentInner(element);
52057      close();
52058    }
52059  }
52060
52061  protected void composeStructureMapStructureMapGroupRuleDependentComponentInner(StructureMap.StructureMapGroupRuleDependentComponent element) throws IOException {
52062      composeBackbone(element);
52063      if (element.hasNameElement()) {
52064        composeIdCore("name", element.getNameElement(), false);
52065        composeIdExtras("name", element.getNameElement(), false);
52066      }
52067      if (element.hasVariable()) {
52068        openArray("variable");
52069        for (StringType e : element.getVariable()) 
52070          composeStringCore(null, e, true);
52071        closeArray();
52072        if (anyHasExtras(element.getVariable())) {
52073          openArray("_variable");
52074          for (StringType e : element.getVariable()) 
52075            composeStringExtras(null, e, true);
52076          closeArray();
52077        }
52078      };
52079  }
52080
52081  protected void composeSubscription(String name, Subscription element) throws IOException {
52082    if (element != null) {
52083      prop("resourceType", name);
52084      composeSubscriptionInner(element);
52085    }
52086  }
52087
52088  protected void composeSubscriptionInner(Subscription element) throws IOException {
52089      composeDomainResourceElements(element);
52090      if (element.hasStatusElement()) {
52091        composeEnumerationCore("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
52092        composeEnumerationExtras("status", element.getStatusElement(), new Subscription.SubscriptionStatusEnumFactory(), false);
52093      }
52094      if (element.hasContact()) {
52095        openArray("contact");
52096        for (ContactPoint e : element.getContact()) 
52097          composeContactPoint(null, e);
52098        closeArray();
52099      };
52100      if (element.hasEndElement()) {
52101        composeInstantCore("end", element.getEndElement(), false);
52102        composeInstantExtras("end", element.getEndElement(), false);
52103      }
52104      if (element.hasReasonElement()) {
52105        composeStringCore("reason", element.getReasonElement(), false);
52106        composeStringExtras("reason", element.getReasonElement(), false);
52107      }
52108      if (element.hasCriteriaElement()) {
52109        composeStringCore("criteria", element.getCriteriaElement(), false);
52110        composeStringExtras("criteria", element.getCriteriaElement(), false);
52111      }
52112      if (element.hasErrorElement()) {
52113        composeStringCore("error", element.getErrorElement(), false);
52114        composeStringExtras("error", element.getErrorElement(), false);
52115      }
52116      if (element.hasChannel()) {
52117        composeSubscriptionSubscriptionChannelComponent("channel", element.getChannel());
52118      }
52119      if (element.hasTag()) {
52120        openArray("tag");
52121        for (Coding e : element.getTag()) 
52122          composeCoding(null, e);
52123        closeArray();
52124      };
52125  }
52126
52127  protected void composeSubscriptionSubscriptionChannelComponent(String name, Subscription.SubscriptionChannelComponent element) throws IOException {
52128    if (element != null) {
52129      open(name);
52130      composeSubscriptionSubscriptionChannelComponentInner(element);
52131      close();
52132    }
52133  }
52134
52135  protected void composeSubscriptionSubscriptionChannelComponentInner(Subscription.SubscriptionChannelComponent element) throws IOException {
52136      composeBackbone(element);
52137      if (element.hasTypeElement()) {
52138        composeEnumerationCore("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
52139        composeEnumerationExtras("type", element.getTypeElement(), new Subscription.SubscriptionChannelTypeEnumFactory(), false);
52140      }
52141      if (element.hasEndpointElement()) {
52142        composeUrlCore("endpoint", element.getEndpointElement(), false);
52143        composeUrlExtras("endpoint", element.getEndpointElement(), false);
52144      }
52145      if (element.hasPayloadElement()) {
52146        composeStringCore("payload", element.getPayloadElement(), false);
52147        composeStringExtras("payload", element.getPayloadElement(), false);
52148      }
52149      if (element.hasHeader()) {
52150        openArray("header");
52151        for (StringType e : element.getHeader()) 
52152          composeStringCore(null, e, true);
52153        closeArray();
52154        if (anyHasExtras(element.getHeader())) {
52155          openArray("_header");
52156          for (StringType e : element.getHeader()) 
52157            composeStringExtras(null, e, true);
52158          closeArray();
52159        }
52160      };
52161  }
52162
52163  protected void composeSubstance(String name, Substance element) throws IOException {
52164    if (element != null) {
52165      prop("resourceType", name);
52166      composeSubstanceInner(element);
52167    }
52168  }
52169
52170  protected void composeSubstanceInner(Substance element) throws IOException {
52171      composeDomainResourceElements(element);
52172      if (element.hasIdentifier()) {
52173        openArray("identifier");
52174        for (Identifier e : element.getIdentifier()) 
52175          composeIdentifier(null, e);
52176        closeArray();
52177      };
52178      if (element.hasStatusElement()) {
52179        composeEnumerationCore("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
52180        composeEnumerationExtras("status", element.getStatusElement(), new Substance.FHIRSubstanceStatusEnumFactory(), false);
52181      }
52182      if (element.hasCategory()) {
52183        openArray("category");
52184        for (CodeableConcept e : element.getCategory()) 
52185          composeCodeableConcept(null, e);
52186        closeArray();
52187      };
52188      if (element.hasCode()) {
52189        composeCodeableConcept("code", element.getCode());
52190      }
52191      if (element.hasDescriptionElement()) {
52192        composeStringCore("description", element.getDescriptionElement(), false);
52193        composeStringExtras("description", element.getDescriptionElement(), false);
52194      }
52195      if (element.hasInstance()) {
52196        openArray("instance");
52197        for (Substance.SubstanceInstanceComponent e : element.getInstance()) 
52198          composeSubstanceSubstanceInstanceComponent(null, e);
52199        closeArray();
52200      };
52201      if (element.hasIngredient()) {
52202        openArray("ingredient");
52203        for (Substance.SubstanceIngredientComponent e : element.getIngredient()) 
52204          composeSubstanceSubstanceIngredientComponent(null, e);
52205        closeArray();
52206      };
52207  }
52208
52209  protected void composeSubstanceSubstanceInstanceComponent(String name, Substance.SubstanceInstanceComponent element) throws IOException {
52210    if (element != null) {
52211      open(name);
52212      composeSubstanceSubstanceInstanceComponentInner(element);
52213      close();
52214    }
52215  }
52216
52217  protected void composeSubstanceSubstanceInstanceComponentInner(Substance.SubstanceInstanceComponent element) throws IOException {
52218      composeBackbone(element);
52219      if (element.hasIdentifier()) {
52220        composeIdentifier("identifier", element.getIdentifier());
52221      }
52222      if (element.hasExpiryElement()) {
52223        composeDateTimeCore("expiry", element.getExpiryElement(), false);
52224        composeDateTimeExtras("expiry", element.getExpiryElement(), false);
52225      }
52226      if (element.hasQuantity()) {
52227        composeQuantity("quantity", element.getQuantity());
52228      }
52229  }
52230
52231  protected void composeSubstanceSubstanceIngredientComponent(String name, Substance.SubstanceIngredientComponent element) throws IOException {
52232    if (element != null) {
52233      open(name);
52234      composeSubstanceSubstanceIngredientComponentInner(element);
52235      close();
52236    }
52237  }
52238
52239  protected void composeSubstanceSubstanceIngredientComponentInner(Substance.SubstanceIngredientComponent element) throws IOException {
52240      composeBackbone(element);
52241      if (element.hasQuantity()) {
52242        composeRatio("quantity", element.getQuantity());
52243      }
52244      if (element.hasSubstance()) {
52245        composeType("substance", element.getSubstance());
52246      }
52247  }
52248
52249  protected void composeSubstancePolymer(String name, SubstancePolymer element) throws IOException {
52250    if (element != null) {
52251      prop("resourceType", name);
52252      composeSubstancePolymerInner(element);
52253    }
52254  }
52255
52256  protected void composeSubstancePolymerInner(SubstancePolymer element) throws IOException {
52257      composeDomainResourceElements(element);
52258      if (element.hasClass_()) {
52259        composeCodeableConcept("class", element.getClass_());
52260      }
52261      if (element.hasGeometry()) {
52262        composeCodeableConcept("geometry", element.getGeometry());
52263      }
52264      if (element.hasCopolymerConnectivity()) {
52265        openArray("copolymerConnectivity");
52266        for (CodeableConcept e : element.getCopolymerConnectivity()) 
52267          composeCodeableConcept(null, e);
52268        closeArray();
52269      };
52270      if (element.hasModification()) {
52271        openArray("modification");
52272        for (StringType e : element.getModification()) 
52273          composeStringCore(null, e, true);
52274        closeArray();
52275        if (anyHasExtras(element.getModification())) {
52276          openArray("_modification");
52277          for (StringType e : element.getModification()) 
52278            composeStringExtras(null, e, true);
52279          closeArray();
52280        }
52281      };
52282      if (element.hasMonomerSet()) {
52283        openArray("monomerSet");
52284        for (SubstancePolymer.SubstancePolymerMonomerSetComponent e : element.getMonomerSet()) 
52285          composeSubstancePolymerSubstancePolymerMonomerSetComponent(null, e);
52286        closeArray();
52287      };
52288      if (element.hasRepeat()) {
52289        openArray("repeat");
52290        for (SubstancePolymer.SubstancePolymerRepeatComponent e : element.getRepeat()) 
52291          composeSubstancePolymerSubstancePolymerRepeatComponent(null, e);
52292        closeArray();
52293      };
52294  }
52295
52296  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
52297    if (element != null) {
52298      open(name);
52299      composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(element);
52300      close();
52301    }
52302  }
52303
52304  protected void composeSubstancePolymerSubstancePolymerMonomerSetComponentInner(SubstancePolymer.SubstancePolymerMonomerSetComponent element) throws IOException {
52305      composeBackbone(element);
52306      if (element.hasRatioType()) {
52307        composeCodeableConcept("ratioType", element.getRatioType());
52308      }
52309      if (element.hasStartingMaterial()) {
52310        openArray("startingMaterial");
52311        for (SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent e : element.getStartingMaterial()) 
52312          composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(null, e);
52313        closeArray();
52314      };
52315  }
52316
52317  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponent(String name, SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
52318    if (element != null) {
52319      open(name);
52320      composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(element);
52321      close();
52322    }
52323  }
52324
52325  protected void composeSubstancePolymerSubstancePolymerMonomerSetStartingMaterialComponentInner(SubstancePolymer.SubstancePolymerMonomerSetStartingMaterialComponent element) throws IOException {
52326      composeBackbone(element);
52327      if (element.hasMaterial()) {
52328        composeCodeableConcept("material", element.getMaterial());
52329      }
52330      if (element.hasType()) {
52331        composeCodeableConcept("type", element.getType());
52332      }
52333      if (element.hasIsDefiningElement()) {
52334        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
52335        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
52336      }
52337      if (element.hasAmount()) {
52338        composeSubstanceAmount("amount", element.getAmount());
52339      }
52340  }
52341
52342  protected void composeSubstancePolymerSubstancePolymerRepeatComponent(String name, SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
52343    if (element != null) {
52344      open(name);
52345      composeSubstancePolymerSubstancePolymerRepeatComponentInner(element);
52346      close();
52347    }
52348  }
52349
52350  protected void composeSubstancePolymerSubstancePolymerRepeatComponentInner(SubstancePolymer.SubstancePolymerRepeatComponent element) throws IOException {
52351      composeBackbone(element);
52352      if (element.hasNumberOfUnitsElement()) {
52353        composeIntegerCore("numberOfUnits", element.getNumberOfUnitsElement(), false);
52354        composeIntegerExtras("numberOfUnits", element.getNumberOfUnitsElement(), false);
52355      }
52356      if (element.hasAverageMolecularFormulaElement()) {
52357        composeStringCore("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
52358        composeStringExtras("averageMolecularFormula", element.getAverageMolecularFormulaElement(), false);
52359      }
52360      if (element.hasRepeatUnitAmountType()) {
52361        composeCodeableConcept("repeatUnitAmountType", element.getRepeatUnitAmountType());
52362      }
52363      if (element.hasRepeatUnit()) {
52364        openArray("repeatUnit");
52365        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent e : element.getRepeatUnit()) 
52366          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(null, e);
52367        closeArray();
52368      };
52369  }
52370
52371  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
52372    if (element != null) {
52373      open(name);
52374      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(element);
52375      close();
52376    }
52377  }
52378
52379  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitComponent element) throws IOException {
52380      composeBackbone(element);
52381      if (element.hasOrientationOfPolymerisation()) {
52382        composeCodeableConcept("orientationOfPolymerisation", element.getOrientationOfPolymerisation());
52383      }
52384      if (element.hasRepeatUnitElement()) {
52385        composeStringCore("repeatUnit", element.getRepeatUnitElement(), false);
52386        composeStringExtras("repeatUnit", element.getRepeatUnitElement(), false);
52387      }
52388      if (element.hasAmount()) {
52389        composeSubstanceAmount("amount", element.getAmount());
52390      }
52391      if (element.hasDegreeOfPolymerisation()) {
52392        openArray("degreeOfPolymerisation");
52393        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent e : element.getDegreeOfPolymerisation()) 
52394          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(null, e);
52395        closeArray();
52396      };
52397      if (element.hasStructuralRepresentation()) {
52398        openArray("structuralRepresentation");
52399        for (SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
52400          composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(null, e);
52401        closeArray();
52402      };
52403  }
52404
52405  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
52406    if (element != null) {
52407      open(name);
52408      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(element);
52409      close();
52410    }
52411  }
52412
52413  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitDegreeOfPolymerisationComponent element) throws IOException {
52414      composeBackbone(element);
52415      if (element.hasDegree()) {
52416        composeCodeableConcept("degree", element.getDegree());
52417      }
52418      if (element.hasAmount()) {
52419        composeSubstanceAmount("amount", element.getAmount());
52420      }
52421  }
52422
52423  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent(String name, SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
52424    if (element != null) {
52425      open(name);
52426      composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(element);
52427      close();
52428    }
52429  }
52430
52431  protected void composeSubstancePolymerSubstancePolymerRepeatRepeatUnitStructuralRepresentationComponentInner(SubstancePolymer.SubstancePolymerRepeatRepeatUnitStructuralRepresentationComponent element) throws IOException {
52432      composeBackbone(element);
52433      if (element.hasType()) {
52434        composeCodeableConcept("type", element.getType());
52435      }
52436      if (element.hasRepresentationElement()) {
52437        composeStringCore("representation", element.getRepresentationElement(), false);
52438        composeStringExtras("representation", element.getRepresentationElement(), false);
52439      }
52440      if (element.hasAttachment()) {
52441        composeAttachment("attachment", element.getAttachment());
52442      }
52443  }
52444
52445  protected void composeSubstanceReferenceInformation(String name, SubstanceReferenceInformation element) throws IOException {
52446    if (element != null) {
52447      prop("resourceType", name);
52448      composeSubstanceReferenceInformationInner(element);
52449    }
52450  }
52451
52452  protected void composeSubstanceReferenceInformationInner(SubstanceReferenceInformation element) throws IOException {
52453      composeDomainResourceElements(element);
52454      if (element.hasCommentElement()) {
52455        composeStringCore("comment", element.getCommentElement(), false);
52456        composeStringExtras("comment", element.getCommentElement(), false);
52457      }
52458      if (element.hasGene()) {
52459        openArray("gene");
52460        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent e : element.getGene()) 
52461          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(null, e);
52462        closeArray();
52463      };
52464      if (element.hasGeneElement()) {
52465        openArray("geneElement");
52466        for (SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent e : element.getGeneElement()) 
52467          composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(null, e);
52468        closeArray();
52469      };
52470      if (element.hasClassification()) {
52471        openArray("classification");
52472        for (SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent e : element.getClassification()) 
52473          composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(null, e);
52474        closeArray();
52475      };
52476      if (element.hasRelationship()) {
52477        openArray("relationship");
52478        for (SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent e : element.getRelationship()) 
52479          composeSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponent(null, e);
52480        closeArray();
52481      };
52482      if (element.hasTarget()) {
52483        openArray("target");
52484        for (SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent e : element.getTarget()) 
52485          composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(null, e);
52486        closeArray();
52487      };
52488  }
52489
52490  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
52491    if (element != null) {
52492      open(name);
52493      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(element);
52494      close();
52495    }
52496  }
52497
52498  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneComponent element) throws IOException {
52499      composeBackbone(element);
52500      if (element.hasGeneSequenceOrigin()) {
52501        composeCodeableConcept("geneSequenceOrigin", element.getGeneSequenceOrigin());
52502      }
52503      if (element.hasGene()) {
52504        composeCodeableConcept("gene", element.getGene());
52505      }
52506      if (element.hasSource()) {
52507        openArray("source");
52508        for (Reference e : element.getSource()) 
52509          composeReference(null, e);
52510        closeArray();
52511      };
52512  }
52513
52514  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
52515    if (element != null) {
52516      open(name);
52517      composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(element);
52518      close();
52519    }
52520  }
52521
52522  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationGeneElementComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationGeneElementComponent element) throws IOException {
52523      composeBackbone(element);
52524      if (element.hasType()) {
52525        composeCodeableConcept("type", element.getType());
52526      }
52527      if (element.hasElement()) {
52528        composeIdentifier("element", element.getElement());
52529      }
52530      if (element.hasSource()) {
52531        openArray("source");
52532        for (Reference e : element.getSource()) 
52533          composeReference(null, e);
52534        closeArray();
52535      };
52536  }
52537
52538  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
52539    if (element != null) {
52540      open(name);
52541      composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(element);
52542      close();
52543    }
52544  }
52545
52546  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationClassificationComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationClassificationComponent element) throws IOException {
52547      composeBackbone(element);
52548      if (element.hasDomain()) {
52549        composeCodeableConcept("domain", element.getDomain());
52550      }
52551      if (element.hasClassification()) {
52552        composeCodeableConcept("classification", element.getClassification());
52553      }
52554      if (element.hasSubtype()) {
52555        openArray("subtype");
52556        for (CodeableConcept e : element.getSubtype()) 
52557          composeCodeableConcept(null, e);
52558        closeArray();
52559      };
52560      if (element.hasSource()) {
52561        openArray("source");
52562        for (Reference e : element.getSource()) 
52563          composeReference(null, e);
52564        closeArray();
52565      };
52566  }
52567
52568  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent element) throws IOException {
52569    if (element != null) {
52570      open(name);
52571      composeSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponentInner(element);
52572      close();
52573    }
52574  }
52575
52576  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationRelationshipComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationRelationshipComponent element) throws IOException {
52577      composeBackbone(element);
52578      if (element.hasSubstance()) {
52579        composeType("substance", element.getSubstance());
52580      }
52581      if (element.hasRelationship()) {
52582        composeCodeableConcept("relationship", element.getRelationship());
52583      }
52584      if (element.hasInteraction()) {
52585        composeCodeableConcept("interaction", element.getInteraction());
52586      }
52587      if (element.hasIsDefiningElement()) {
52588        composeBooleanCore("isDefining", element.getIsDefiningElement(), false);
52589        composeBooleanExtras("isDefining", element.getIsDefiningElement(), false);
52590      }
52591      if (element.hasAmount()) {
52592        composeType("amount", element.getAmount());
52593      }
52594      if (element.hasAmountType()) {
52595        composeCodeableConcept("amountType", element.getAmountType());
52596      }
52597      if (element.hasAmountTextElement()) {
52598        composeStringCore("amountText", element.getAmountTextElement(), false);
52599        composeStringExtras("amountText", element.getAmountTextElement(), false);
52600      }
52601      if (element.hasSource()) {
52602        openArray("source");
52603        for (Reference e : element.getSource()) 
52604          composeReference(null, e);
52605        closeArray();
52606      };
52607  }
52608
52609  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponent(String name, SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
52610    if (element != null) {
52611      open(name);
52612      composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(element);
52613      close();
52614    }
52615  }
52616
52617  protected void composeSubstanceReferenceInformationSubstanceReferenceInformationTargetComponentInner(SubstanceReferenceInformation.SubstanceReferenceInformationTargetComponent element) throws IOException {
52618      composeBackbone(element);
52619      if (element.hasTarget()) {
52620        composeIdentifier("target", element.getTarget());
52621      }
52622      if (element.hasType()) {
52623        composeCodeableConcept("type", element.getType());
52624      }
52625      if (element.hasInteraction()) {
52626        composeCodeableConcept("interaction", element.getInteraction());
52627      }
52628      if (element.hasOrganism()) {
52629        composeCodeableConcept("organism", element.getOrganism());
52630      }
52631      if (element.hasOrganismType()) {
52632        composeCodeableConcept("organismType", element.getOrganismType());
52633      }
52634      if (element.hasSource()) {
52635        openArray("source");
52636        for (Reference e : element.getSource()) 
52637          composeReference(null, e);
52638        closeArray();
52639      };
52640      if (element.hasAmount()) {
52641        composeType("amount", element.getAmount());
52642      }
52643      if (element.hasAmountType()) {
52644        composeCodeableConcept("amountType", element.getAmountType());
52645      }
52646  }
52647
52648  protected void composeSubstanceSpecification(String name, SubstanceSpecification element) throws IOException {
52649    if (element != null) {
52650      prop("resourceType", name);
52651      composeSubstanceSpecificationInner(element);
52652    }
52653  }
52654
52655  protected void composeSubstanceSpecificationInner(SubstanceSpecification element) throws IOException {
52656      composeDomainResourceElements(element);
52657      if (element.hasCommentElement()) {
52658        composeStringCore("comment", element.getCommentElement(), false);
52659        composeStringExtras("comment", element.getCommentElement(), false);
52660      }
52661      if (element.hasStoichiometricElement()) {
52662        composeBooleanCore("stoichiometric", element.getStoichiometricElement(), false);
52663        composeBooleanExtras("stoichiometric", element.getStoichiometricElement(), false);
52664      }
52665      if (element.hasIdentifier()) {
52666        composeIdentifier("identifier", element.getIdentifier());
52667      }
52668      if (element.hasType()) {
52669        composeCodeableConcept("type", element.getType());
52670      }
52671      if (element.hasReferenceSource()) {
52672        openArray("referenceSource");
52673        for (StringType e : element.getReferenceSource()) 
52674          composeStringCore(null, e, true);
52675        closeArray();
52676        if (anyHasExtras(element.getReferenceSource())) {
52677          openArray("_referenceSource");
52678          for (StringType e : element.getReferenceSource()) 
52679            composeStringExtras(null, e, true);
52680          closeArray();
52681        }
52682      };
52683      if (element.hasMoiety()) {
52684        openArray("moiety");
52685        for (SubstanceSpecification.SubstanceSpecificationMoietyComponent e : element.getMoiety()) 
52686          composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(null, e);
52687        closeArray();
52688      };
52689      if (element.hasProperty()) {
52690        openArray("property");
52691        for (SubstanceSpecification.SubstanceSpecificationPropertyComponent e : element.getProperty()) 
52692          composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(null, e);
52693        closeArray();
52694      };
52695      if (element.hasReferenceInformation()) {
52696        composeReference("referenceInformation", element.getReferenceInformation());
52697      }
52698      if (element.hasStructure()) {
52699        composeSubstanceSpecificationSubstanceSpecificationStructureComponent("structure", element.getStructure());
52700      }
52701      if (element.hasSubstanceCode()) {
52702        openArray("substanceCode");
52703        for (SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent e : element.getSubstanceCode()) 
52704          composeSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponent(null, e);
52705        closeArray();
52706      };
52707      if (element.hasSubstanceName()) {
52708        openArray("substanceName");
52709        for (SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent e : element.getSubstanceName()) 
52710          composeSubstanceSpecificationSubstanceSpecificationSubstanceNameComponent(null, e);
52711        closeArray();
52712      };
52713      if (element.hasMolecularWeight()) {
52714        openArray("molecularWeight");
52715        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent e : element.getMolecularWeight()) 
52716          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(null, e);
52717        closeArray();
52718      };
52719      if (element.hasPolymer()) {
52720        composeReference("polymer", element.getPolymer());
52721      }
52722  }
52723
52724  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponent(String name, SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
52725    if (element != null) {
52726      open(name);
52727      composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(element);
52728      close();
52729    }
52730  }
52731
52732  protected void composeSubstanceSpecificationSubstanceSpecificationMoietyComponentInner(SubstanceSpecification.SubstanceSpecificationMoietyComponent element) throws IOException {
52733      composeBackbone(element);
52734      if (element.hasRole()) {
52735        composeCodeableConcept("role", element.getRole());
52736      }
52737      if (element.hasIdentifier()) {
52738        composeIdentifier("identifier", element.getIdentifier());
52739      }
52740      if (element.hasNameElement()) {
52741        composeStringCore("name", element.getNameElement(), false);
52742        composeStringExtras("name", element.getNameElement(), false);
52743      }
52744      if (element.hasStereochemistry()) {
52745        composeCodeableConcept("stereochemistry", element.getStereochemistry());
52746      }
52747      if (element.hasOpticalActivity()) {
52748        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
52749      }
52750      if (element.hasMolecularFormulaElement()) {
52751        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
52752        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
52753      }
52754      if (element.hasAmountElement()) {
52755        composeStringCore("amount", element.getAmountElement(), false);
52756        composeStringExtras("amount", element.getAmountElement(), false);
52757      }
52758  }
52759
52760  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponent(String name, SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
52761    if (element != null) {
52762      open(name);
52763      composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(element);
52764      close();
52765    }
52766  }
52767
52768  protected void composeSubstanceSpecificationSubstanceSpecificationPropertyComponentInner(SubstanceSpecification.SubstanceSpecificationPropertyComponent element) throws IOException {
52769      composeBackbone(element);
52770      if (element.hasType()) {
52771        composeCodeableConcept("type", element.getType());
52772      }
52773      if (element.hasName()) {
52774        composeCodeableConcept("name", element.getName());
52775      }
52776      if (element.hasParametersElement()) {
52777        composeStringCore("parameters", element.getParametersElement(), false);
52778        composeStringExtras("parameters", element.getParametersElement(), false);
52779      }
52780      if (element.hasSubstanceId()) {
52781        composeIdentifier("substanceId", element.getSubstanceId());
52782      }
52783      if (element.hasSubstanceNameElement()) {
52784        composeStringCore("substanceName", element.getSubstanceNameElement(), false);
52785        composeStringExtras("substanceName", element.getSubstanceNameElement(), false);
52786      }
52787      if (element.hasAmountElement()) {
52788        composeStringCore("amount", element.getAmountElement(), false);
52789        composeStringExtras("amount", element.getAmountElement(), false);
52790      }
52791  }
52792
52793  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
52794    if (element != null) {
52795      open(name);
52796      composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(element);
52797      close();
52798    }
52799  }
52800
52801  protected void composeSubstanceSpecificationSubstanceSpecificationStructureComponentInner(SubstanceSpecification.SubstanceSpecificationStructureComponent element) throws IOException {
52802      composeBackbone(element);
52803      if (element.hasStereochemistry()) {
52804        composeCodeableConcept("stereochemistry", element.getStereochemistry());
52805      }
52806      if (element.hasOpticalActivity()) {
52807        composeCodeableConcept("opticalActivity", element.getOpticalActivity());
52808      }
52809      if (element.hasMolecularFormulaElement()) {
52810        composeStringCore("molecularFormula", element.getMolecularFormulaElement(), false);
52811        composeStringExtras("molecularFormula", element.getMolecularFormulaElement(), false);
52812      }
52813      if (element.hasMolecularFormulaByMoietyElement()) {
52814        composeStringCore("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
52815        composeStringExtras("molecularFormulaByMoiety", element.getMolecularFormulaByMoietyElement(), false);
52816      }
52817      if (element.hasIsotope()) {
52818        openArray("isotope");
52819        for (SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent e : element.getIsotope()) 
52820          composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(null, e);
52821        closeArray();
52822      };
52823      if (element.hasMolecularWeight()) {
52824        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
52825      }
52826      if (element.hasReferenceSource()) {
52827        openArray("referenceSource");
52828        for (Reference e : element.getReferenceSource()) 
52829          composeReference(null, e);
52830        closeArray();
52831      };
52832      if (element.hasStructuralRepresentation()) {
52833        openArray("structuralRepresentation");
52834        for (SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent e : element.getStructuralRepresentation()) 
52835          composeSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponent(null, e);
52836        closeArray();
52837      };
52838  }
52839
52840  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
52841    if (element != null) {
52842      open(name);
52843      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(element);
52844      close();
52845    }
52846  }
52847
52848  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeComponent element) throws IOException {
52849      composeBackbone(element);
52850      if (element.hasNuclideId()) {
52851        composeIdentifier("nuclideId", element.getNuclideId());
52852      }
52853      if (element.hasNuclideName()) {
52854        composeCodeableConcept("nuclideName", element.getNuclideName());
52855      }
52856      if (element.hasSubstitutionType()) {
52857        composeCodeableConcept("substitutionType", element.getSubstitutionType());
52858      }
52859      if (element.hasNuclideHalfLife()) {
52860        composeQuantity("nuclideHalfLife", element.getNuclideHalfLife());
52861      }
52862      if (element.hasAmountElement()) {
52863        composeStringCore("amount", element.getAmountElement(), false);
52864        composeStringExtras("amount", element.getAmountElement(), false);
52865      }
52866      if (element.hasMolecularWeight()) {
52867        composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent("molecularWeight", element.getMolecularWeight());
52868      }
52869  }
52870
52871  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
52872    if (element != null) {
52873      open(name);
52874      composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(element);
52875      close();
52876    }
52877  }
52878
52879  protected void composeSubstanceSpecificationSubstanceSpecificationStructureIsotopeMolecularWeightComponentInner(SubstanceSpecification.SubstanceSpecificationStructureIsotopeMolecularWeightComponent element) throws IOException {
52880      composeBackbone(element);
52881      if (element.hasMethod()) {
52882        composeCodeableConcept("method", element.getMethod());
52883      }
52884      if (element.hasType()) {
52885        composeCodeableConcept("type", element.getType());
52886      }
52887      if (element.hasAmountElement()) {
52888        composeStringCore("amount", element.getAmountElement(), false);
52889        composeStringExtras("amount", element.getAmountElement(), false);
52890      }
52891  }
52892
52893  protected void composeSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponent(String name, SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent element) throws IOException {
52894    if (element != null) {
52895      open(name);
52896      composeSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponentInner(element);
52897      close();
52898    }
52899  }
52900
52901  protected void composeSubstanceSpecificationSubstanceSpecificationStructureStructuralRepresentationComponentInner(SubstanceSpecification.SubstanceSpecificationStructureStructuralRepresentationComponent element) throws IOException {
52902      composeBackbone(element);
52903      if (element.hasType()) {
52904        composeCodeableConcept("type", element.getType());
52905      }
52906      if (element.hasRepresentationElement()) {
52907        composeStringCore("representation", element.getRepresentationElement(), false);
52908        composeStringExtras("representation", element.getRepresentationElement(), false);
52909      }
52910      if (element.hasAttachment()) {
52911        composeAttachment("attachment", element.getAttachment());
52912      }
52913  }
52914
52915  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponent(String name, SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent element) throws IOException {
52916    if (element != null) {
52917      open(name);
52918      composeSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponentInner(element);
52919      close();
52920    }
52921  }
52922
52923  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceCodeComponentInner(SubstanceSpecification.SubstanceSpecificationSubstanceCodeComponent element) throws IOException {
52924      composeBackbone(element);
52925      if (element.hasCode()) {
52926        composeCodeableConcept("code", element.getCode());
52927      }
52928      if (element.hasStatus()) {
52929        composeCodeableConcept("status", element.getStatus());
52930      }
52931      if (element.hasStatusDateElement()) {
52932        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
52933        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
52934      }
52935      if (element.hasCommentElement()) {
52936        composeStringCore("comment", element.getCommentElement(), false);
52937        composeStringExtras("comment", element.getCommentElement(), false);
52938      }
52939      if (element.hasReferenceSource()) {
52940        openArray("referenceSource");
52941        for (StringType e : element.getReferenceSource()) 
52942          composeStringCore(null, e, true);
52943        closeArray();
52944        if (anyHasExtras(element.getReferenceSource())) {
52945          openArray("_referenceSource");
52946          for (StringType e : element.getReferenceSource()) 
52947            composeStringExtras(null, e, true);
52948          closeArray();
52949        }
52950      };
52951  }
52952
52953  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceNameComponent(String name, SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent element) throws IOException {
52954    if (element != null) {
52955      open(name);
52956      composeSubstanceSpecificationSubstanceSpecificationSubstanceNameComponentInner(element);
52957      close();
52958    }
52959  }
52960
52961  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceNameComponentInner(SubstanceSpecification.SubstanceSpecificationSubstanceNameComponent element) throws IOException {
52962      composeBackbone(element);
52963      if (element.hasNameElement()) {
52964        composeStringCore("name", element.getNameElement(), false);
52965        composeStringExtras("name", element.getNameElement(), false);
52966      }
52967      if (element.hasType()) {
52968        composeCodeableConcept("type", element.getType());
52969      }
52970      if (element.hasLanguage()) {
52971        openArray("language");
52972        for (CodeableConcept e : element.getLanguage()) 
52973          composeCodeableConcept(null, e);
52974        closeArray();
52975      };
52976      if (element.hasDomain()) {
52977        openArray("domain");
52978        for (CodeableConcept e : element.getDomain()) 
52979          composeCodeableConcept(null, e);
52980        closeArray();
52981      };
52982      if (element.hasJurisdiction()) {
52983        openArray("jurisdiction");
52984        for (CodeableConcept e : element.getJurisdiction()) 
52985          composeCodeableConcept(null, e);
52986        closeArray();
52987      };
52988      if (element.hasOfficialName()) {
52989        openArray("officialName");
52990        for (SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent e : element.getOfficialName()) 
52991          composeSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponent(null, e);
52992        closeArray();
52993      };
52994      if (element.hasReferenceSource()) {
52995        openArray("referenceSource");
52996        for (StringType e : element.getReferenceSource()) 
52997          composeStringCore(null, e, true);
52998        closeArray();
52999        if (anyHasExtras(element.getReferenceSource())) {
53000          openArray("_referenceSource");
53001          for (StringType e : element.getReferenceSource()) 
53002            composeStringExtras(null, e, true);
53003          closeArray();
53004        }
53005      };
53006  }
53007
53008  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponent(String name, SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent element) throws IOException {
53009    if (element != null) {
53010      open(name);
53011      composeSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponentInner(element);
53012      close();
53013    }
53014  }
53015
53016  protected void composeSubstanceSpecificationSubstanceSpecificationSubstanceNameOfficialNameComponentInner(SubstanceSpecification.SubstanceSpecificationSubstanceNameOfficialNameComponent element) throws IOException {
53017      composeBackbone(element);
53018      if (element.hasAuthority()) {
53019        composeCodeableConcept("authority", element.getAuthority());
53020      }
53021      if (element.hasStatus()) {
53022        composeCodeableConcept("status", element.getStatus());
53023      }
53024      if (element.hasDateElement()) {
53025        composeDateTimeCore("date", element.getDateElement(), false);
53026        composeDateTimeExtras("date", element.getDateElement(), false);
53027      }
53028  }
53029
53030  protected void composeSupplyDelivery(String name, SupplyDelivery element) throws IOException {
53031    if (element != null) {
53032      prop("resourceType", name);
53033      composeSupplyDeliveryInner(element);
53034    }
53035  }
53036
53037  protected void composeSupplyDeliveryInner(SupplyDelivery element) throws IOException {
53038      composeDomainResourceElements(element);
53039      if (element.hasIdentifier()) {
53040        openArray("identifier");
53041        for (Identifier e : element.getIdentifier()) 
53042          composeIdentifier(null, e);
53043        closeArray();
53044      };
53045      if (element.hasBasedOn()) {
53046        openArray("basedOn");
53047        for (Reference e : element.getBasedOn()) 
53048          composeReference(null, e);
53049        closeArray();
53050      };
53051      if (element.hasPartOf()) {
53052        openArray("partOf");
53053        for (Reference e : element.getPartOf()) 
53054          composeReference(null, e);
53055        closeArray();
53056      };
53057      if (element.hasStatusElement()) {
53058        composeEnumerationCore("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
53059        composeEnumerationExtras("status", element.getStatusElement(), new SupplyDelivery.SupplyDeliveryStatusEnumFactory(), false);
53060      }
53061      if (element.hasPatient()) {
53062        composeReference("patient", element.getPatient());
53063      }
53064      if (element.hasType()) {
53065        composeCodeableConcept("type", element.getType());
53066      }
53067      if (element.hasSuppliedItem()) {
53068        composeSupplyDeliverySupplyDeliverySuppliedItemComponent("suppliedItem", element.getSuppliedItem());
53069      }
53070      if (element.hasOccurrence()) {
53071        composeType("occurrence", element.getOccurrence());
53072      }
53073      if (element.hasSupplier()) {
53074        composeReference("supplier", element.getSupplier());
53075      }
53076      if (element.hasDestination()) {
53077        composeReference("destination", element.getDestination());
53078      }
53079      if (element.hasReceiver()) {
53080        openArray("receiver");
53081        for (Reference e : element.getReceiver()) 
53082          composeReference(null, e);
53083        closeArray();
53084      };
53085  }
53086
53087  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponent(String name, SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
53088    if (element != null) {
53089      open(name);
53090      composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(element);
53091      close();
53092    }
53093  }
53094
53095  protected void composeSupplyDeliverySupplyDeliverySuppliedItemComponentInner(SupplyDelivery.SupplyDeliverySuppliedItemComponent element) throws IOException {
53096      composeBackbone(element);
53097      if (element.hasQuantity()) {
53098        composeQuantity("quantity", element.getQuantity());
53099      }
53100      if (element.hasItem()) {
53101        composeType("item", element.getItem());
53102      }
53103  }
53104
53105  protected void composeSupplyRequest(String name, SupplyRequest element) throws IOException {
53106    if (element != null) {
53107      prop("resourceType", name);
53108      composeSupplyRequestInner(element);
53109    }
53110  }
53111
53112  protected void composeSupplyRequestInner(SupplyRequest element) throws IOException {
53113      composeDomainResourceElements(element);
53114      if (element.hasIdentifier()) {
53115        composeIdentifier("identifier", element.getIdentifier());
53116      }
53117      if (element.hasStatusElement()) {
53118        composeEnumerationCore("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
53119        composeEnumerationExtras("status", element.getStatusElement(), new SupplyRequest.SupplyRequestStatusEnumFactory(), false);
53120      }
53121      if (element.hasCategory()) {
53122        composeCodeableConcept("category", element.getCategory());
53123      }
53124      if (element.hasPriorityElement()) {
53125        composeEnumerationCore("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
53126        composeEnumerationExtras("priority", element.getPriorityElement(), new SupplyRequest.RequestPriorityEnumFactory(), false);
53127      }
53128      if (element.hasItem()) {
53129        composeType("item", element.getItem());
53130      }
53131      if (element.hasQuantity()) {
53132        composeQuantity("quantity", element.getQuantity());
53133      }
53134      if (element.hasParameter()) {
53135        openArray("parameter");
53136        for (SupplyRequest.SupplyRequestParameterComponent e : element.getParameter()) 
53137          composeSupplyRequestSupplyRequestParameterComponent(null, e);
53138        closeArray();
53139      };
53140      if (element.hasOccurrence()) {
53141        composeType("occurrence", element.getOccurrence());
53142      }
53143      if (element.hasAuthoredOnElement()) {
53144        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
53145        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
53146      }
53147      if (element.hasRequester()) {
53148        composeReference("requester", element.getRequester());
53149      }
53150      if (element.hasSupplier()) {
53151        openArray("supplier");
53152        for (Reference e : element.getSupplier()) 
53153          composeReference(null, e);
53154        closeArray();
53155      };
53156      if (element.hasReasonCode()) {
53157        openArray("reasonCode");
53158        for (CodeableConcept e : element.getReasonCode()) 
53159          composeCodeableConcept(null, e);
53160        closeArray();
53161      };
53162      if (element.hasReasonReference()) {
53163        openArray("reasonReference");
53164        for (Reference e : element.getReasonReference()) 
53165          composeReference(null, e);
53166        closeArray();
53167      };
53168      if (element.hasDeliverFrom()) {
53169        composeReference("deliverFrom", element.getDeliverFrom());
53170      }
53171      if (element.hasDeliverTo()) {
53172        composeReference("deliverTo", element.getDeliverTo());
53173      }
53174  }
53175
53176  protected void composeSupplyRequestSupplyRequestParameterComponent(String name, SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
53177    if (element != null) {
53178      open(name);
53179      composeSupplyRequestSupplyRequestParameterComponentInner(element);
53180      close();
53181    }
53182  }
53183
53184  protected void composeSupplyRequestSupplyRequestParameterComponentInner(SupplyRequest.SupplyRequestParameterComponent element) throws IOException {
53185      composeBackbone(element);
53186      if (element.hasCode()) {
53187        composeCodeableConcept("code", element.getCode());
53188      }
53189      if (element.hasValue()) {
53190        composeType("value", element.getValue());
53191      }
53192  }
53193
53194  protected void composeTask(String name, Task element) throws IOException {
53195    if (element != null) {
53196      prop("resourceType", name);
53197      composeTaskInner(element);
53198    }
53199  }
53200
53201  protected void composeTaskInner(Task element) throws IOException {
53202      composeDomainResourceElements(element);
53203      if (element.hasIdentifier()) {
53204        openArray("identifier");
53205        for (Identifier e : element.getIdentifier()) 
53206          composeIdentifier(null, e);
53207        closeArray();
53208      };
53209      if (element.hasInstantiatesCanonicalElement()) {
53210        composeCanonicalCore("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
53211        composeCanonicalExtras("instantiatesCanonical", element.getInstantiatesCanonicalElement(), false);
53212      }
53213      if (element.hasInstantiatesUriElement()) {
53214        composeUriCore("instantiatesUri", element.getInstantiatesUriElement(), false);
53215        composeUriExtras("instantiatesUri", element.getInstantiatesUriElement(), false);
53216      }
53217      if (element.hasBasedOn()) {
53218        openArray("basedOn");
53219        for (Reference e : element.getBasedOn()) 
53220          composeReference(null, e);
53221        closeArray();
53222      };
53223      if (element.hasGroupIdentifier()) {
53224        composeIdentifier("groupIdentifier", element.getGroupIdentifier());
53225      }
53226      if (element.hasPartOf()) {
53227        openArray("partOf");
53228        for (Reference e : element.getPartOf()) 
53229          composeReference(null, e);
53230        closeArray();
53231      };
53232      if (element.hasStatusElement()) {
53233        composeEnumerationCore("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
53234        composeEnumerationExtras("status", element.getStatusElement(), new Task.TaskStatusEnumFactory(), false);
53235      }
53236      if (element.hasStatusReason()) {
53237        composeCodeableConcept("statusReason", element.getStatusReason());
53238      }
53239      if (element.hasBusinessStatus()) {
53240        composeCodeableConcept("businessStatus", element.getBusinessStatus());
53241      }
53242      if (element.hasIntentElement()) {
53243        composeEnumerationCore("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
53244        composeEnumerationExtras("intent", element.getIntentElement(), new Task.TaskIntentEnumFactory(), false);
53245      }
53246      if (element.hasPriorityElement()) {
53247        composeEnumerationCore("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
53248        composeEnumerationExtras("priority", element.getPriorityElement(), new Task.TaskPriorityEnumFactory(), false);
53249      }
53250      if (element.hasCode()) {
53251        composeCodeableConcept("code", element.getCode());
53252      }
53253      if (element.hasDescriptionElement()) {
53254        composeStringCore("description", element.getDescriptionElement(), false);
53255        composeStringExtras("description", element.getDescriptionElement(), false);
53256      }
53257      if (element.hasFocus()) {
53258        composeReference("focus", element.getFocus());
53259      }
53260      if (element.hasFor()) {
53261        composeReference("for", element.getFor());
53262      }
53263      if (element.hasContext()) {
53264        composeReference("context", element.getContext());
53265      }
53266      if (element.hasExecutionPeriod()) {
53267        composePeriod("executionPeriod", element.getExecutionPeriod());
53268      }
53269      if (element.hasAuthoredOnElement()) {
53270        composeDateTimeCore("authoredOn", element.getAuthoredOnElement(), false);
53271        composeDateTimeExtras("authoredOn", element.getAuthoredOnElement(), false);
53272      }
53273      if (element.hasLastModifiedElement()) {
53274        composeDateTimeCore("lastModified", element.getLastModifiedElement(), false);
53275        composeDateTimeExtras("lastModified", element.getLastModifiedElement(), false);
53276      }
53277      if (element.hasRequester()) {
53278        composeReference("requester", element.getRequester());
53279      }
53280      if (element.hasPerformerType()) {
53281        openArray("performerType");
53282        for (CodeableConcept e : element.getPerformerType()) 
53283          composeCodeableConcept(null, e);
53284        closeArray();
53285      };
53286      if (element.hasOwner()) {
53287        composeReference("owner", element.getOwner());
53288      }
53289      if (element.hasLocation()) {
53290        composeReference("location", element.getLocation());
53291      }
53292      if (element.hasReasonCode()) {
53293        composeCodeableConcept("reasonCode", element.getReasonCode());
53294      }
53295      if (element.hasReasonReference()) {
53296        composeReference("reasonReference", element.getReasonReference());
53297      }
53298      if (element.hasInsurance()) {
53299        openArray("insurance");
53300        for (Reference e : element.getInsurance()) 
53301          composeReference(null, e);
53302        closeArray();
53303      };
53304      if (element.hasNote()) {
53305        openArray("note");
53306        for (Annotation e : element.getNote()) 
53307          composeAnnotation(null, e);
53308        closeArray();
53309      };
53310      if (element.hasRelevantHistory()) {
53311        openArray("relevantHistory");
53312        for (Reference e : element.getRelevantHistory()) 
53313          composeReference(null, e);
53314        closeArray();
53315      };
53316      if (element.hasRestriction()) {
53317        composeTaskTaskRestrictionComponent("restriction", element.getRestriction());
53318      }
53319      if (element.hasInput()) {
53320        openArray("input");
53321        for (Task.ParameterComponent e : element.getInput()) 
53322          composeTaskParameterComponent(null, e);
53323        closeArray();
53324      };
53325      if (element.hasOutput()) {
53326        openArray("output");
53327        for (Task.TaskOutputComponent e : element.getOutput()) 
53328          composeTaskTaskOutputComponent(null, e);
53329        closeArray();
53330      };
53331  }
53332
53333  protected void composeTaskTaskRestrictionComponent(String name, Task.TaskRestrictionComponent element) throws IOException {
53334    if (element != null) {
53335      open(name);
53336      composeTaskTaskRestrictionComponentInner(element);
53337      close();
53338    }
53339  }
53340
53341  protected void composeTaskTaskRestrictionComponentInner(Task.TaskRestrictionComponent element) throws IOException {
53342      composeBackbone(element);
53343      if (element.hasRepetitionsElement()) {
53344        composePositiveIntCore("repetitions", element.getRepetitionsElement(), false);
53345        composePositiveIntExtras("repetitions", element.getRepetitionsElement(), false);
53346      }
53347      if (element.hasPeriod()) {
53348        composePeriod("period", element.getPeriod());
53349      }
53350      if (element.hasRecipient()) {
53351        openArray("recipient");
53352        for (Reference e : element.getRecipient()) 
53353          composeReference(null, e);
53354        closeArray();
53355      };
53356  }
53357
53358  protected void composeTaskParameterComponent(String name, Task.ParameterComponent element) throws IOException {
53359    if (element != null) {
53360      open(name);
53361      composeTaskParameterComponentInner(element);
53362      close();
53363    }
53364  }
53365
53366  protected void composeTaskParameterComponentInner(Task.ParameterComponent element) throws IOException {
53367      composeBackbone(element);
53368      if (element.hasType()) {
53369        composeCodeableConcept("type", element.getType());
53370      }
53371      if (element.hasValue()) {
53372        composeType("value", element.getValue());
53373      }
53374  }
53375
53376  protected void composeTaskTaskOutputComponent(String name, Task.TaskOutputComponent element) throws IOException {
53377    if (element != null) {
53378      open(name);
53379      composeTaskTaskOutputComponentInner(element);
53380      close();
53381    }
53382  }
53383
53384  protected void composeTaskTaskOutputComponentInner(Task.TaskOutputComponent element) throws IOException {
53385      composeBackbone(element);
53386      if (element.hasType()) {
53387        composeCodeableConcept("type", element.getType());
53388      }
53389      if (element.hasValue()) {
53390        composeType("value", element.getValue());
53391      }
53392  }
53393
53394  protected void composeTerminologyCapabilities(String name, TerminologyCapabilities element) throws IOException {
53395    if (element != null) {
53396      prop("resourceType", name);
53397      composeTerminologyCapabilitiesInner(element);
53398    }
53399  }
53400
53401  protected void composeTerminologyCapabilitiesInner(TerminologyCapabilities element) throws IOException {
53402      composeDomainResourceElements(element);
53403      if (element.hasUrlElement()) {
53404        composeUriCore("url", element.getUrlElement(), false);
53405        composeUriExtras("url", element.getUrlElement(), false);
53406      }
53407      if (element.hasVersionElement()) {
53408        composeStringCore("version", element.getVersionElement(), false);
53409        composeStringExtras("version", element.getVersionElement(), false);
53410      }
53411      if (element.hasNameElement()) {
53412        composeStringCore("name", element.getNameElement(), false);
53413        composeStringExtras("name", element.getNameElement(), false);
53414      }
53415      if (element.hasTitleElement()) {
53416        composeStringCore("title", element.getTitleElement(), false);
53417        composeStringExtras("title", element.getTitleElement(), false);
53418      }
53419      if (element.hasStatusElement()) {
53420        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53421        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
53422      }
53423      if (element.hasExperimentalElement()) {
53424        composeBooleanCore("experimental", element.getExperimentalElement(), false);
53425        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
53426      }
53427      if (element.hasDateElement()) {
53428        composeDateTimeCore("date", element.getDateElement(), false);
53429        composeDateTimeExtras("date", element.getDateElement(), false);
53430      }
53431      if (element.hasPublisherElement()) {
53432        composeStringCore("publisher", element.getPublisherElement(), false);
53433        composeStringExtras("publisher", element.getPublisherElement(), false);
53434      }
53435      if (element.hasContact()) {
53436        openArray("contact");
53437        for (ContactDetail e : element.getContact()) 
53438          composeContactDetail(null, e);
53439        closeArray();
53440      };
53441      if (element.hasDescriptionElement()) {
53442        composeMarkdownCore("description", element.getDescriptionElement(), false);
53443        composeMarkdownExtras("description", element.getDescriptionElement(), false);
53444      }
53445      if (element.hasUseContext()) {
53446        openArray("useContext");
53447        for (UsageContext e : element.getUseContext()) 
53448          composeUsageContext(null, e);
53449        closeArray();
53450      };
53451      if (element.hasJurisdiction()) {
53452        openArray("jurisdiction");
53453        for (CodeableConcept e : element.getJurisdiction()) 
53454          composeCodeableConcept(null, e);
53455        closeArray();
53456      };
53457      if (element.hasPurposeElement()) {
53458        composeMarkdownCore("purpose", element.getPurposeElement(), false);
53459        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
53460      }
53461      if (element.hasCopyrightElement()) {
53462        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
53463        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
53464      }
53465      if (element.hasKindElement()) {
53466        composeEnumerationCore("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
53467        composeEnumerationExtras("kind", element.getKindElement(), new TerminologyCapabilities.CapabilityStatementKindEnumFactory(), false);
53468      }
53469      if (element.hasSoftware()) {
53470        composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent("software", element.getSoftware());
53471      }
53472      if (element.hasImplementation()) {
53473        composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent("implementation", element.getImplementation());
53474      }
53475      if (element.hasLockedDateElement()) {
53476        composeBooleanCore("lockedDate", element.getLockedDateElement(), false);
53477        composeBooleanExtras("lockedDate", element.getLockedDateElement(), false);
53478      }
53479      if (element.hasCodeSystem()) {
53480        openArray("codeSystem");
53481        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent e : element.getCodeSystem()) 
53482          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(null, e);
53483        closeArray();
53484      };
53485      if (element.hasExpansion()) {
53486        composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent("expansion", element.getExpansion());
53487      }
53488      if (element.hasCodeSearchElement()) {
53489        composeEnumerationCore("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
53490        composeEnumerationExtras("codeSearch", element.getCodeSearchElement(), new TerminologyCapabilities.CodeSearchSupportEnumFactory(), false);
53491      }
53492      if (element.hasValidateCode()) {
53493        composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent("validateCode", element.getValidateCode());
53494      }
53495      if (element.hasTranslation()) {
53496        composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent("translation", element.getTranslation());
53497      }
53498      if (element.hasClosure()) {
53499        composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent("closure", element.getClosure());
53500      }
53501  }
53502
53503  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
53504    if (element != null) {
53505      open(name);
53506      composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(element);
53507      close();
53508    }
53509  }
53510
53511  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesSoftwareComponentInner(TerminologyCapabilities.TerminologyCapabilitiesSoftwareComponent element) throws IOException {
53512      composeBackbone(element);
53513      if (element.hasNameElement()) {
53514        composeStringCore("name", element.getNameElement(), false);
53515        composeStringExtras("name", element.getNameElement(), false);
53516      }
53517      if (element.hasVersionElement()) {
53518        composeStringCore("version", element.getVersionElement(), false);
53519        composeStringExtras("version", element.getVersionElement(), false);
53520      }
53521  }
53522
53523  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
53524    if (element != null) {
53525      open(name);
53526      composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(element);
53527      close();
53528    }
53529  }
53530
53531  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesImplementationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesImplementationComponent element) throws IOException {
53532      composeBackbone(element);
53533      if (element.hasDescriptionElement()) {
53534        composeStringCore("description", element.getDescriptionElement(), false);
53535        composeStringExtras("description", element.getDescriptionElement(), false);
53536      }
53537      if (element.hasUrlElement()) {
53538        composeUrlCore("url", element.getUrlElement(), false);
53539        composeUrlExtras("url", element.getUrlElement(), false);
53540      }
53541  }
53542
53543  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
53544    if (element != null) {
53545      open(name);
53546      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(element);
53547      close();
53548    }
53549  }
53550
53551  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemComponent element) throws IOException {
53552      composeBackbone(element);
53553      if (element.hasUriElement()) {
53554        composeCanonicalCore("uri", element.getUriElement(), false);
53555        composeCanonicalExtras("uri", element.getUriElement(), false);
53556      }
53557      if (element.hasVersion()) {
53558        openArray("version");
53559        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent e : element.getVersion()) 
53560          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(null, e);
53561        closeArray();
53562      };
53563      if (element.hasSubsumptionElement()) {
53564        composeBooleanCore("subsumption", element.getSubsumptionElement(), false);
53565        composeBooleanExtras("subsumption", element.getSubsumptionElement(), false);
53566      }
53567  }
53568
53569  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
53570    if (element != null) {
53571      open(name);
53572      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(element);
53573      close();
53574    }
53575  }
53576
53577  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionComponent element) throws IOException {
53578      composeBackbone(element);
53579      if (element.hasCodeElement()) {
53580        composeStringCore("code", element.getCodeElement(), false);
53581        composeStringExtras("code", element.getCodeElement(), false);
53582      }
53583      if (element.hasIsDefaultElement()) {
53584        composeBooleanCore("isDefault", element.getIsDefaultElement(), false);
53585        composeBooleanExtras("isDefault", element.getIsDefaultElement(), false);
53586      }
53587      if (element.hasCompositionalElement()) {
53588        composeBooleanCore("compositional", element.getCompositionalElement(), false);
53589        composeBooleanExtras("compositional", element.getCompositionalElement(), false);
53590      }
53591      if (element.hasLanguage()) {
53592        openArray("language");
53593        for (CodeType e : element.getLanguage()) 
53594          composeCodeCore(null, e, true);
53595        closeArray();
53596        if (anyHasExtras(element.getLanguage())) {
53597          openArray("_language");
53598          for (CodeType e : element.getLanguage()) 
53599            composeCodeExtras(null, e, true);
53600          closeArray();
53601        }
53602      };
53603      if (element.hasFilter()) {
53604        openArray("filter");
53605        for (TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent e : element.getFilter()) 
53606          composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(null, e);
53607        closeArray();
53608      };
53609      if (element.hasProperty()) {
53610        openArray("property");
53611        for (CodeType e : element.getProperty()) 
53612          composeCodeCore(null, e, true);
53613        closeArray();
53614        if (anyHasExtras(element.getProperty())) {
53615          openArray("_property");
53616          for (CodeType e : element.getProperty()) 
53617            composeCodeExtras(null, e, true);
53618          closeArray();
53619        }
53620      };
53621  }
53622
53623  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
53624    if (element != null) {
53625      open(name);
53626      composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(element);
53627      close();
53628    }
53629  }
53630
53631  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesCodeSystemVersionFilterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesCodeSystemVersionFilterComponent element) throws IOException {
53632      composeBackbone(element);
53633      if (element.hasCodeElement()) {
53634        composeCodeCore("code", element.getCodeElement(), false);
53635        composeCodeExtras("code", element.getCodeElement(), false);
53636      }
53637      if (element.hasOp()) {
53638        openArray("op");
53639        for (CodeType e : element.getOp()) 
53640          composeCodeCore(null, e, true);
53641        closeArray();
53642        if (anyHasExtras(element.getOp())) {
53643          openArray("_op");
53644          for (CodeType e : element.getOp()) 
53645            composeCodeExtras(null, e, true);
53646          closeArray();
53647        }
53648      };
53649  }
53650
53651  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
53652    if (element != null) {
53653      open(name);
53654      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(element);
53655      close();
53656    }
53657  }
53658
53659  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionComponent element) throws IOException {
53660      composeBackbone(element);
53661      if (element.hasHierarchicalElement()) {
53662        composeBooleanCore("hierarchical", element.getHierarchicalElement(), false);
53663        composeBooleanExtras("hierarchical", element.getHierarchicalElement(), false);
53664      }
53665      if (element.hasPagingElement()) {
53666        composeBooleanCore("paging", element.getPagingElement(), false);
53667        composeBooleanExtras("paging", element.getPagingElement(), false);
53668      }
53669      if (element.hasIncompleteElement()) {
53670        composeBooleanCore("incomplete", element.getIncompleteElement(), false);
53671        composeBooleanExtras("incomplete", element.getIncompleteElement(), false);
53672      }
53673      if (element.hasParameter()) {
53674        openArray("parameter");
53675        for (TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent e : element.getParameter()) 
53676          composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(null, e);
53677        closeArray();
53678      };
53679      if (element.hasTextFilterElement()) {
53680        composeMarkdownCore("textFilter", element.getTextFilterElement(), false);
53681        composeMarkdownExtras("textFilter", element.getTextFilterElement(), false);
53682      }
53683  }
53684
53685  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
53686    if (element != null) {
53687      open(name);
53688      composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(element);
53689      close();
53690    }
53691  }
53692
53693  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesExpansionParameterComponentInner(TerminologyCapabilities.TerminologyCapabilitiesExpansionParameterComponent element) throws IOException {
53694      composeBackbone(element);
53695      if (element.hasNameElement()) {
53696        composeCodeCore("name", element.getNameElement(), false);
53697        composeCodeExtras("name", element.getNameElement(), false);
53698      }
53699      if (element.hasDocumentationElement()) {
53700        composeStringCore("documentation", element.getDocumentationElement(), false);
53701        composeStringExtras("documentation", element.getDocumentationElement(), false);
53702      }
53703  }
53704
53705  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
53706    if (element != null) {
53707      open(name);
53708      composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(element);
53709      close();
53710    }
53711  }
53712
53713  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesValidateCodeComponentInner(TerminologyCapabilities.TerminologyCapabilitiesValidateCodeComponent element) throws IOException {
53714      composeBackbone(element);
53715      if (element.hasTranslationsElement()) {
53716        composeBooleanCore("translations", element.getTranslationsElement(), false);
53717        composeBooleanExtras("translations", element.getTranslationsElement(), false);
53718      }
53719  }
53720
53721  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
53722    if (element != null) {
53723      open(name);
53724      composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(element);
53725      close();
53726    }
53727  }
53728
53729  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesTranslationComponentInner(TerminologyCapabilities.TerminologyCapabilitiesTranslationComponent element) throws IOException {
53730      composeBackbone(element);
53731      if (element.hasNeedsMapElement()) {
53732        composeBooleanCore("needsMap", element.getNeedsMapElement(), false);
53733        composeBooleanExtras("needsMap", element.getNeedsMapElement(), false);
53734      }
53735  }
53736
53737  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponent(String name, TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
53738    if (element != null) {
53739      open(name);
53740      composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(element);
53741      close();
53742    }
53743  }
53744
53745  protected void composeTerminologyCapabilitiesTerminologyCapabilitiesClosureComponentInner(TerminologyCapabilities.TerminologyCapabilitiesClosureComponent element) throws IOException {
53746      composeBackbone(element);
53747      if (element.hasTranslationElement()) {
53748        composeBooleanCore("translation", element.getTranslationElement(), false);
53749        composeBooleanExtras("translation", element.getTranslationElement(), false);
53750      }
53751  }
53752
53753  protected void composeTestReport(String name, TestReport element) throws IOException {
53754    if (element != null) {
53755      prop("resourceType", name);
53756      composeTestReportInner(element);
53757    }
53758  }
53759
53760  protected void composeTestReportInner(TestReport element) throws IOException {
53761      composeDomainResourceElements(element);
53762      if (element.hasIdentifier()) {
53763        composeIdentifier("identifier", element.getIdentifier());
53764      }
53765      if (element.hasNameElement()) {
53766        composeStringCore("name", element.getNameElement(), false);
53767        composeStringExtras("name", element.getNameElement(), false);
53768      }
53769      if (element.hasStatusElement()) {
53770        composeEnumerationCore("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
53771        composeEnumerationExtras("status", element.getStatusElement(), new TestReport.TestReportStatusEnumFactory(), false);
53772      }
53773      if (element.hasTestScript()) {
53774        composeReference("testScript", element.getTestScript());
53775      }
53776      if (element.hasResultElement()) {
53777        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
53778        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportResultEnumFactory(), false);
53779      }
53780      if (element.hasScoreElement()) {
53781        composeDecimalCore("score", element.getScoreElement(), false);
53782        composeDecimalExtras("score", element.getScoreElement(), false);
53783      }
53784      if (element.hasTesterElement()) {
53785        composeStringCore("tester", element.getTesterElement(), false);
53786        composeStringExtras("tester", element.getTesterElement(), false);
53787      }
53788      if (element.hasIssuedElement()) {
53789        composeDateTimeCore("issued", element.getIssuedElement(), false);
53790        composeDateTimeExtras("issued", element.getIssuedElement(), false);
53791      }
53792      if (element.hasParticipant()) {
53793        openArray("participant");
53794        for (TestReport.TestReportParticipantComponent e : element.getParticipant()) 
53795          composeTestReportTestReportParticipantComponent(null, e);
53796        closeArray();
53797      };
53798      if (element.hasSetup()) {
53799        composeTestReportTestReportSetupComponent("setup", element.getSetup());
53800      }
53801      if (element.hasTest()) {
53802        openArray("test");
53803        for (TestReport.TestReportTestComponent e : element.getTest()) 
53804          composeTestReportTestReportTestComponent(null, e);
53805        closeArray();
53806      };
53807      if (element.hasTeardown()) {
53808        composeTestReportTestReportTeardownComponent("teardown", element.getTeardown());
53809      }
53810  }
53811
53812  protected void composeTestReportTestReportParticipantComponent(String name, TestReport.TestReportParticipantComponent element) throws IOException {
53813    if (element != null) {
53814      open(name);
53815      composeTestReportTestReportParticipantComponentInner(element);
53816      close();
53817    }
53818  }
53819
53820  protected void composeTestReportTestReportParticipantComponentInner(TestReport.TestReportParticipantComponent element) throws IOException {
53821      composeBackbone(element);
53822      if (element.hasTypeElement()) {
53823        composeEnumerationCore("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
53824        composeEnumerationExtras("type", element.getTypeElement(), new TestReport.TestReportParticipantTypeEnumFactory(), false);
53825      }
53826      if (element.hasUriElement()) {
53827        composeUriCore("uri", element.getUriElement(), false);
53828        composeUriExtras("uri", element.getUriElement(), false);
53829      }
53830      if (element.hasDisplayElement()) {
53831        composeStringCore("display", element.getDisplayElement(), false);
53832        composeStringExtras("display", element.getDisplayElement(), false);
53833      }
53834  }
53835
53836  protected void composeTestReportTestReportSetupComponent(String name, TestReport.TestReportSetupComponent element) throws IOException {
53837    if (element != null) {
53838      open(name);
53839      composeTestReportTestReportSetupComponentInner(element);
53840      close();
53841    }
53842  }
53843
53844  protected void composeTestReportTestReportSetupComponentInner(TestReport.TestReportSetupComponent element) throws IOException {
53845      composeBackbone(element);
53846      if (element.hasAction()) {
53847        openArray("action");
53848        for (TestReport.SetupActionComponent e : element.getAction()) 
53849          composeTestReportSetupActionComponent(null, e);
53850        closeArray();
53851      };
53852  }
53853
53854  protected void composeTestReportSetupActionComponent(String name, TestReport.SetupActionComponent element) throws IOException {
53855    if (element != null) {
53856      open(name);
53857      composeTestReportSetupActionComponentInner(element);
53858      close();
53859    }
53860  }
53861
53862  protected void composeTestReportSetupActionComponentInner(TestReport.SetupActionComponent element) throws IOException {
53863      composeBackbone(element);
53864      if (element.hasOperation()) {
53865        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
53866      }
53867      if (element.hasAssert()) {
53868        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
53869      }
53870  }
53871
53872  protected void composeTestReportSetupActionOperationComponent(String name, TestReport.SetupActionOperationComponent element) throws IOException {
53873    if (element != null) {
53874      open(name);
53875      composeTestReportSetupActionOperationComponentInner(element);
53876      close();
53877    }
53878  }
53879
53880  protected void composeTestReportSetupActionOperationComponentInner(TestReport.SetupActionOperationComponent element) throws IOException {
53881      composeBackbone(element);
53882      if (element.hasResultElement()) {
53883        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
53884        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
53885      }
53886      if (element.hasMessageElement()) {
53887        composeMarkdownCore("message", element.getMessageElement(), false);
53888        composeMarkdownExtras("message", element.getMessageElement(), false);
53889      }
53890      if (element.hasDetailElement()) {
53891        composeUriCore("detail", element.getDetailElement(), false);
53892        composeUriExtras("detail", element.getDetailElement(), false);
53893      }
53894  }
53895
53896  protected void composeTestReportSetupActionAssertComponent(String name, TestReport.SetupActionAssertComponent element) throws IOException {
53897    if (element != null) {
53898      open(name);
53899      composeTestReportSetupActionAssertComponentInner(element);
53900      close();
53901    }
53902  }
53903
53904  protected void composeTestReportSetupActionAssertComponentInner(TestReport.SetupActionAssertComponent element) throws IOException {
53905      composeBackbone(element);
53906      if (element.hasResultElement()) {
53907        composeEnumerationCore("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
53908        composeEnumerationExtras("result", element.getResultElement(), new TestReport.TestReportActionResultEnumFactory(), false);
53909      }
53910      if (element.hasMessageElement()) {
53911        composeMarkdownCore("message", element.getMessageElement(), false);
53912        composeMarkdownExtras("message", element.getMessageElement(), false);
53913      }
53914      if (element.hasDetailElement()) {
53915        composeStringCore("detail", element.getDetailElement(), false);
53916        composeStringExtras("detail", element.getDetailElement(), false);
53917      }
53918  }
53919
53920  protected void composeTestReportTestReportTestComponent(String name, TestReport.TestReportTestComponent element) throws IOException {
53921    if (element != null) {
53922      open(name);
53923      composeTestReportTestReportTestComponentInner(element);
53924      close();
53925    }
53926  }
53927
53928  protected void composeTestReportTestReportTestComponentInner(TestReport.TestReportTestComponent element) throws IOException {
53929      composeBackbone(element);
53930      if (element.hasNameElement()) {
53931        composeStringCore("name", element.getNameElement(), false);
53932        composeStringExtras("name", element.getNameElement(), false);
53933      }
53934      if (element.hasDescriptionElement()) {
53935        composeStringCore("description", element.getDescriptionElement(), false);
53936        composeStringExtras("description", element.getDescriptionElement(), false);
53937      }
53938      if (element.hasAction()) {
53939        openArray("action");
53940        for (TestReport.TestActionComponent e : element.getAction()) 
53941          composeTestReportTestActionComponent(null, e);
53942        closeArray();
53943      };
53944  }
53945
53946  protected void composeTestReportTestActionComponent(String name, TestReport.TestActionComponent element) throws IOException {
53947    if (element != null) {
53948      open(name);
53949      composeTestReportTestActionComponentInner(element);
53950      close();
53951    }
53952  }
53953
53954  protected void composeTestReportTestActionComponentInner(TestReport.TestActionComponent element) throws IOException {
53955      composeBackbone(element);
53956      if (element.hasOperation()) {
53957        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
53958      }
53959      if (element.hasAssert()) {
53960        composeTestReportSetupActionAssertComponent("assert", element.getAssert());
53961      }
53962  }
53963
53964  protected void composeTestReportTestReportTeardownComponent(String name, TestReport.TestReportTeardownComponent element) throws IOException {
53965    if (element != null) {
53966      open(name);
53967      composeTestReportTestReportTeardownComponentInner(element);
53968      close();
53969    }
53970  }
53971
53972  protected void composeTestReportTestReportTeardownComponentInner(TestReport.TestReportTeardownComponent element) throws IOException {
53973      composeBackbone(element);
53974      if (element.hasAction()) {
53975        openArray("action");
53976        for (TestReport.TeardownActionComponent e : element.getAction()) 
53977          composeTestReportTeardownActionComponent(null, e);
53978        closeArray();
53979      };
53980  }
53981
53982  protected void composeTestReportTeardownActionComponent(String name, TestReport.TeardownActionComponent element) throws IOException {
53983    if (element != null) {
53984      open(name);
53985      composeTestReportTeardownActionComponentInner(element);
53986      close();
53987    }
53988  }
53989
53990  protected void composeTestReportTeardownActionComponentInner(TestReport.TeardownActionComponent element) throws IOException {
53991      composeBackbone(element);
53992      if (element.hasOperation()) {
53993        composeTestReportSetupActionOperationComponent("operation", element.getOperation());
53994      }
53995  }
53996
53997  protected void composeTestScript(String name, TestScript element) throws IOException {
53998    if (element != null) {
53999      prop("resourceType", name);
54000      composeTestScriptInner(element);
54001    }
54002  }
54003
54004  protected void composeTestScriptInner(TestScript element) throws IOException {
54005      composeDomainResourceElements(element);
54006      if (element.hasUrlElement()) {
54007        composeUriCore("url", element.getUrlElement(), false);
54008        composeUriExtras("url", element.getUrlElement(), false);
54009      }
54010      if (element.hasIdentifier()) {
54011        composeIdentifier("identifier", element.getIdentifier());
54012      }
54013      if (element.hasVersionElement()) {
54014        composeStringCore("version", element.getVersionElement(), false);
54015        composeStringExtras("version", element.getVersionElement(), false);
54016      }
54017      if (element.hasNameElement()) {
54018        composeStringCore("name", element.getNameElement(), false);
54019        composeStringExtras("name", element.getNameElement(), false);
54020      }
54021      if (element.hasTitleElement()) {
54022        composeStringCore("title", element.getTitleElement(), false);
54023        composeStringExtras("title", element.getTitleElement(), false);
54024      }
54025      if (element.hasStatusElement()) {
54026        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54027        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54028      }
54029      if (element.hasExperimentalElement()) {
54030        composeBooleanCore("experimental", element.getExperimentalElement(), false);
54031        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54032      }
54033      if (element.hasDateElement()) {
54034        composeDateTimeCore("date", element.getDateElement(), false);
54035        composeDateTimeExtras("date", element.getDateElement(), false);
54036      }
54037      if (element.hasPublisherElement()) {
54038        composeStringCore("publisher", element.getPublisherElement(), false);
54039        composeStringExtras("publisher", element.getPublisherElement(), false);
54040      }
54041      if (element.hasContact()) {
54042        openArray("contact");
54043        for (ContactDetail e : element.getContact()) 
54044          composeContactDetail(null, e);
54045        closeArray();
54046      };
54047      if (element.hasDescriptionElement()) {
54048        composeMarkdownCore("description", element.getDescriptionElement(), false);
54049        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54050      }
54051      if (element.hasUseContext()) {
54052        openArray("useContext");
54053        for (UsageContext e : element.getUseContext()) 
54054          composeUsageContext(null, e);
54055        closeArray();
54056      };
54057      if (element.hasJurisdiction()) {
54058        openArray("jurisdiction");
54059        for (CodeableConcept e : element.getJurisdiction()) 
54060          composeCodeableConcept(null, e);
54061        closeArray();
54062      };
54063      if (element.hasPurposeElement()) {
54064        composeMarkdownCore("purpose", element.getPurposeElement(), false);
54065        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
54066      }
54067      if (element.hasCopyrightElement()) {
54068        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
54069        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
54070      }
54071      if (element.hasOrigin()) {
54072        openArray("origin");
54073        for (TestScript.TestScriptOriginComponent e : element.getOrigin()) 
54074          composeTestScriptTestScriptOriginComponent(null, e);
54075        closeArray();
54076      };
54077      if (element.hasDestination()) {
54078        openArray("destination");
54079        for (TestScript.TestScriptDestinationComponent e : element.getDestination()) 
54080          composeTestScriptTestScriptDestinationComponent(null, e);
54081        closeArray();
54082      };
54083      if (element.hasMetadata()) {
54084        composeTestScriptTestScriptMetadataComponent("metadata", element.getMetadata());
54085      }
54086      if (element.hasFixture()) {
54087        openArray("fixture");
54088        for (TestScript.TestScriptFixtureComponent e : element.getFixture()) 
54089          composeTestScriptTestScriptFixtureComponent(null, e);
54090        closeArray();
54091      };
54092      if (element.hasProfile()) {
54093        openArray("profile");
54094        for (Reference e : element.getProfile()) 
54095          composeReference(null, e);
54096        closeArray();
54097      };
54098      if (element.hasVariable()) {
54099        openArray("variable");
54100        for (TestScript.TestScriptVariableComponent e : element.getVariable()) 
54101          composeTestScriptTestScriptVariableComponent(null, e);
54102        closeArray();
54103      };
54104      if (element.hasRule()) {
54105        openArray("rule");
54106        for (TestScript.TestScriptRuleComponent e : element.getRule()) 
54107          composeTestScriptTestScriptRuleComponent(null, e);
54108        closeArray();
54109      };
54110      if (element.hasRuleset()) {
54111        openArray("ruleset");
54112        for (TestScript.TestScriptRulesetComponent e : element.getRuleset()) 
54113          composeTestScriptTestScriptRulesetComponent(null, e);
54114        closeArray();
54115      };
54116      if (element.hasSetup()) {
54117        composeTestScriptTestScriptSetupComponent("setup", element.getSetup());
54118      }
54119      if (element.hasTest()) {
54120        openArray("test");
54121        for (TestScript.TestScriptTestComponent e : element.getTest()) 
54122          composeTestScriptTestScriptTestComponent(null, e);
54123        closeArray();
54124      };
54125      if (element.hasTeardown()) {
54126        composeTestScriptTestScriptTeardownComponent("teardown", element.getTeardown());
54127      }
54128  }
54129
54130  protected void composeTestScriptTestScriptOriginComponent(String name, TestScript.TestScriptOriginComponent element) throws IOException {
54131    if (element != null) {
54132      open(name);
54133      composeTestScriptTestScriptOriginComponentInner(element);
54134      close();
54135    }
54136  }
54137
54138  protected void composeTestScriptTestScriptOriginComponentInner(TestScript.TestScriptOriginComponent element) throws IOException {
54139      composeBackbone(element);
54140      if (element.hasIndexElement()) {
54141        composeIntegerCore("index", element.getIndexElement(), false);
54142        composeIntegerExtras("index", element.getIndexElement(), false);
54143      }
54144      if (element.hasProfile()) {
54145        composeCoding("profile", element.getProfile());
54146      }
54147  }
54148
54149  protected void composeTestScriptTestScriptDestinationComponent(String name, TestScript.TestScriptDestinationComponent element) throws IOException {
54150    if (element != null) {
54151      open(name);
54152      composeTestScriptTestScriptDestinationComponentInner(element);
54153      close();
54154    }
54155  }
54156
54157  protected void composeTestScriptTestScriptDestinationComponentInner(TestScript.TestScriptDestinationComponent element) throws IOException {
54158      composeBackbone(element);
54159      if (element.hasIndexElement()) {
54160        composeIntegerCore("index", element.getIndexElement(), false);
54161        composeIntegerExtras("index", element.getIndexElement(), false);
54162      }
54163      if (element.hasProfile()) {
54164        composeCoding("profile", element.getProfile());
54165      }
54166  }
54167
54168  protected void composeTestScriptTestScriptMetadataComponent(String name, TestScript.TestScriptMetadataComponent element) throws IOException {
54169    if (element != null) {
54170      open(name);
54171      composeTestScriptTestScriptMetadataComponentInner(element);
54172      close();
54173    }
54174  }
54175
54176  protected void composeTestScriptTestScriptMetadataComponentInner(TestScript.TestScriptMetadataComponent element) throws IOException {
54177      composeBackbone(element);
54178      if (element.hasLink()) {
54179        openArray("link");
54180        for (TestScript.TestScriptMetadataLinkComponent e : element.getLink()) 
54181          composeTestScriptTestScriptMetadataLinkComponent(null, e);
54182        closeArray();
54183      };
54184      if (element.hasCapability()) {
54185        openArray("capability");
54186        for (TestScript.TestScriptMetadataCapabilityComponent e : element.getCapability()) 
54187          composeTestScriptTestScriptMetadataCapabilityComponent(null, e);
54188        closeArray();
54189      };
54190  }
54191
54192  protected void composeTestScriptTestScriptMetadataLinkComponent(String name, TestScript.TestScriptMetadataLinkComponent element) throws IOException {
54193    if (element != null) {
54194      open(name);
54195      composeTestScriptTestScriptMetadataLinkComponentInner(element);
54196      close();
54197    }
54198  }
54199
54200  protected void composeTestScriptTestScriptMetadataLinkComponentInner(TestScript.TestScriptMetadataLinkComponent element) throws IOException {
54201      composeBackbone(element);
54202      if (element.hasUrlElement()) {
54203        composeUriCore("url", element.getUrlElement(), false);
54204        composeUriExtras("url", element.getUrlElement(), false);
54205      }
54206      if (element.hasDescriptionElement()) {
54207        composeStringCore("description", element.getDescriptionElement(), false);
54208        composeStringExtras("description", element.getDescriptionElement(), false);
54209      }
54210  }
54211
54212  protected void composeTestScriptTestScriptMetadataCapabilityComponent(String name, TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
54213    if (element != null) {
54214      open(name);
54215      composeTestScriptTestScriptMetadataCapabilityComponentInner(element);
54216      close();
54217    }
54218  }
54219
54220  protected void composeTestScriptTestScriptMetadataCapabilityComponentInner(TestScript.TestScriptMetadataCapabilityComponent element) throws IOException {
54221      composeBackbone(element);
54222      if (element.hasRequiredElement()) {
54223        composeBooleanCore("required", element.getRequiredElement(), false);
54224        composeBooleanExtras("required", element.getRequiredElement(), false);
54225      }
54226      if (element.hasValidatedElement()) {
54227        composeBooleanCore("validated", element.getValidatedElement(), false);
54228        composeBooleanExtras("validated", element.getValidatedElement(), false);
54229      }
54230      if (element.hasDescriptionElement()) {
54231        composeStringCore("description", element.getDescriptionElement(), false);
54232        composeStringExtras("description", element.getDescriptionElement(), false);
54233      }
54234      if (element.hasOrigin()) {
54235        openArray("origin");
54236        for (IntegerType e : element.getOrigin()) 
54237          composeIntegerCore(null, e, true);
54238        closeArray();
54239        if (anyHasExtras(element.getOrigin())) {
54240          openArray("_origin");
54241          for (IntegerType e : element.getOrigin()) 
54242            composeIntegerExtras(null, e, true);
54243          closeArray();
54244        }
54245      };
54246      if (element.hasDestinationElement()) {
54247        composeIntegerCore("destination", element.getDestinationElement(), false);
54248        composeIntegerExtras("destination", element.getDestinationElement(), false);
54249      }
54250      if (element.hasLink()) {
54251        openArray("link");
54252        for (UriType e : element.getLink()) 
54253          composeUriCore(null, e, true);
54254        closeArray();
54255        if (anyHasExtras(element.getLink())) {
54256          openArray("_link");
54257          for (UriType e : element.getLink()) 
54258            composeUriExtras(null, e, true);
54259          closeArray();
54260        }
54261      };
54262      if (element.hasCapabilitiesElement()) {
54263        composeCanonicalCore("capabilities", element.getCapabilitiesElement(), false);
54264        composeCanonicalExtras("capabilities", element.getCapabilitiesElement(), false);
54265      }
54266  }
54267
54268  protected void composeTestScriptTestScriptFixtureComponent(String name, TestScript.TestScriptFixtureComponent element) throws IOException {
54269    if (element != null) {
54270      open(name);
54271      composeTestScriptTestScriptFixtureComponentInner(element);
54272      close();
54273    }
54274  }
54275
54276  protected void composeTestScriptTestScriptFixtureComponentInner(TestScript.TestScriptFixtureComponent element) throws IOException {
54277      composeBackbone(element);
54278      if (element.hasAutocreateElement()) {
54279        composeBooleanCore("autocreate", element.getAutocreateElement(), false);
54280        composeBooleanExtras("autocreate", element.getAutocreateElement(), false);
54281      }
54282      if (element.hasAutodeleteElement()) {
54283        composeBooleanCore("autodelete", element.getAutodeleteElement(), false);
54284        composeBooleanExtras("autodelete", element.getAutodeleteElement(), false);
54285      }
54286      if (element.hasResource()) {
54287        composeReference("resource", element.getResource());
54288      }
54289  }
54290
54291  protected void composeTestScriptTestScriptVariableComponent(String name, TestScript.TestScriptVariableComponent element) throws IOException {
54292    if (element != null) {
54293      open(name);
54294      composeTestScriptTestScriptVariableComponentInner(element);
54295      close();
54296    }
54297  }
54298
54299  protected void composeTestScriptTestScriptVariableComponentInner(TestScript.TestScriptVariableComponent element) throws IOException {
54300      composeBackbone(element);
54301      if (element.hasNameElement()) {
54302        composeStringCore("name", element.getNameElement(), false);
54303        composeStringExtras("name", element.getNameElement(), false);
54304      }
54305      if (element.hasDefaultValueElement()) {
54306        composeStringCore("defaultValue", element.getDefaultValueElement(), false);
54307        composeStringExtras("defaultValue", element.getDefaultValueElement(), false);
54308      }
54309      if (element.hasDescriptionElement()) {
54310        composeStringCore("description", element.getDescriptionElement(), false);
54311        composeStringExtras("description", element.getDescriptionElement(), false);
54312      }
54313      if (element.hasExpressionElement()) {
54314        composeStringCore("expression", element.getExpressionElement(), false);
54315        composeStringExtras("expression", element.getExpressionElement(), false);
54316      }
54317      if (element.hasHeaderFieldElement()) {
54318        composeStringCore("headerField", element.getHeaderFieldElement(), false);
54319        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
54320      }
54321      if (element.hasHintElement()) {
54322        composeStringCore("hint", element.getHintElement(), false);
54323        composeStringExtras("hint", element.getHintElement(), false);
54324      }
54325      if (element.hasPathElement()) {
54326        composeStringCore("path", element.getPathElement(), false);
54327        composeStringExtras("path", element.getPathElement(), false);
54328      }
54329      if (element.hasSourceIdElement()) {
54330        composeIdCore("sourceId", element.getSourceIdElement(), false);
54331        composeIdExtras("sourceId", element.getSourceIdElement(), false);
54332      }
54333  }
54334
54335  protected void composeTestScriptTestScriptRuleComponent(String name, TestScript.TestScriptRuleComponent element) throws IOException {
54336    if (element != null) {
54337      open(name);
54338      composeTestScriptTestScriptRuleComponentInner(element);
54339      close();
54340    }
54341  }
54342
54343  protected void composeTestScriptTestScriptRuleComponentInner(TestScript.TestScriptRuleComponent element) throws IOException {
54344      composeBackbone(element);
54345      if (element.hasResource()) {
54346        composeReference("resource", element.getResource());
54347      }
54348      if (element.hasParam()) {
54349        openArray("param");
54350        for (TestScript.RuleParamComponent e : element.getParam()) 
54351          composeTestScriptRuleParamComponent(null, e);
54352        closeArray();
54353      };
54354  }
54355
54356  protected void composeTestScriptRuleParamComponent(String name, TestScript.RuleParamComponent element) throws IOException {
54357    if (element != null) {
54358      open(name);
54359      composeTestScriptRuleParamComponentInner(element);
54360      close();
54361    }
54362  }
54363
54364  protected void composeTestScriptRuleParamComponentInner(TestScript.RuleParamComponent element) throws IOException {
54365      composeBackbone(element);
54366      if (element.hasNameElement()) {
54367        composeStringCore("name", element.getNameElement(), false);
54368        composeStringExtras("name", element.getNameElement(), false);
54369      }
54370      if (element.hasValueElement()) {
54371        composeStringCore("value", element.getValueElement(), false);
54372        composeStringExtras("value", element.getValueElement(), false);
54373      }
54374  }
54375
54376  protected void composeTestScriptTestScriptRulesetComponent(String name, TestScript.TestScriptRulesetComponent element) throws IOException {
54377    if (element != null) {
54378      open(name);
54379      composeTestScriptTestScriptRulesetComponentInner(element);
54380      close();
54381    }
54382  }
54383
54384  protected void composeTestScriptTestScriptRulesetComponentInner(TestScript.TestScriptRulesetComponent element) throws IOException {
54385      composeBackbone(element);
54386      if (element.hasResource()) {
54387        composeReference("resource", element.getResource());
54388      }
54389      if (element.hasRule()) {
54390        openArray("rule");
54391        for (TestScript.RulesetRuleComponent e : element.getRule()) 
54392          composeTestScriptRulesetRuleComponent(null, e);
54393        closeArray();
54394      };
54395  }
54396
54397  protected void composeTestScriptRulesetRuleComponent(String name, TestScript.RulesetRuleComponent element) throws IOException {
54398    if (element != null) {
54399      open(name);
54400      composeTestScriptRulesetRuleComponentInner(element);
54401      close();
54402    }
54403  }
54404
54405  protected void composeTestScriptRulesetRuleComponentInner(TestScript.RulesetRuleComponent element) throws IOException {
54406      composeBackbone(element);
54407      if (element.hasRuleIdElement()) {
54408        composeIdCore("ruleId", element.getRuleIdElement(), false);
54409        composeIdExtras("ruleId", element.getRuleIdElement(), false);
54410      }
54411      if (element.hasParam()) {
54412        openArray("param");
54413        for (TestScript.RulesetRuleParamComponent e : element.getParam()) 
54414          composeTestScriptRulesetRuleParamComponent(null, e);
54415        closeArray();
54416      };
54417  }
54418
54419  protected void composeTestScriptRulesetRuleParamComponent(String name, TestScript.RulesetRuleParamComponent element) throws IOException {
54420    if (element != null) {
54421      open(name);
54422      composeTestScriptRulesetRuleParamComponentInner(element);
54423      close();
54424    }
54425  }
54426
54427  protected void composeTestScriptRulesetRuleParamComponentInner(TestScript.RulesetRuleParamComponent element) throws IOException {
54428      composeBackbone(element);
54429      if (element.hasNameElement()) {
54430        composeStringCore("name", element.getNameElement(), false);
54431        composeStringExtras("name", element.getNameElement(), false);
54432      }
54433      if (element.hasValueElement()) {
54434        composeStringCore("value", element.getValueElement(), false);
54435        composeStringExtras("value", element.getValueElement(), false);
54436      }
54437  }
54438
54439  protected void composeTestScriptTestScriptSetupComponent(String name, TestScript.TestScriptSetupComponent element) throws IOException {
54440    if (element != null) {
54441      open(name);
54442      composeTestScriptTestScriptSetupComponentInner(element);
54443      close();
54444    }
54445  }
54446
54447  protected void composeTestScriptTestScriptSetupComponentInner(TestScript.TestScriptSetupComponent element) throws IOException {
54448      composeBackbone(element);
54449      if (element.hasAction()) {
54450        openArray("action");
54451        for (TestScript.SetupActionComponent e : element.getAction()) 
54452          composeTestScriptSetupActionComponent(null, e);
54453        closeArray();
54454      };
54455  }
54456
54457  protected void composeTestScriptSetupActionComponent(String name, TestScript.SetupActionComponent element) throws IOException {
54458    if (element != null) {
54459      open(name);
54460      composeTestScriptSetupActionComponentInner(element);
54461      close();
54462    }
54463  }
54464
54465  protected void composeTestScriptSetupActionComponentInner(TestScript.SetupActionComponent element) throws IOException {
54466      composeBackbone(element);
54467      if (element.hasOperation()) {
54468        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
54469      }
54470      if (element.hasAssert()) {
54471        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
54472      }
54473  }
54474
54475  protected void composeTestScriptSetupActionOperationComponent(String name, TestScript.SetupActionOperationComponent element) throws IOException {
54476    if (element != null) {
54477      open(name);
54478      composeTestScriptSetupActionOperationComponentInner(element);
54479      close();
54480    }
54481  }
54482
54483  protected void composeTestScriptSetupActionOperationComponentInner(TestScript.SetupActionOperationComponent element) throws IOException {
54484      composeBackbone(element);
54485      if (element.hasType()) {
54486        composeCoding("type", element.getType());
54487      }
54488      if (element.hasResourceElement()) {
54489        composeCodeCore("resource", element.getResourceElement(), false);
54490        composeCodeExtras("resource", element.getResourceElement(), false);
54491      }
54492      if (element.hasLabelElement()) {
54493        composeStringCore("label", element.getLabelElement(), false);
54494        composeStringExtras("label", element.getLabelElement(), false);
54495      }
54496      if (element.hasDescriptionElement()) {
54497        composeStringCore("description", element.getDescriptionElement(), false);
54498        composeStringExtras("description", element.getDescriptionElement(), false);
54499      }
54500      if (element.hasAcceptElement()) {
54501        composeCodeCore("accept", element.getAcceptElement(), false);
54502        composeCodeExtras("accept", element.getAcceptElement(), false);
54503      }
54504      if (element.hasContentTypeElement()) {
54505        composeCodeCore("contentType", element.getContentTypeElement(), false);
54506        composeCodeExtras("contentType", element.getContentTypeElement(), false);
54507      }
54508      if (element.hasDestinationElement()) {
54509        composeIntegerCore("destination", element.getDestinationElement(), false);
54510        composeIntegerExtras("destination", element.getDestinationElement(), false);
54511      }
54512      if (element.hasEncodeRequestUrlElement()) {
54513        composeBooleanCore("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
54514        composeBooleanExtras("encodeRequestUrl", element.getEncodeRequestUrlElement(), false);
54515      }
54516      if (element.hasOriginElement()) {
54517        composeIntegerCore("origin", element.getOriginElement(), false);
54518        composeIntegerExtras("origin", element.getOriginElement(), false);
54519      }
54520      if (element.hasParamsElement()) {
54521        composeStringCore("params", element.getParamsElement(), false);
54522        composeStringExtras("params", element.getParamsElement(), false);
54523      }
54524      if (element.hasRequestHeader()) {
54525        openArray("requestHeader");
54526        for (TestScript.SetupActionOperationRequestHeaderComponent e : element.getRequestHeader()) 
54527          composeTestScriptSetupActionOperationRequestHeaderComponent(null, e);
54528        closeArray();
54529      };
54530      if (element.hasRequestIdElement()) {
54531        composeIdCore("requestId", element.getRequestIdElement(), false);
54532        composeIdExtras("requestId", element.getRequestIdElement(), false);
54533      }
54534      if (element.hasResponseIdElement()) {
54535        composeIdCore("responseId", element.getResponseIdElement(), false);
54536        composeIdExtras("responseId", element.getResponseIdElement(), false);
54537      }
54538      if (element.hasSourceIdElement()) {
54539        composeIdCore("sourceId", element.getSourceIdElement(), false);
54540        composeIdExtras("sourceId", element.getSourceIdElement(), false);
54541      }
54542      if (element.hasTargetIdElement()) {
54543        composeIdCore("targetId", element.getTargetIdElement(), false);
54544        composeIdExtras("targetId", element.getTargetIdElement(), false);
54545      }
54546      if (element.hasUrlElement()) {
54547        composeStringCore("url", element.getUrlElement(), false);
54548        composeStringExtras("url", element.getUrlElement(), false);
54549      }
54550  }
54551
54552  protected void composeTestScriptSetupActionOperationRequestHeaderComponent(String name, TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
54553    if (element != null) {
54554      open(name);
54555      composeTestScriptSetupActionOperationRequestHeaderComponentInner(element);
54556      close();
54557    }
54558  }
54559
54560  protected void composeTestScriptSetupActionOperationRequestHeaderComponentInner(TestScript.SetupActionOperationRequestHeaderComponent element) throws IOException {
54561      composeBackbone(element);
54562      if (element.hasFieldElement()) {
54563        composeStringCore("field", element.getFieldElement(), false);
54564        composeStringExtras("field", element.getFieldElement(), false);
54565      }
54566      if (element.hasValueElement()) {
54567        composeStringCore("value", element.getValueElement(), false);
54568        composeStringExtras("value", element.getValueElement(), false);
54569      }
54570  }
54571
54572  protected void composeTestScriptSetupActionAssertComponent(String name, TestScript.SetupActionAssertComponent element) throws IOException {
54573    if (element != null) {
54574      open(name);
54575      composeTestScriptSetupActionAssertComponentInner(element);
54576      close();
54577    }
54578  }
54579
54580  protected void composeTestScriptSetupActionAssertComponentInner(TestScript.SetupActionAssertComponent element) throws IOException {
54581      composeBackbone(element);
54582      if (element.hasLabelElement()) {
54583        composeStringCore("label", element.getLabelElement(), false);
54584        composeStringExtras("label", element.getLabelElement(), false);
54585      }
54586      if (element.hasDescriptionElement()) {
54587        composeStringCore("description", element.getDescriptionElement(), false);
54588        composeStringExtras("description", element.getDescriptionElement(), false);
54589      }
54590      if (element.hasDirectionElement()) {
54591        composeEnumerationCore("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
54592        composeEnumerationExtras("direction", element.getDirectionElement(), new TestScript.AssertionDirectionTypeEnumFactory(), false);
54593      }
54594      if (element.hasCompareToSourceIdElement()) {
54595        composeStringCore("compareToSourceId", element.getCompareToSourceIdElement(), false);
54596        composeStringExtras("compareToSourceId", element.getCompareToSourceIdElement(), false);
54597      }
54598      if (element.hasCompareToSourceExpressionElement()) {
54599        composeStringCore("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
54600        composeStringExtras("compareToSourceExpression", element.getCompareToSourceExpressionElement(), false);
54601      }
54602      if (element.hasCompareToSourcePathElement()) {
54603        composeStringCore("compareToSourcePath", element.getCompareToSourcePathElement(), false);
54604        composeStringExtras("compareToSourcePath", element.getCompareToSourcePathElement(), false);
54605      }
54606      if (element.hasContentTypeElement()) {
54607        composeCodeCore("contentType", element.getContentTypeElement(), false);
54608        composeCodeExtras("contentType", element.getContentTypeElement(), false);
54609      }
54610      if (element.hasExpressionElement()) {
54611        composeStringCore("expression", element.getExpressionElement(), false);
54612        composeStringExtras("expression", element.getExpressionElement(), false);
54613      }
54614      if (element.hasHeaderFieldElement()) {
54615        composeStringCore("headerField", element.getHeaderFieldElement(), false);
54616        composeStringExtras("headerField", element.getHeaderFieldElement(), false);
54617      }
54618      if (element.hasMinimumIdElement()) {
54619        composeStringCore("minimumId", element.getMinimumIdElement(), false);
54620        composeStringExtras("minimumId", element.getMinimumIdElement(), false);
54621      }
54622      if (element.hasNavigationLinksElement()) {
54623        composeBooleanCore("navigationLinks", element.getNavigationLinksElement(), false);
54624        composeBooleanExtras("navigationLinks", element.getNavigationLinksElement(), false);
54625      }
54626      if (element.hasOperatorElement()) {
54627        composeEnumerationCore("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
54628        composeEnumerationExtras("operator", element.getOperatorElement(), new TestScript.AssertionOperatorTypeEnumFactory(), false);
54629      }
54630      if (element.hasPathElement()) {
54631        composeStringCore("path", element.getPathElement(), false);
54632        composeStringExtras("path", element.getPathElement(), false);
54633      }
54634      if (element.hasRequestMethodElement()) {
54635        composeEnumerationCore("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
54636        composeEnumerationExtras("requestMethod", element.getRequestMethodElement(), new TestScript.TestScriptRequestMethodCodeEnumFactory(), false);
54637      }
54638      if (element.hasRequestURLElement()) {
54639        composeStringCore("requestURL", element.getRequestURLElement(), false);
54640        composeStringExtras("requestURL", element.getRequestURLElement(), false);
54641      }
54642      if (element.hasResourceElement()) {
54643        composeCodeCore("resource", element.getResourceElement(), false);
54644        composeCodeExtras("resource", element.getResourceElement(), false);
54645      }
54646      if (element.hasResponseElement()) {
54647        composeEnumerationCore("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
54648        composeEnumerationExtras("response", element.getResponseElement(), new TestScript.AssertionResponseTypesEnumFactory(), false);
54649      }
54650      if (element.hasResponseCodeElement()) {
54651        composeStringCore("responseCode", element.getResponseCodeElement(), false);
54652        composeStringExtras("responseCode", element.getResponseCodeElement(), false);
54653      }
54654      if (element.hasRule()) {
54655        composeTestScriptActionAssertRuleComponent("rule", element.getRule());
54656      }
54657      if (element.hasRuleset()) {
54658        composeTestScriptActionAssertRulesetComponent("ruleset", element.getRuleset());
54659      }
54660      if (element.hasSourceIdElement()) {
54661        composeIdCore("sourceId", element.getSourceIdElement(), false);
54662        composeIdExtras("sourceId", element.getSourceIdElement(), false);
54663      }
54664      if (element.hasValidateProfileIdElement()) {
54665        composeIdCore("validateProfileId", element.getValidateProfileIdElement(), false);
54666        composeIdExtras("validateProfileId", element.getValidateProfileIdElement(), false);
54667      }
54668      if (element.hasValueElement()) {
54669        composeStringCore("value", element.getValueElement(), false);
54670        composeStringExtras("value", element.getValueElement(), false);
54671      }
54672      if (element.hasWarningOnlyElement()) {
54673        composeBooleanCore("warningOnly", element.getWarningOnlyElement(), false);
54674        composeBooleanExtras("warningOnly", element.getWarningOnlyElement(), false);
54675      }
54676  }
54677
54678  protected void composeTestScriptActionAssertRuleComponent(String name, TestScript.ActionAssertRuleComponent element) throws IOException {
54679    if (element != null) {
54680      open(name);
54681      composeTestScriptActionAssertRuleComponentInner(element);
54682      close();
54683    }
54684  }
54685
54686  protected void composeTestScriptActionAssertRuleComponentInner(TestScript.ActionAssertRuleComponent element) throws IOException {
54687      composeBackbone(element);
54688      if (element.hasRuleIdElement()) {
54689        composeIdCore("ruleId", element.getRuleIdElement(), false);
54690        composeIdExtras("ruleId", element.getRuleIdElement(), false);
54691      }
54692      if (element.hasParam()) {
54693        openArray("param");
54694        for (TestScript.ActionAssertRuleParamComponent e : element.getParam()) 
54695          composeTestScriptActionAssertRuleParamComponent(null, e);
54696        closeArray();
54697      };
54698  }
54699
54700  protected void composeTestScriptActionAssertRuleParamComponent(String name, TestScript.ActionAssertRuleParamComponent element) throws IOException {
54701    if (element != null) {
54702      open(name);
54703      composeTestScriptActionAssertRuleParamComponentInner(element);
54704      close();
54705    }
54706  }
54707
54708  protected void composeTestScriptActionAssertRuleParamComponentInner(TestScript.ActionAssertRuleParamComponent element) throws IOException {
54709      composeBackbone(element);
54710      if (element.hasNameElement()) {
54711        composeStringCore("name", element.getNameElement(), false);
54712        composeStringExtras("name", element.getNameElement(), false);
54713      }
54714      if (element.hasValueElement()) {
54715        composeStringCore("value", element.getValueElement(), false);
54716        composeStringExtras("value", element.getValueElement(), false);
54717      }
54718  }
54719
54720  protected void composeTestScriptActionAssertRulesetComponent(String name, TestScript.ActionAssertRulesetComponent element) throws IOException {
54721    if (element != null) {
54722      open(name);
54723      composeTestScriptActionAssertRulesetComponentInner(element);
54724      close();
54725    }
54726  }
54727
54728  protected void composeTestScriptActionAssertRulesetComponentInner(TestScript.ActionAssertRulesetComponent element) throws IOException {
54729      composeBackbone(element);
54730      if (element.hasRulesetIdElement()) {
54731        composeIdCore("rulesetId", element.getRulesetIdElement(), false);
54732        composeIdExtras("rulesetId", element.getRulesetIdElement(), false);
54733      }
54734      if (element.hasRule()) {
54735        openArray("rule");
54736        for (TestScript.ActionAssertRulesetRuleComponent e : element.getRule()) 
54737          composeTestScriptActionAssertRulesetRuleComponent(null, e);
54738        closeArray();
54739      };
54740  }
54741
54742  protected void composeTestScriptActionAssertRulesetRuleComponent(String name, TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
54743    if (element != null) {
54744      open(name);
54745      composeTestScriptActionAssertRulesetRuleComponentInner(element);
54746      close();
54747    }
54748  }
54749
54750  protected void composeTestScriptActionAssertRulesetRuleComponentInner(TestScript.ActionAssertRulesetRuleComponent element) throws IOException {
54751      composeBackbone(element);
54752      if (element.hasRuleIdElement()) {
54753        composeIdCore("ruleId", element.getRuleIdElement(), false);
54754        composeIdExtras("ruleId", element.getRuleIdElement(), false);
54755      }
54756      if (element.hasParam()) {
54757        openArray("param");
54758        for (TestScript.ActionAssertRulesetRuleParamComponent e : element.getParam()) 
54759          composeTestScriptActionAssertRulesetRuleParamComponent(null, e);
54760        closeArray();
54761      };
54762  }
54763
54764  protected void composeTestScriptActionAssertRulesetRuleParamComponent(String name, TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
54765    if (element != null) {
54766      open(name);
54767      composeTestScriptActionAssertRulesetRuleParamComponentInner(element);
54768      close();
54769    }
54770  }
54771
54772  protected void composeTestScriptActionAssertRulesetRuleParamComponentInner(TestScript.ActionAssertRulesetRuleParamComponent element) throws IOException {
54773      composeBackbone(element);
54774      if (element.hasNameElement()) {
54775        composeStringCore("name", element.getNameElement(), false);
54776        composeStringExtras("name", element.getNameElement(), false);
54777      }
54778      if (element.hasValueElement()) {
54779        composeStringCore("value", element.getValueElement(), false);
54780        composeStringExtras("value", element.getValueElement(), false);
54781      }
54782  }
54783
54784  protected void composeTestScriptTestScriptTestComponent(String name, TestScript.TestScriptTestComponent element) throws IOException {
54785    if (element != null) {
54786      open(name);
54787      composeTestScriptTestScriptTestComponentInner(element);
54788      close();
54789    }
54790  }
54791
54792  protected void composeTestScriptTestScriptTestComponentInner(TestScript.TestScriptTestComponent element) throws IOException {
54793      composeBackbone(element);
54794      if (element.hasNameElement()) {
54795        composeStringCore("name", element.getNameElement(), false);
54796        composeStringExtras("name", element.getNameElement(), false);
54797      }
54798      if (element.hasDescriptionElement()) {
54799        composeStringCore("description", element.getDescriptionElement(), false);
54800        composeStringExtras("description", element.getDescriptionElement(), false);
54801      }
54802      if (element.hasAction()) {
54803        openArray("action");
54804        for (TestScript.TestActionComponent e : element.getAction()) 
54805          composeTestScriptTestActionComponent(null, e);
54806        closeArray();
54807      };
54808  }
54809
54810  protected void composeTestScriptTestActionComponent(String name, TestScript.TestActionComponent element) throws IOException {
54811    if (element != null) {
54812      open(name);
54813      composeTestScriptTestActionComponentInner(element);
54814      close();
54815    }
54816  }
54817
54818  protected void composeTestScriptTestActionComponentInner(TestScript.TestActionComponent element) throws IOException {
54819      composeBackbone(element);
54820      if (element.hasOperation()) {
54821        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
54822      }
54823      if (element.hasAssert()) {
54824        composeTestScriptSetupActionAssertComponent("assert", element.getAssert());
54825      }
54826  }
54827
54828  protected void composeTestScriptTestScriptTeardownComponent(String name, TestScript.TestScriptTeardownComponent element) throws IOException {
54829    if (element != null) {
54830      open(name);
54831      composeTestScriptTestScriptTeardownComponentInner(element);
54832      close();
54833    }
54834  }
54835
54836  protected void composeTestScriptTestScriptTeardownComponentInner(TestScript.TestScriptTeardownComponent element) throws IOException {
54837      composeBackbone(element);
54838      if (element.hasAction()) {
54839        openArray("action");
54840        for (TestScript.TeardownActionComponent e : element.getAction()) 
54841          composeTestScriptTeardownActionComponent(null, e);
54842        closeArray();
54843      };
54844  }
54845
54846  protected void composeTestScriptTeardownActionComponent(String name, TestScript.TeardownActionComponent element) throws IOException {
54847    if (element != null) {
54848      open(name);
54849      composeTestScriptTeardownActionComponentInner(element);
54850      close();
54851    }
54852  }
54853
54854  protected void composeTestScriptTeardownActionComponentInner(TestScript.TeardownActionComponent element) throws IOException {
54855      composeBackbone(element);
54856      if (element.hasOperation()) {
54857        composeTestScriptSetupActionOperationComponent("operation", element.getOperation());
54858      }
54859  }
54860
54861  protected void composeUserSession(String name, UserSession element) throws IOException {
54862    if (element != null) {
54863      prop("resourceType", name);
54864      composeUserSessionInner(element);
54865    }
54866  }
54867
54868  protected void composeUserSessionInner(UserSession element) throws IOException {
54869      composeDomainResourceElements(element);
54870      if (element.hasIdentifier()) {
54871        composeIdentifier("identifier", element.getIdentifier());
54872      }
54873      if (element.hasUser()) {
54874        composeReference("user", element.getUser());
54875      }
54876      if (element.hasStatus()) {
54877        composeUserSessionUserSessionStatusComponent("status", element.getStatus());
54878      }
54879      if (element.hasWorkstation()) {
54880        composeIdentifier("workstation", element.getWorkstation());
54881      }
54882      if (element.hasFocus()) {
54883        openArray("focus");
54884        for (Reference e : element.getFocus()) 
54885          composeReference(null, e);
54886        closeArray();
54887      };
54888      if (element.hasCreatedElement()) {
54889        composeInstantCore("created", element.getCreatedElement(), false);
54890        composeInstantExtras("created", element.getCreatedElement(), false);
54891      }
54892      if (element.hasExpiresElement()) {
54893        composeInstantCore("expires", element.getExpiresElement(), false);
54894        composeInstantExtras("expires", element.getExpiresElement(), false);
54895      }
54896      if (element.hasContext()) {
54897        openArray("context");
54898        for (UserSession.UserSessionContextComponent e : element.getContext()) 
54899          composeUserSessionUserSessionContextComponent(null, e);
54900        closeArray();
54901      };
54902  }
54903
54904  protected void composeUserSessionUserSessionStatusComponent(String name, UserSession.UserSessionStatusComponent element) throws IOException {
54905    if (element != null) {
54906      open(name);
54907      composeUserSessionUserSessionStatusComponentInner(element);
54908      close();
54909    }
54910  }
54911
54912  protected void composeUserSessionUserSessionStatusComponentInner(UserSession.UserSessionStatusComponent element) throws IOException {
54913      composeBackbone(element);
54914      if (element.hasCodeElement()) {
54915        composeEnumerationCore("code", element.getCodeElement(), new UserSession.UserSessionStatusEnumFactory(), false);
54916        composeEnumerationExtras("code", element.getCodeElement(), new UserSession.UserSessionStatusEnumFactory(), false);
54917      }
54918      if (element.hasSourceElement()) {
54919        composeEnumerationCore("source", element.getSourceElement(), new UserSession.UserSessionStatusSourceEnumFactory(), false);
54920        composeEnumerationExtras("source", element.getSourceElement(), new UserSession.UserSessionStatusSourceEnumFactory(), false);
54921      }
54922  }
54923
54924  protected void composeUserSessionUserSessionContextComponent(String name, UserSession.UserSessionContextComponent element) throws IOException {
54925    if (element != null) {
54926      open(name);
54927      composeUserSessionUserSessionContextComponentInner(element);
54928      close();
54929    }
54930  }
54931
54932  protected void composeUserSessionUserSessionContextComponentInner(UserSession.UserSessionContextComponent element) throws IOException {
54933      composeBackbone(element);
54934      if (element.hasTypeElement()) {
54935        composeStringCore("type", element.getTypeElement(), false);
54936        composeStringExtras("type", element.getTypeElement(), false);
54937      }
54938      if (element.hasValue()) {
54939        composeType("value", element.getValue());
54940      }
54941  }
54942
54943  protected void composeValueSet(String name, ValueSet element) throws IOException {
54944    if (element != null) {
54945      prop("resourceType", name);
54946      composeValueSetInner(element);
54947    }
54948  }
54949
54950  protected void composeValueSetInner(ValueSet element) throws IOException {
54951      composeDomainResourceElements(element);
54952      if (element.hasUrlElement()) {
54953        composeUriCore("url", element.getUrlElement(), false);
54954        composeUriExtras("url", element.getUrlElement(), false);
54955      }
54956      if (element.hasIdentifier()) {
54957        openArray("identifier");
54958        for (Identifier e : element.getIdentifier()) 
54959          composeIdentifier(null, e);
54960        closeArray();
54961      };
54962      if (element.hasVersionElement()) {
54963        composeStringCore("version", element.getVersionElement(), false);
54964        composeStringExtras("version", element.getVersionElement(), false);
54965      }
54966      if (element.hasNameElement()) {
54967        composeStringCore("name", element.getNameElement(), false);
54968        composeStringExtras("name", element.getNameElement(), false);
54969      }
54970      if (element.hasTitleElement()) {
54971        composeStringCore("title", element.getTitleElement(), false);
54972        composeStringExtras("title", element.getTitleElement(), false);
54973      }
54974      if (element.hasStatusElement()) {
54975        composeEnumerationCore("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54976        composeEnumerationExtras("status", element.getStatusElement(), new Enumerations.PublicationStatusEnumFactory(), false);
54977      }
54978      if (element.hasExperimentalElement()) {
54979        composeBooleanCore("experimental", element.getExperimentalElement(), false);
54980        composeBooleanExtras("experimental", element.getExperimentalElement(), false);
54981      }
54982      if (element.hasDateElement()) {
54983        composeDateTimeCore("date", element.getDateElement(), false);
54984        composeDateTimeExtras("date", element.getDateElement(), false);
54985      }
54986      if (element.hasPublisherElement()) {
54987        composeStringCore("publisher", element.getPublisherElement(), false);
54988        composeStringExtras("publisher", element.getPublisherElement(), false);
54989      }
54990      if (element.hasContact()) {
54991        openArray("contact");
54992        for (ContactDetail e : element.getContact()) 
54993          composeContactDetail(null, e);
54994        closeArray();
54995      };
54996      if (element.hasDescriptionElement()) {
54997        composeMarkdownCore("description", element.getDescriptionElement(), false);
54998        composeMarkdownExtras("description", element.getDescriptionElement(), false);
54999      }
55000      if (element.hasUseContext()) {
55001        openArray("useContext");
55002        for (UsageContext e : element.getUseContext()) 
55003          composeUsageContext(null, e);
55004        closeArray();
55005      };
55006      if (element.hasJurisdiction()) {
55007        openArray("jurisdiction");
55008        for (CodeableConcept e : element.getJurisdiction()) 
55009          composeCodeableConcept(null, e);
55010        closeArray();
55011      };
55012      if (element.hasImmutableElement()) {
55013        composeBooleanCore("immutable", element.getImmutableElement(), false);
55014        composeBooleanExtras("immutable", element.getImmutableElement(), false);
55015      }
55016      if (element.hasPurposeElement()) {
55017        composeMarkdownCore("purpose", element.getPurposeElement(), false);
55018        composeMarkdownExtras("purpose", element.getPurposeElement(), false);
55019      }
55020      if (element.hasCopyrightElement()) {
55021        composeMarkdownCore("copyright", element.getCopyrightElement(), false);
55022        composeMarkdownExtras("copyright", element.getCopyrightElement(), false);
55023      }
55024      if (element.hasCompose()) {
55025        composeValueSetValueSetComposeComponent("compose", element.getCompose());
55026      }
55027      if (element.hasExpansion()) {
55028        composeValueSetValueSetExpansionComponent("expansion", element.getExpansion());
55029      }
55030  }
55031
55032  protected void composeValueSetValueSetComposeComponent(String name, ValueSet.ValueSetComposeComponent element) throws IOException {
55033    if (element != null) {
55034      open(name);
55035      composeValueSetValueSetComposeComponentInner(element);
55036      close();
55037    }
55038  }
55039
55040  protected void composeValueSetValueSetComposeComponentInner(ValueSet.ValueSetComposeComponent element) throws IOException {
55041      composeBackbone(element);
55042      if (element.hasLockedDateElement()) {
55043        composeDateCore("lockedDate", element.getLockedDateElement(), false);
55044        composeDateExtras("lockedDate", element.getLockedDateElement(), false);
55045      }
55046      if (element.hasInactiveElement()) {
55047        composeBooleanCore("inactive", element.getInactiveElement(), false);
55048        composeBooleanExtras("inactive", element.getInactiveElement(), false);
55049      }
55050      if (element.hasInclude()) {
55051        openArray("include");
55052        for (ValueSet.ConceptSetComponent e : element.getInclude()) 
55053          composeValueSetConceptSetComponent(null, e);
55054        closeArray();
55055      };
55056      if (element.hasExclude()) {
55057        openArray("exclude");
55058        for (ValueSet.ConceptSetComponent e : element.getExclude()) 
55059          composeValueSetConceptSetComponent(null, e);
55060        closeArray();
55061      };
55062  }
55063
55064  protected void composeValueSetConceptSetComponent(String name, ValueSet.ConceptSetComponent element) throws IOException {
55065    if (element != null) {
55066      open(name);
55067      composeValueSetConceptSetComponentInner(element);
55068      close();
55069    }
55070  }
55071
55072  protected void composeValueSetConceptSetComponentInner(ValueSet.ConceptSetComponent element) throws IOException {
55073      composeBackbone(element);
55074      if (element.hasSystemElement()) {
55075        composeUriCore("system", element.getSystemElement(), false);
55076        composeUriExtras("system", element.getSystemElement(), false);
55077      }
55078      if (element.hasVersionElement()) {
55079        composeStringCore("version", element.getVersionElement(), false);
55080        composeStringExtras("version", element.getVersionElement(), false);
55081      }
55082      if (element.hasConcept()) {
55083        openArray("concept");
55084        for (ValueSet.ConceptReferenceComponent e : element.getConcept()) 
55085          composeValueSetConceptReferenceComponent(null, e);
55086        closeArray();
55087      };
55088      if (element.hasFilter()) {
55089        openArray("filter");
55090        for (ValueSet.ConceptSetFilterComponent e : element.getFilter()) 
55091          composeValueSetConceptSetFilterComponent(null, e);
55092        closeArray();
55093      };
55094      if (element.hasValueSet()) {
55095        openArray("valueSet");
55096        for (CanonicalType e : element.getValueSet()) 
55097          composeCanonicalCore(null, e, true);
55098        closeArray();
55099        if (anyHasExtras(element.getValueSet())) {
55100          openArray("_valueSet");
55101          for (CanonicalType e : element.getValueSet()) 
55102            composeCanonicalExtras(null, e, true);
55103          closeArray();
55104        }
55105      };
55106  }
55107
55108  protected void composeValueSetConceptReferenceComponent(String name, ValueSet.ConceptReferenceComponent element) throws IOException {
55109    if (element != null) {
55110      open(name);
55111      composeValueSetConceptReferenceComponentInner(element);
55112      close();
55113    }
55114  }
55115
55116  protected void composeValueSetConceptReferenceComponentInner(ValueSet.ConceptReferenceComponent element) throws IOException {
55117      composeBackbone(element);
55118      if (element.hasCodeElement()) {
55119        composeCodeCore("code", element.getCodeElement(), false);
55120        composeCodeExtras("code", element.getCodeElement(), false);
55121      }
55122      if (element.hasDisplayElement()) {
55123        composeStringCore("display", element.getDisplayElement(), false);
55124        composeStringExtras("display", element.getDisplayElement(), false);
55125      }
55126      if (element.hasDesignation()) {
55127        openArray("designation");
55128        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
55129          composeValueSetConceptReferenceDesignationComponent(null, e);
55130        closeArray();
55131      };
55132  }
55133
55134  protected void composeValueSetConceptReferenceDesignationComponent(String name, ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
55135    if (element != null) {
55136      open(name);
55137      composeValueSetConceptReferenceDesignationComponentInner(element);
55138      close();
55139    }
55140  }
55141
55142  protected void composeValueSetConceptReferenceDesignationComponentInner(ValueSet.ConceptReferenceDesignationComponent element) throws IOException {
55143      composeBackbone(element);
55144      if (element.hasLanguageElement()) {
55145        composeCodeCore("language", element.getLanguageElement(), false);
55146        composeCodeExtras("language", element.getLanguageElement(), false);
55147      }
55148      if (element.hasUse()) {
55149        composeCoding("use", element.getUse());
55150      }
55151      if (element.hasValueElement()) {
55152        composeStringCore("value", element.getValueElement(), false);
55153        composeStringExtras("value", element.getValueElement(), false);
55154      }
55155  }
55156
55157  protected void composeValueSetConceptSetFilterComponent(String name, ValueSet.ConceptSetFilterComponent element) throws IOException {
55158    if (element != null) {
55159      open(name);
55160      composeValueSetConceptSetFilterComponentInner(element);
55161      close();
55162    }
55163  }
55164
55165  protected void composeValueSetConceptSetFilterComponentInner(ValueSet.ConceptSetFilterComponent element) throws IOException {
55166      composeBackbone(element);
55167      if (element.hasPropertyElement()) {
55168        composeCodeCore("property", element.getPropertyElement(), false);
55169        composeCodeExtras("property", element.getPropertyElement(), false);
55170      }
55171      if (element.hasOpElement()) {
55172        composeEnumerationCore("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
55173        composeEnumerationExtras("op", element.getOpElement(), new ValueSet.FilterOperatorEnumFactory(), false);
55174      }
55175      if (element.hasValueElement()) {
55176        composeStringCore("value", element.getValueElement(), false);
55177        composeStringExtras("value", element.getValueElement(), false);
55178      }
55179  }
55180
55181  protected void composeValueSetValueSetExpansionComponent(String name, ValueSet.ValueSetExpansionComponent element) throws IOException {
55182    if (element != null) {
55183      open(name);
55184      composeValueSetValueSetExpansionComponentInner(element);
55185      close();
55186    }
55187  }
55188
55189  protected void composeValueSetValueSetExpansionComponentInner(ValueSet.ValueSetExpansionComponent element) throws IOException {
55190      composeBackbone(element);
55191      if (element.hasIdentifierElement()) {
55192        composeUriCore("identifier", element.getIdentifierElement(), false);
55193        composeUriExtras("identifier", element.getIdentifierElement(), false);
55194      }
55195      if (element.hasTimestampElement()) {
55196        composeDateTimeCore("timestamp", element.getTimestampElement(), false);
55197        composeDateTimeExtras("timestamp", element.getTimestampElement(), false);
55198      }
55199      if (element.hasTotalElement()) {
55200        composeIntegerCore("total", element.getTotalElement(), false);
55201        composeIntegerExtras("total", element.getTotalElement(), false);
55202      }
55203      if (element.hasOffsetElement()) {
55204        composeIntegerCore("offset", element.getOffsetElement(), false);
55205        composeIntegerExtras("offset", element.getOffsetElement(), false);
55206      }
55207      if (element.hasParameter()) {
55208        openArray("parameter");
55209        for (ValueSet.ValueSetExpansionParameterComponent e : element.getParameter()) 
55210          composeValueSetValueSetExpansionParameterComponent(null, e);
55211        closeArray();
55212      };
55213      if (element.hasContains()) {
55214        openArray("contains");
55215        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
55216          composeValueSetValueSetExpansionContainsComponent(null, e);
55217        closeArray();
55218      };
55219  }
55220
55221  protected void composeValueSetValueSetExpansionParameterComponent(String name, ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
55222    if (element != null) {
55223      open(name);
55224      composeValueSetValueSetExpansionParameterComponentInner(element);
55225      close();
55226    }
55227  }
55228
55229  protected void composeValueSetValueSetExpansionParameterComponentInner(ValueSet.ValueSetExpansionParameterComponent element) throws IOException {
55230      composeBackbone(element);
55231      if (element.hasNameElement()) {
55232        composeStringCore("name", element.getNameElement(), false);
55233        composeStringExtras("name", element.getNameElement(), false);
55234      }
55235      if (element.hasValue()) {
55236        composeType("value", element.getValue());
55237      }
55238  }
55239
55240  protected void composeValueSetValueSetExpansionContainsComponent(String name, ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
55241    if (element != null) {
55242      open(name);
55243      composeValueSetValueSetExpansionContainsComponentInner(element);
55244      close();
55245    }
55246  }
55247
55248  protected void composeValueSetValueSetExpansionContainsComponentInner(ValueSet.ValueSetExpansionContainsComponent element) throws IOException {
55249      composeBackbone(element);
55250      if (element.hasSystemElement()) {
55251        composeUriCore("system", element.getSystemElement(), false);
55252        composeUriExtras("system", element.getSystemElement(), false);
55253      }
55254      if (element.hasAbstractElement()) {
55255        composeBooleanCore("abstract", element.getAbstractElement(), false);
55256        composeBooleanExtras("abstract", element.getAbstractElement(), false);
55257      }
55258      if (element.hasInactiveElement()) {
55259        composeBooleanCore("inactive", element.getInactiveElement(), false);
55260        composeBooleanExtras("inactive", element.getInactiveElement(), false);
55261      }
55262      if (element.hasVersionElement()) {
55263        composeStringCore("version", element.getVersionElement(), false);
55264        composeStringExtras("version", element.getVersionElement(), false);
55265      }
55266      if (element.hasCodeElement()) {
55267        composeCodeCore("code", element.getCodeElement(), false);
55268        composeCodeExtras("code", element.getCodeElement(), false);
55269      }
55270      if (element.hasDisplayElement()) {
55271        composeStringCore("display", element.getDisplayElement(), false);
55272        composeStringExtras("display", element.getDisplayElement(), false);
55273      }
55274      if (element.hasDesignation()) {
55275        openArray("designation");
55276        for (ValueSet.ConceptReferenceDesignationComponent e : element.getDesignation()) 
55277          composeValueSetConceptReferenceDesignationComponent(null, e);
55278        closeArray();
55279      };
55280      if (element.hasContains()) {
55281        openArray("contains");
55282        for (ValueSet.ValueSetExpansionContainsComponent e : element.getContains()) 
55283          composeValueSetValueSetExpansionContainsComponent(null, e);
55284        closeArray();
55285      };
55286  }
55287
55288  protected void composeVerificationResult(String name, VerificationResult element) throws IOException {
55289    if (element != null) {
55290      prop("resourceType", name);
55291      composeVerificationResultInner(element);
55292    }
55293  }
55294
55295  protected void composeVerificationResultInner(VerificationResult element) throws IOException {
55296      composeDomainResourceElements(element);
55297      if (element.hasTarget()) {
55298        openArray("target");
55299        for (Reference e : element.getTarget()) 
55300          composeReference(null, e);
55301        closeArray();
55302      };
55303      if (element.hasTargetLocation()) {
55304        openArray("targetLocation");
55305        for (StringType e : element.getTargetLocation()) 
55306          composeStringCore(null, e, true);
55307        closeArray();
55308        if (anyHasExtras(element.getTargetLocation())) {
55309          openArray("_targetLocation");
55310          for (StringType e : element.getTargetLocation()) 
55311            composeStringExtras(null, e, true);
55312          closeArray();
55313        }
55314      };
55315      if (element.hasNeed()) {
55316        composeCodeableConcept("need", element.getNeed());
55317      }
55318      if (element.hasStatusElement()) {
55319        composeEnumerationCore("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
55320        composeEnumerationExtras("status", element.getStatusElement(), new VerificationResult.StatusEnumFactory(), false);
55321      }
55322      if (element.hasStatusDateElement()) {
55323        composeDateTimeCore("statusDate", element.getStatusDateElement(), false);
55324        composeDateTimeExtras("statusDate", element.getStatusDateElement(), false);
55325      }
55326      if (element.hasValidationType()) {
55327        composeCodeableConcept("validationType", element.getValidationType());
55328      }
55329      if (element.hasValidationProcess()) {
55330        openArray("validationProcess");
55331        for (CodeableConcept e : element.getValidationProcess()) 
55332          composeCodeableConcept(null, e);
55333        closeArray();
55334      };
55335      if (element.hasFrequency()) {
55336        composeTiming("frequency", element.getFrequency());
55337      }
55338      if (element.hasLastPerformedElement()) {
55339        composeDateTimeCore("lastPerformed", element.getLastPerformedElement(), false);
55340        composeDateTimeExtras("lastPerformed", element.getLastPerformedElement(), false);
55341      }
55342      if (element.hasNextScheduledElement()) {
55343        composeDateCore("nextScheduled", element.getNextScheduledElement(), false);
55344        composeDateExtras("nextScheduled", element.getNextScheduledElement(), false);
55345      }
55346      if (element.hasFailureAction()) {
55347        composeCodeableConcept("failureAction", element.getFailureAction());
55348      }
55349      if (element.hasPrimarySource()) {
55350        openArray("primarySource");
55351        for (VerificationResult.VerificationResultPrimarySourceComponent e : element.getPrimarySource()) 
55352          composeVerificationResultVerificationResultPrimarySourceComponent(null, e);
55353        closeArray();
55354      };
55355      if (element.hasAttestation()) {
55356        composeVerificationResultVerificationResultAttestationComponent("attestation", element.getAttestation());
55357      }
55358      if (element.hasValidator()) {
55359        openArray("validator");
55360        for (VerificationResult.VerificationResultValidatorComponent e : element.getValidator()) 
55361          composeVerificationResultVerificationResultValidatorComponent(null, e);
55362        closeArray();
55363      };
55364  }
55365
55366  protected void composeVerificationResultVerificationResultPrimarySourceComponent(String name, VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
55367    if (element != null) {
55368      open(name);
55369      composeVerificationResultVerificationResultPrimarySourceComponentInner(element);
55370      close();
55371    }
55372  }
55373
55374  protected void composeVerificationResultVerificationResultPrimarySourceComponentInner(VerificationResult.VerificationResultPrimarySourceComponent element) throws IOException {
55375      composeBackbone(element);
55376      if (element.hasOrganization()) {
55377        composeReference("organization", element.getOrganization());
55378      }
55379      if (element.hasType()) {
55380        openArray("type");
55381        for (CodeableConcept e : element.getType()) 
55382          composeCodeableConcept(null, e);
55383        closeArray();
55384      };
55385      if (element.hasValidationProcess()) {
55386        openArray("validationProcess");
55387        for (CodeableConcept e : element.getValidationProcess()) 
55388          composeCodeableConcept(null, e);
55389        closeArray();
55390      };
55391      if (element.hasValidationStatus()) {
55392        composeCodeableConcept("validationStatus", element.getValidationStatus());
55393      }
55394      if (element.hasValidationDateElement()) {
55395        composeDateTimeCore("validationDate", element.getValidationDateElement(), false);
55396        composeDateTimeExtras("validationDate", element.getValidationDateElement(), false);
55397      }
55398      if (element.hasCanPushUpdates()) {
55399        composeCodeableConcept("canPushUpdates", element.getCanPushUpdates());
55400      }
55401      if (element.hasPushTypeAvailable()) {
55402        openArray("pushTypeAvailable");
55403        for (CodeableConcept e : element.getPushTypeAvailable()) 
55404          composeCodeableConcept(null, e);
55405        closeArray();
55406      };
55407  }
55408
55409  protected void composeVerificationResultVerificationResultAttestationComponent(String name, VerificationResult.VerificationResultAttestationComponent element) throws IOException {
55410    if (element != null) {
55411      open(name);
55412      composeVerificationResultVerificationResultAttestationComponentInner(element);
55413      close();
55414    }
55415  }
55416
55417  protected void composeVerificationResultVerificationResultAttestationComponentInner(VerificationResult.VerificationResultAttestationComponent element) throws IOException {
55418      composeBackbone(element);
55419      if (element.hasSource()) {
55420        composeReference("source", element.getSource());
55421      }
55422      if (element.hasOrganization()) {
55423        composeReference("organization", element.getOrganization());
55424      }
55425      if (element.hasMethod()) {
55426        composeCodeableConcept("method", element.getMethod());
55427      }
55428      if (element.hasDateElement()) {
55429        composeDateCore("date", element.getDateElement(), false);
55430        composeDateExtras("date", element.getDateElement(), false);
55431      }
55432      if (element.hasSourceIdentityCertificateElement()) {
55433        composeStringCore("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
55434        composeStringExtras("sourceIdentityCertificate", element.getSourceIdentityCertificateElement(), false);
55435      }
55436      if (element.hasProxyIdentityCertificateElement()) {
55437        composeStringCore("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
55438        composeStringExtras("proxyIdentityCertificate", element.getProxyIdentityCertificateElement(), false);
55439      }
55440      if (element.hasSignedProxyRight()) {
55441        composeType("signedProxyRight", element.getSignedProxyRight());
55442      }
55443      if (element.hasSignedSourceAttestation()) {
55444        composeType("signedSourceAttestation", element.getSignedSourceAttestation());
55445      }
55446  }
55447
55448  protected void composeVerificationResultVerificationResultValidatorComponent(String name, VerificationResult.VerificationResultValidatorComponent element) throws IOException {
55449    if (element != null) {
55450      open(name);
55451      composeVerificationResultVerificationResultValidatorComponentInner(element);
55452      close();
55453    }
55454  }
55455
55456  protected void composeVerificationResultVerificationResultValidatorComponentInner(VerificationResult.VerificationResultValidatorComponent element) throws IOException {
55457      composeBackbone(element);
55458      if (element.hasOrganization()) {
55459        composeReference("organization", element.getOrganization());
55460      }
55461      if (element.hasIdentityCertificateElement()) {
55462        composeStringCore("identityCertificate", element.getIdentityCertificateElement(), false);
55463        composeStringExtras("identityCertificate", element.getIdentityCertificateElement(), false);
55464      }
55465      if (element.hasSignedValidatorAttestation()) {
55466        composeType("signedValidatorAttestation", element.getSignedValidatorAttestation());
55467      }
55468  }
55469
55470  protected void composeVisionPrescription(String name, VisionPrescription element) throws IOException {
55471    if (element != null) {
55472      prop("resourceType", name);
55473      composeVisionPrescriptionInner(element);
55474    }
55475  }
55476
55477  protected void composeVisionPrescriptionInner(VisionPrescription element) throws IOException {
55478      composeDomainResourceElements(element);
55479      if (element.hasIdentifier()) {
55480        openArray("identifier");
55481        for (Identifier e : element.getIdentifier()) 
55482          composeIdentifier(null, e);
55483        closeArray();
55484      };
55485      if (element.hasStatusElement()) {
55486        composeEnumerationCore("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
55487        composeEnumerationExtras("status", element.getStatusElement(), new VisionPrescription.VisionStatusEnumFactory(), false);
55488      }
55489      if (element.hasPatient()) {
55490        composeReference("patient", element.getPatient());
55491      }
55492      if (element.hasEncounter()) {
55493        composeReference("encounter", element.getEncounter());
55494      }
55495      if (element.hasDateWrittenElement()) {
55496        composeDateTimeCore("dateWritten", element.getDateWrittenElement(), false);
55497        composeDateTimeExtras("dateWritten", element.getDateWrittenElement(), false);
55498      }
55499      if (element.hasPrescriber()) {
55500        composeReference("prescriber", element.getPrescriber());
55501      }
55502      if (element.hasReason()) {
55503        composeType("reason", element.getReason());
55504      }
55505      if (element.hasDispense()) {
55506        openArray("dispense");
55507        for (VisionPrescription.VisionPrescriptionDispenseComponent e : element.getDispense()) 
55508          composeVisionPrescriptionVisionPrescriptionDispenseComponent(null, e);
55509        closeArray();
55510      };
55511  }
55512
55513  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponent(String name, VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
55514    if (element != null) {
55515      open(name);
55516      composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(element);
55517      close();
55518    }
55519  }
55520
55521  protected void composeVisionPrescriptionVisionPrescriptionDispenseComponentInner(VisionPrescription.VisionPrescriptionDispenseComponent element) throws IOException {
55522      composeBackbone(element);
55523      if (element.hasProduct()) {
55524        composeCodeableConcept("product", element.getProduct());
55525      }
55526      if (element.hasEyeElement()) {
55527        composeEnumerationCore("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
55528        composeEnumerationExtras("eye", element.getEyeElement(), new VisionPrescription.VisionEyesEnumFactory(), false);
55529      }
55530      if (element.hasSphereElement()) {
55531        composeDecimalCore("sphere", element.getSphereElement(), false);
55532        composeDecimalExtras("sphere", element.getSphereElement(), false);
55533      }
55534      if (element.hasCylinderElement()) {
55535        composeDecimalCore("cylinder", element.getCylinderElement(), false);
55536        composeDecimalExtras("cylinder", element.getCylinderElement(), false);
55537      }
55538      if (element.hasAxisElement()) {
55539        composeIntegerCore("axis", element.getAxisElement(), false);
55540        composeIntegerExtras("axis", element.getAxisElement(), false);
55541      }
55542      if (element.hasPrism()) {
55543        openArray("prism");
55544        for (VisionPrescription.PrismComponent e : element.getPrism()) 
55545          composeVisionPrescriptionPrismComponent(null, e);
55546        closeArray();
55547      };
55548      if (element.hasAddElement()) {
55549        composeDecimalCore("add", element.getAddElement(), false);
55550        composeDecimalExtras("add", element.getAddElement(), false);
55551      }
55552      if (element.hasPowerElement()) {
55553        composeDecimalCore("power", element.getPowerElement(), false);
55554        composeDecimalExtras("power", element.getPowerElement(), false);
55555      }
55556      if (element.hasBackCurveElement()) {
55557        composeDecimalCore("backCurve", element.getBackCurveElement(), false);
55558        composeDecimalExtras("backCurve", element.getBackCurveElement(), false);
55559      }
55560      if (element.hasDiameterElement()) {
55561        composeDecimalCore("diameter", element.getDiameterElement(), false);
55562        composeDecimalExtras("diameter", element.getDiameterElement(), false);
55563      }
55564      if (element.hasDuration()) {
55565        composeQuantity("duration", element.getDuration());
55566      }
55567      if (element.hasColorElement()) {
55568        composeStringCore("color", element.getColorElement(), false);
55569        composeStringExtras("color", element.getColorElement(), false);
55570      }
55571      if (element.hasBrandElement()) {
55572        composeStringCore("brand", element.getBrandElement(), false);
55573        composeStringExtras("brand", element.getBrandElement(), false);
55574      }
55575      if (element.hasNote()) {
55576        openArray("note");
55577        for (Annotation e : element.getNote()) 
55578          composeAnnotation(null, e);
55579        closeArray();
55580      };
55581  }
55582
55583  protected void composeVisionPrescriptionPrismComponent(String name, VisionPrescription.PrismComponent element) throws IOException {
55584    if (element != null) {
55585      open(name);
55586      composeVisionPrescriptionPrismComponentInner(element);
55587      close();
55588    }
55589  }
55590
55591  protected void composeVisionPrescriptionPrismComponentInner(VisionPrescription.PrismComponent element) throws IOException {
55592      composeBackbone(element);
55593      if (element.hasAmountElement()) {
55594        composeDecimalCore("amount", element.getAmountElement(), false);
55595        composeDecimalExtras("amount", element.getAmountElement(), false);
55596      }
55597      if (element.hasBaseElement()) {
55598        composeEnumerationCore("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
55599        composeEnumerationExtras("base", element.getBaseElement(), new VisionPrescription.VisionBaseEnumFactory(), false);
55600      }
55601  }
55602
55603  @Override
55604  protected void composeResource(Resource resource) throws IOException {
55605    if (resource instanceof Parameters)
55606      composeParameters("Parameters", (Parameters)resource);
55607    else if (resource instanceof Account)
55608      composeAccount("Account", (Account)resource);
55609    else if (resource instanceof ActivityDefinition)
55610      composeActivityDefinition("ActivityDefinition", (ActivityDefinition)resource);
55611    else if (resource instanceof AdverseEvent)
55612      composeAdverseEvent("AdverseEvent", (AdverseEvent)resource);
55613    else if (resource instanceof AllergyIntolerance)
55614      composeAllergyIntolerance("AllergyIntolerance", (AllergyIntolerance)resource);
55615    else if (resource instanceof Appointment)
55616      composeAppointment("Appointment", (Appointment)resource);
55617    else if (resource instanceof AppointmentResponse)
55618      composeAppointmentResponse("AppointmentResponse", (AppointmentResponse)resource);
55619    else if (resource instanceof AuditEvent)
55620      composeAuditEvent("AuditEvent", (AuditEvent)resource);
55621    else if (resource instanceof Basic)
55622      composeBasic("Basic", (Basic)resource);
55623    else if (resource instanceof Binary)
55624      composeBinary("Binary", (Binary)resource);
55625    else if (resource instanceof BiologicallyDerivedProduct)
55626      composeBiologicallyDerivedProduct("BiologicallyDerivedProduct", (BiologicallyDerivedProduct)resource);
55627    else if (resource instanceof BodyStructure)
55628      composeBodyStructure("BodyStructure", (BodyStructure)resource);
55629    else if (resource instanceof Bundle)
55630      composeBundle("Bundle", (Bundle)resource);
55631    else if (resource instanceof CapabilityStatement)
55632      composeCapabilityStatement("CapabilityStatement", (CapabilityStatement)resource);
55633    else if (resource instanceof CarePlan)
55634      composeCarePlan("CarePlan", (CarePlan)resource);
55635    else if (resource instanceof CareTeam)
55636      composeCareTeam("CareTeam", (CareTeam)resource);
55637    else if (resource instanceof CatalogEntry)
55638      composeCatalogEntry("CatalogEntry", (CatalogEntry)resource);
55639    else if (resource instanceof ChargeItem)
55640      composeChargeItem("ChargeItem", (ChargeItem)resource);
55641    else if (resource instanceof ChargeItemDefinition)
55642      composeChargeItemDefinition("ChargeItemDefinition", (ChargeItemDefinition)resource);
55643    else if (resource instanceof Claim)
55644      composeClaim("Claim", (Claim)resource);
55645    else if (resource instanceof ClaimResponse)
55646      composeClaimResponse("ClaimResponse", (ClaimResponse)resource);
55647    else if (resource instanceof ClinicalImpression)
55648      composeClinicalImpression("ClinicalImpression", (ClinicalImpression)resource);
55649    else if (resource instanceof CodeSystem)
55650      composeCodeSystem("CodeSystem", (CodeSystem)resource);
55651    else if (resource instanceof Communication)
55652      composeCommunication("Communication", (Communication)resource);
55653    else if (resource instanceof CommunicationRequest)
55654      composeCommunicationRequest("CommunicationRequest", (CommunicationRequest)resource);
55655    else if (resource instanceof CompartmentDefinition)
55656      composeCompartmentDefinition("CompartmentDefinition", (CompartmentDefinition)resource);
55657    else if (resource instanceof Composition)
55658      composeComposition("Composition", (Composition)resource);
55659    else if (resource instanceof ConceptMap)
55660      composeConceptMap("ConceptMap", (ConceptMap)resource);
55661    else if (resource instanceof Condition)
55662      composeCondition("Condition", (Condition)resource);
55663    else if (resource instanceof Consent)
55664      composeConsent("Consent", (Consent)resource);
55665    else if (resource instanceof Contract)
55666      composeContract("Contract", (Contract)resource);
55667    else if (resource instanceof Coverage)
55668      composeCoverage("Coverage", (Coverage)resource);
55669    else if (resource instanceof CoverageEligibilityRequest)
55670      composeCoverageEligibilityRequest("CoverageEligibilityRequest", (CoverageEligibilityRequest)resource);
55671    else if (resource instanceof CoverageEligibilityResponse)
55672      composeCoverageEligibilityResponse("CoverageEligibilityResponse", (CoverageEligibilityResponse)resource);
55673    else if (resource instanceof DetectedIssue)
55674      composeDetectedIssue("DetectedIssue", (DetectedIssue)resource);
55675    else if (resource instanceof Device)
55676      composeDevice("Device", (Device)resource);
55677    else if (resource instanceof DeviceDefinition)
55678      composeDeviceDefinition("DeviceDefinition", (DeviceDefinition)resource);
55679    else if (resource instanceof DeviceMetric)
55680      composeDeviceMetric("DeviceMetric", (DeviceMetric)resource);
55681    else if (resource instanceof DeviceRequest)
55682      composeDeviceRequest("DeviceRequest", (DeviceRequest)resource);
55683    else if (resource instanceof DeviceUseStatement)
55684      composeDeviceUseStatement("DeviceUseStatement", (DeviceUseStatement)resource);
55685    else if (resource instanceof DiagnosticReport)
55686      composeDiagnosticReport("DiagnosticReport", (DiagnosticReport)resource);
55687    else if (resource instanceof DocumentManifest)
55688      composeDocumentManifest("DocumentManifest", (DocumentManifest)resource);
55689    else if (resource instanceof DocumentReference)
55690      composeDocumentReference("DocumentReference", (DocumentReference)resource);
55691    else if (resource instanceof Encounter)
55692      composeEncounter("Encounter", (Encounter)resource);
55693    else if (resource instanceof Endpoint)
55694      composeEndpoint("Endpoint", (Endpoint)resource);
55695    else if (resource instanceof EnrollmentRequest)
55696      composeEnrollmentRequest("EnrollmentRequest", (EnrollmentRequest)resource);
55697    else if (resource instanceof EnrollmentResponse)
55698      composeEnrollmentResponse("EnrollmentResponse", (EnrollmentResponse)resource);
55699    else if (resource instanceof EpisodeOfCare)
55700      composeEpisodeOfCare("EpisodeOfCare", (EpisodeOfCare)resource);
55701    else if (resource instanceof EventDefinition)
55702      composeEventDefinition("EventDefinition", (EventDefinition)resource);
55703    else if (resource instanceof ExampleScenario)
55704      composeExampleScenario("ExampleScenario", (ExampleScenario)resource);
55705    else if (resource instanceof ExplanationOfBenefit)
55706      composeExplanationOfBenefit("ExplanationOfBenefit", (ExplanationOfBenefit)resource);
55707    else if (resource instanceof FamilyMemberHistory)
55708      composeFamilyMemberHistory("FamilyMemberHistory", (FamilyMemberHistory)resource);
55709    else if (resource instanceof Flag)
55710      composeFlag("Flag", (Flag)resource);
55711    else if (resource instanceof Goal)
55712      composeGoal("Goal", (Goal)resource);
55713    else if (resource instanceof GraphDefinition)
55714      composeGraphDefinition("GraphDefinition", (GraphDefinition)resource);
55715    else if (resource instanceof Group)
55716      composeGroup("Group", (Group)resource);
55717    else if (resource instanceof GuidanceResponse)
55718      composeGuidanceResponse("GuidanceResponse", (GuidanceResponse)resource);
55719    else if (resource instanceof HealthcareService)
55720      composeHealthcareService("HealthcareService", (HealthcareService)resource);
55721    else if (resource instanceof ImagingStudy)
55722      composeImagingStudy("ImagingStudy", (ImagingStudy)resource);
55723    else if (resource instanceof Immunization)
55724      composeImmunization("Immunization", (Immunization)resource);
55725    else if (resource instanceof ImmunizationEvaluation)
55726      composeImmunizationEvaluation("ImmunizationEvaluation", (ImmunizationEvaluation)resource);
55727    else if (resource instanceof ImmunizationRecommendation)
55728      composeImmunizationRecommendation("ImmunizationRecommendation", (ImmunizationRecommendation)resource);
55729    else if (resource instanceof ImplementationGuide)
55730      composeImplementationGuide("ImplementationGuide", (ImplementationGuide)resource);
55731    else if (resource instanceof InsurancePlan)
55732      composeInsurancePlan("InsurancePlan", (InsurancePlan)resource);
55733    else if (resource instanceof Invoice)
55734      composeInvoice("Invoice", (Invoice)resource);
55735    else if (resource instanceof ItemInstance)
55736      composeItemInstance("ItemInstance", (ItemInstance)resource);
55737    else if (resource instanceof Library)
55738      composeLibrary("Library", (Library)resource);
55739    else if (resource instanceof Linkage)
55740      composeLinkage("Linkage", (Linkage)resource);
55741    else if (resource instanceof ListResource)
55742      composeListResource("List", (ListResource)resource);
55743    else if (resource instanceof Location)
55744      composeLocation("Location", (Location)resource);
55745    else if (resource instanceof Measure)
55746      composeMeasure("Measure", (Measure)resource);
55747    else if (resource instanceof MeasureReport)
55748      composeMeasureReport("MeasureReport", (MeasureReport)resource);
55749    else if (resource instanceof Media)
55750      composeMedia("Media", (Media)resource);
55751    else if (resource instanceof Medication)
55752      composeMedication("Medication", (Medication)resource);
55753    else if (resource instanceof MedicationAdministration)
55754      composeMedicationAdministration("MedicationAdministration", (MedicationAdministration)resource);
55755    else if (resource instanceof MedicationDispense)
55756      composeMedicationDispense("MedicationDispense", (MedicationDispense)resource);
55757    else if (resource instanceof MedicationKnowledge)
55758      composeMedicationKnowledge("MedicationKnowledge", (MedicationKnowledge)resource);
55759    else if (resource instanceof MedicationRequest)
55760      composeMedicationRequest("MedicationRequest", (MedicationRequest)resource);
55761    else if (resource instanceof MedicationStatement)
55762      composeMedicationStatement("MedicationStatement", (MedicationStatement)resource);
55763    else if (resource instanceof MedicinalProduct)
55764      composeMedicinalProduct("MedicinalProduct", (MedicinalProduct)resource);
55765    else if (resource instanceof MedicinalProductAuthorization)
55766      composeMedicinalProductAuthorization("MedicinalProductAuthorization", (MedicinalProductAuthorization)resource);
55767    else if (resource instanceof MedicinalProductClinicals)
55768      composeMedicinalProductClinicals("MedicinalProductClinicals", (MedicinalProductClinicals)resource);
55769    else if (resource instanceof MedicinalProductContraindication)
55770      composeMedicinalProductContraindication("MedicinalProductContraindication", (MedicinalProductContraindication)resource);
55771    else if (resource instanceof MedicinalProductDeviceSpec)
55772      composeMedicinalProductDeviceSpec("MedicinalProductDeviceSpec", (MedicinalProductDeviceSpec)resource);
55773    else if (resource instanceof MedicinalProductIndication)
55774      composeMedicinalProductIndication("MedicinalProductIndication", (MedicinalProductIndication)resource);
55775    else if (resource instanceof MedicinalProductIngredient)
55776      composeMedicinalProductIngredient("MedicinalProductIngredient", (MedicinalProductIngredient)resource);
55777    else if (resource instanceof MedicinalProductInteraction)
55778      composeMedicinalProductInteraction("MedicinalProductInteraction", (MedicinalProductInteraction)resource);
55779    else if (resource instanceof MedicinalProductManufactured)
55780      composeMedicinalProductManufactured("MedicinalProductManufactured", (MedicinalProductManufactured)resource);
55781    else if (resource instanceof MedicinalProductPackaged)
55782      composeMedicinalProductPackaged("MedicinalProductPackaged", (MedicinalProductPackaged)resource);
55783    else if (resource instanceof MedicinalProductPharmaceutical)
55784      composeMedicinalProductPharmaceutical("MedicinalProductPharmaceutical", (MedicinalProductPharmaceutical)resource);
55785    else if (resource instanceof MedicinalProductUndesirableEffect)
55786      composeMedicinalProductUndesirableEffect("MedicinalProductUndesirableEffect", (MedicinalProductUndesirableEffect)resource);
55787    else if (resource instanceof MessageDefinition)
55788      composeMessageDefinition("MessageDefinition", (MessageDefinition)resource);
55789    else if (resource instanceof MessageHeader)
55790      composeMessageHeader("MessageHeader", (MessageHeader)resource);
55791    else if (resource instanceof NamingSystem)
55792      composeNamingSystem("NamingSystem", (NamingSystem)resource);
55793    else if (resource instanceof NutritionOrder)
55794      composeNutritionOrder("NutritionOrder", (NutritionOrder)resource);
55795    else if (resource instanceof Observation)
55796      composeObservation("Observation", (Observation)resource);
55797    else if (resource instanceof ObservationDefinition)
55798      composeObservationDefinition("ObservationDefinition", (ObservationDefinition)resource);
55799    else if (resource instanceof OperationDefinition)
55800      composeOperationDefinition("OperationDefinition", (OperationDefinition)resource);
55801    else if (resource instanceof OperationOutcome)
55802      composeOperationOutcome("OperationOutcome", (OperationOutcome)resource);
55803    else if (resource instanceof Organization)
55804      composeOrganization("Organization", (Organization)resource);
55805    else if (resource instanceof OrganizationAffiliation)
55806      composeOrganizationAffiliation("OrganizationAffiliation", (OrganizationAffiliation)resource);
55807    else if (resource instanceof Patient)
55808      composePatient("Patient", (Patient)resource);
55809    else if (resource instanceof PaymentNotice)
55810      composePaymentNotice("PaymentNotice", (PaymentNotice)resource);
55811    else if (resource instanceof PaymentReconciliation)
55812      composePaymentReconciliation("PaymentReconciliation", (PaymentReconciliation)resource);
55813    else if (resource instanceof Person)
55814      composePerson("Person", (Person)resource);
55815    else if (resource instanceof PlanDefinition)
55816      composePlanDefinition("PlanDefinition", (PlanDefinition)resource);
55817    else if (resource instanceof Practitioner)
55818      composePractitioner("Practitioner", (Practitioner)resource);
55819    else if (resource instanceof PractitionerRole)
55820      composePractitionerRole("PractitionerRole", (PractitionerRole)resource);
55821    else if (resource instanceof Procedure)
55822      composeProcedure("Procedure", (Procedure)resource);
55823    else if (resource instanceof ProcessRequest)
55824      composeProcessRequest("ProcessRequest", (ProcessRequest)resource);
55825    else if (resource instanceof ProcessResponse)
55826      composeProcessResponse("ProcessResponse", (ProcessResponse)resource);
55827    else if (resource instanceof Provenance)
55828      composeProvenance("Provenance", (Provenance)resource);
55829    else if (resource instanceof Questionnaire)
55830      composeQuestionnaire("Questionnaire", (Questionnaire)resource);
55831    else if (resource instanceof QuestionnaireResponse)
55832      composeQuestionnaireResponse("QuestionnaireResponse", (QuestionnaireResponse)resource);
55833    else if (resource instanceof RelatedPerson)
55834      composeRelatedPerson("RelatedPerson", (RelatedPerson)resource);
55835    else if (resource instanceof RequestGroup)
55836      composeRequestGroup("RequestGroup", (RequestGroup)resource);
55837    else if (resource instanceof ResearchStudy)
55838      composeResearchStudy("ResearchStudy", (ResearchStudy)resource);
55839    else if (resource instanceof ResearchSubject)
55840      composeResearchSubject("ResearchSubject", (ResearchSubject)resource);
55841    else if (resource instanceof RiskAssessment)
55842      composeRiskAssessment("RiskAssessment", (RiskAssessment)resource);
55843    else if (resource instanceof Schedule)
55844      composeSchedule("Schedule", (Schedule)resource);
55845    else if (resource instanceof SearchParameter)
55846      composeSearchParameter("SearchParameter", (SearchParameter)resource);
55847    else if (resource instanceof Sequence)
55848      composeSequence("Sequence", (Sequence)resource);
55849    else if (resource instanceof ServiceRequest)
55850      composeServiceRequest("ServiceRequest", (ServiceRequest)resource);
55851    else if (resource instanceof Slot)
55852      composeSlot("Slot", (Slot)resource);
55853    else if (resource instanceof Specimen)
55854      composeSpecimen("Specimen", (Specimen)resource);
55855    else if (resource instanceof SpecimenDefinition)
55856      composeSpecimenDefinition("SpecimenDefinition", (SpecimenDefinition)resource);
55857    else if (resource instanceof StructureDefinition)
55858      composeStructureDefinition("StructureDefinition", (StructureDefinition)resource);
55859    else if (resource instanceof StructureMap)
55860      composeStructureMap("StructureMap", (StructureMap)resource);
55861    else if (resource instanceof Subscription)
55862      composeSubscription("Subscription", (Subscription)resource);
55863    else if (resource instanceof Substance)
55864      composeSubstance("Substance", (Substance)resource);
55865    else if (resource instanceof SubstancePolymer)
55866      composeSubstancePolymer("SubstancePolymer", (SubstancePolymer)resource);
55867    else if (resource instanceof SubstanceReferenceInformation)
55868      composeSubstanceReferenceInformation("SubstanceReferenceInformation", (SubstanceReferenceInformation)resource);
55869    else if (resource instanceof SubstanceSpecification)
55870      composeSubstanceSpecification("SubstanceSpecification", (SubstanceSpecification)resource);
55871    else if (resource instanceof SupplyDelivery)
55872      composeSupplyDelivery("SupplyDelivery", (SupplyDelivery)resource);
55873    else if (resource instanceof SupplyRequest)
55874      composeSupplyRequest("SupplyRequest", (SupplyRequest)resource);
55875    else if (resource instanceof Task)
55876      composeTask("Task", (Task)resource);
55877    else if (resource instanceof TerminologyCapabilities)
55878      composeTerminologyCapabilities("TerminologyCapabilities", (TerminologyCapabilities)resource);
55879    else if (resource instanceof TestReport)
55880      composeTestReport("TestReport", (TestReport)resource);
55881    else if (resource instanceof TestScript)
55882      composeTestScript("TestScript", (TestScript)resource);
55883    else if (resource instanceof UserSession)
55884      composeUserSession("UserSession", (UserSession)resource);
55885    else if (resource instanceof ValueSet)
55886      composeValueSet("ValueSet", (ValueSet)resource);
55887    else if (resource instanceof VerificationResult)
55888      composeVerificationResult("VerificationResult", (VerificationResult)resource);
55889    else if (resource instanceof VisionPrescription)
55890      composeVisionPrescription("VisionPrescription", (VisionPrescription)resource);
55891    else if (resource instanceof Binary)
55892      composeBinary("Binary", (Binary)resource);
55893    else
55894      throw new Error("Unhandled resource type "+resource.getClass().getName());
55895  }
55896
55897  protected void composeNamedReference(String name, Resource resource) throws IOException {
55898    if (resource instanceof Parameters)
55899      composeParameters(name, (Parameters)resource);
55900    else if (resource instanceof Account)
55901      composeAccount(name, (Account)resource);
55902    else if (resource instanceof ActivityDefinition)
55903      composeActivityDefinition(name, (ActivityDefinition)resource);
55904    else if (resource instanceof AdverseEvent)
55905      composeAdverseEvent(name, (AdverseEvent)resource);
55906    else if (resource instanceof AllergyIntolerance)
55907      composeAllergyIntolerance(name, (AllergyIntolerance)resource);
55908    else if (resource instanceof Appointment)
55909      composeAppointment(name, (Appointment)resource);
55910    else if (resource instanceof AppointmentResponse)
55911      composeAppointmentResponse(name, (AppointmentResponse)resource);
55912    else if (resource instanceof AuditEvent)
55913      composeAuditEvent(name, (AuditEvent)resource);
55914    else if (resource instanceof Basic)
55915      composeBasic(name, (Basic)resource);
55916    else if (resource instanceof Binary)
55917      composeBinary(name, (Binary)resource);
55918    else if (resource instanceof BiologicallyDerivedProduct)
55919      composeBiologicallyDerivedProduct(name, (BiologicallyDerivedProduct)resource);
55920    else if (resource instanceof BodyStructure)
55921      composeBodyStructure(name, (BodyStructure)resource);
55922    else if (resource instanceof Bundle)
55923      composeBundle(name, (Bundle)resource);
55924    else if (resource instanceof CapabilityStatement)
55925      composeCapabilityStatement(name, (CapabilityStatement)resource);
55926    else if (resource instanceof CarePlan)
55927      composeCarePlan(name, (CarePlan)resource);
55928    else if (resource instanceof CareTeam)
55929      composeCareTeam(name, (CareTeam)resource);
55930    else if (resource instanceof CatalogEntry)
55931      composeCatalogEntry(name, (CatalogEntry)resource);
55932    else if (resource instanceof ChargeItem)
55933      composeChargeItem(name, (ChargeItem)resource);
55934    else if (resource instanceof ChargeItemDefinition)
55935      composeChargeItemDefinition(name, (ChargeItemDefinition)resource);
55936    else if (resource instanceof Claim)
55937      composeClaim(name, (Claim)resource);
55938    else if (resource instanceof ClaimResponse)
55939      composeClaimResponse(name, (ClaimResponse)resource);
55940    else if (resource instanceof ClinicalImpression)
55941      composeClinicalImpression(name, (ClinicalImpression)resource);
55942    else if (resource instanceof CodeSystem)
55943      composeCodeSystem(name, (CodeSystem)resource);
55944    else if (resource instanceof Communication)
55945      composeCommunication(name, (Communication)resource);
55946    else if (resource instanceof CommunicationRequest)
55947      composeCommunicationRequest(name, (CommunicationRequest)resource);
55948    else if (resource instanceof CompartmentDefinition)
55949      composeCompartmentDefinition(name, (CompartmentDefinition)resource);
55950    else if (resource instanceof Composition)
55951      composeComposition(name, (Composition)resource);
55952    else if (resource instanceof ConceptMap)
55953      composeConceptMap(name, (ConceptMap)resource);
55954    else if (resource instanceof Condition)
55955      composeCondition(name, (Condition)resource);
55956    else if (resource instanceof Consent)
55957      composeConsent(name, (Consent)resource);
55958    else if (resource instanceof Contract)
55959      composeContract(name, (Contract)resource);
55960    else if (resource instanceof Coverage)
55961      composeCoverage(name, (Coverage)resource);
55962    else if (resource instanceof CoverageEligibilityRequest)
55963      composeCoverageEligibilityRequest(name, (CoverageEligibilityRequest)resource);
55964    else if (resource instanceof CoverageEligibilityResponse)
55965      composeCoverageEligibilityResponse(name, (CoverageEligibilityResponse)resource);
55966    else if (resource instanceof DetectedIssue)
55967      composeDetectedIssue(name, (DetectedIssue)resource);
55968    else if (resource instanceof Device)
55969      composeDevice(name, (Device)resource);
55970    else if (resource instanceof DeviceDefinition)
55971      composeDeviceDefinition(name, (DeviceDefinition)resource);
55972    else if (resource instanceof DeviceMetric)
55973      composeDeviceMetric(name, (DeviceMetric)resource);
55974    else if (resource instanceof DeviceRequest)
55975      composeDeviceRequest(name, (DeviceRequest)resource);
55976    else if (resource instanceof DeviceUseStatement)
55977      composeDeviceUseStatement(name, (DeviceUseStatement)resource);
55978    else if (resource instanceof DiagnosticReport)
55979      composeDiagnosticReport(name, (DiagnosticReport)resource);
55980    else if (resource instanceof DocumentManifest)
55981      composeDocumentManifest(name, (DocumentManifest)resource);
55982    else if (resource instanceof DocumentReference)
55983      composeDocumentReference(name, (DocumentReference)resource);
55984    else if (resource instanceof Encounter)
55985      composeEncounter(name, (Encounter)resource);
55986    else if (resource instanceof Endpoint)
55987      composeEndpoint(name, (Endpoint)resource);
55988    else if (resource instanceof EnrollmentRequest)
55989      composeEnrollmentRequest(name, (EnrollmentRequest)resource);
55990    else if (resource instanceof EnrollmentResponse)
55991      composeEnrollmentResponse(name, (EnrollmentResponse)resource);
55992    else if (resource instanceof EpisodeOfCare)
55993      composeEpisodeOfCare(name, (EpisodeOfCare)resource);
55994    else if (resource instanceof EventDefinition)
55995      composeEventDefinition(name, (EventDefinition)resource);
55996    else if (resource instanceof ExampleScenario)
55997      composeExampleScenario(name, (ExampleScenario)resource);
55998    else if (resource instanceof ExplanationOfBenefit)
55999      composeExplanationOfBenefit(name, (ExplanationOfBenefit)resource);
56000    else if (resource instanceof FamilyMemberHistory)
56001      composeFamilyMemberHistory(name, (FamilyMemberHistory)resource);
56002    else if (resource instanceof Flag)
56003      composeFlag(name, (Flag)resource);
56004    else if (resource instanceof Goal)
56005      composeGoal(name, (Goal)resource);
56006    else if (resource instanceof GraphDefinition)
56007      composeGraphDefinition(name, (GraphDefinition)resource);
56008    else if (resource instanceof Group)
56009      composeGroup(name, (Group)resource);
56010    else if (resource instanceof GuidanceResponse)
56011      composeGuidanceResponse(name, (GuidanceResponse)resource);
56012    else if (resource instanceof HealthcareService)
56013      composeHealthcareService(name, (HealthcareService)resource);
56014    else if (resource instanceof ImagingStudy)
56015      composeImagingStudy(name, (ImagingStudy)resource);
56016    else if (resource instanceof Immunization)
56017      composeImmunization(name, (Immunization)resource);
56018    else if (resource instanceof ImmunizationEvaluation)
56019      composeImmunizationEvaluation(name, (ImmunizationEvaluation)resource);
56020    else if (resource instanceof ImmunizationRecommendation)
56021      composeImmunizationRecommendation(name, (ImmunizationRecommendation)resource);
56022    else if (resource instanceof ImplementationGuide)
56023      composeImplementationGuide(name, (ImplementationGuide)resource);
56024    else if (resource instanceof InsurancePlan)
56025      composeInsurancePlan(name, (InsurancePlan)resource);
56026    else if (resource instanceof Invoice)
56027      composeInvoice(name, (Invoice)resource);
56028    else if (resource instanceof ItemInstance)
56029      composeItemInstance(name, (ItemInstance)resource);
56030    else if (resource instanceof Library)
56031      composeLibrary(name, (Library)resource);
56032    else if (resource instanceof Linkage)
56033      composeLinkage(name, (Linkage)resource);
56034    else if (resource instanceof ListResource)
56035      composeListResource(name, (ListResource)resource);
56036    else if (resource instanceof Location)
56037      composeLocation(name, (Location)resource);
56038    else if (resource instanceof Measure)
56039      composeMeasure(name, (Measure)resource);
56040    else if (resource instanceof MeasureReport)
56041      composeMeasureReport(name, (MeasureReport)resource);
56042    else if (resource instanceof Media)
56043      composeMedia(name, (Media)resource);
56044    else if (resource instanceof Medication)
56045      composeMedication(name, (Medication)resource);
56046    else if (resource instanceof MedicationAdministration)
56047      composeMedicationAdministration(name, (MedicationAdministration)resource);
56048    else if (resource instanceof MedicationDispense)
56049      composeMedicationDispense(name, (MedicationDispense)resource);
56050    else if (resource instanceof MedicationKnowledge)
56051      composeMedicationKnowledge(name, (MedicationKnowledge)resource);
56052    else if (resource instanceof MedicationRequest)
56053      composeMedicationRequest(name, (MedicationRequest)resource);
56054    else if (resource instanceof MedicationStatement)
56055      composeMedicationStatement(name, (MedicationStatement)resource);
56056    else if (resource instanceof MedicinalProduct)
56057      composeMedicinalProduct(name, (MedicinalProduct)resource);
56058    else if (resource instanceof MedicinalProductAuthorization)
56059      composeMedicinalProductAuthorization(name, (MedicinalProductAuthorization)resource);
56060    else if (resource instanceof MedicinalProductClinicals)
56061      composeMedicinalProductClinicals(name, (MedicinalProductClinicals)resource);
56062    else if (resource instanceof MedicinalProductContraindication)
56063      composeMedicinalProductContraindication(name, (MedicinalProductContraindication)resource);
56064    else if (resource instanceof MedicinalProductDeviceSpec)
56065      composeMedicinalProductDeviceSpec(name, (MedicinalProductDeviceSpec)resource);
56066    else if (resource instanceof MedicinalProductIndication)
56067      composeMedicinalProductIndication(name, (MedicinalProductIndication)resource);
56068    else if (resource instanceof MedicinalProductIngredient)
56069      composeMedicinalProductIngredient(name, (MedicinalProductIngredient)resource);
56070    else if (resource instanceof MedicinalProductInteraction)
56071      composeMedicinalProductInteraction(name, (MedicinalProductInteraction)resource);
56072    else if (resource instanceof MedicinalProductManufactured)
56073      composeMedicinalProductManufactured(name, (MedicinalProductManufactured)resource);
56074    else if (resource instanceof MedicinalProductPackaged)
56075      composeMedicinalProductPackaged(name, (MedicinalProductPackaged)resource);
56076    else if (resource instanceof MedicinalProductPharmaceutical)
56077      composeMedicinalProductPharmaceutical(name, (MedicinalProductPharmaceutical)resource);
56078    else if (resource instanceof MedicinalProductUndesirableEffect)
56079      composeMedicinalProductUndesirableEffect(name, (MedicinalProductUndesirableEffect)resource);
56080    else if (resource instanceof MessageDefinition)
56081      composeMessageDefinition(name, (MessageDefinition)resource);
56082    else if (resource instanceof MessageHeader)
56083      composeMessageHeader(name, (MessageHeader)resource);
56084    else if (resource instanceof NamingSystem)
56085      composeNamingSystem(name, (NamingSystem)resource);
56086    else if (resource instanceof NutritionOrder)
56087      composeNutritionOrder(name, (NutritionOrder)resource);
56088    else if (resource instanceof Observation)
56089      composeObservation(name, (Observation)resource);
56090    else if (resource instanceof ObservationDefinition)
56091      composeObservationDefinition(name, (ObservationDefinition)resource);
56092    else if (resource instanceof OperationDefinition)
56093      composeOperationDefinition(name, (OperationDefinition)resource);
56094    else if (resource instanceof OperationOutcome)
56095      composeOperationOutcome(name, (OperationOutcome)resource);
56096    else if (resource instanceof Organization)
56097      composeOrganization(name, (Organization)resource);
56098    else if (resource instanceof OrganizationAffiliation)
56099      composeOrganizationAffiliation(name, (OrganizationAffiliation)resource);
56100    else if (resource instanceof Patient)
56101      composePatient(name, (Patient)resource);
56102    else if (resource instanceof PaymentNotice)
56103      composePaymentNotice(name, (PaymentNotice)resource);
56104    else if (resource instanceof PaymentReconciliation)
56105      composePaymentReconciliation(name, (PaymentReconciliation)resource);
56106    else if (resource instanceof Person)
56107      composePerson(name, (Person)resource);
56108    else if (resource instanceof PlanDefinition)
56109      composePlanDefinition(name, (PlanDefinition)resource);
56110    else if (resource instanceof Practitioner)
56111      composePractitioner(name, (Practitioner)resource);
56112    else if (resource instanceof PractitionerRole)
56113      composePractitionerRole(name, (PractitionerRole)resource);
56114    else if (resource instanceof Procedure)
56115      composeProcedure(name, (Procedure)resource);
56116    else if (resource instanceof ProcessRequest)
56117      composeProcessRequest(name, (ProcessRequest)resource);
56118    else if (resource instanceof ProcessResponse)
56119      composeProcessResponse(name, (ProcessResponse)resource);
56120    else if (resource instanceof Provenance)
56121      composeProvenance(name, (Provenance)resource);
56122    else if (resource instanceof Questionnaire)
56123      composeQuestionnaire(name, (Questionnaire)resource);
56124    else if (resource instanceof QuestionnaireResponse)
56125      composeQuestionnaireResponse(name, (QuestionnaireResponse)resource);
56126    else if (resource instanceof RelatedPerson)
56127      composeRelatedPerson(name, (RelatedPerson)resource);
56128    else if (resource instanceof RequestGroup)
56129      composeRequestGroup(name, (RequestGroup)resource);
56130    else if (resource instanceof ResearchStudy)
56131      composeResearchStudy(name, (ResearchStudy)resource);
56132    else if (resource instanceof ResearchSubject)
56133      composeResearchSubject(name, (ResearchSubject)resource);
56134    else if (resource instanceof RiskAssessment)
56135      composeRiskAssessment(name, (RiskAssessment)resource);
56136    else if (resource instanceof Schedule)
56137      composeSchedule(name, (Schedule)resource);
56138    else if (resource instanceof SearchParameter)
56139      composeSearchParameter(name, (SearchParameter)resource);
56140    else if (resource instanceof Sequence)
56141      composeSequence(name, (Sequence)resource);
56142    else if (resource instanceof ServiceRequest)
56143      composeServiceRequest(name, (ServiceRequest)resource);
56144    else if (resource instanceof Slot)
56145      composeSlot(name, (Slot)resource);
56146    else if (resource instanceof Specimen)
56147      composeSpecimen(name, (Specimen)resource);
56148    else if (resource instanceof SpecimenDefinition)
56149      composeSpecimenDefinition(name, (SpecimenDefinition)resource);
56150    else if (resource instanceof StructureDefinition)
56151      composeStructureDefinition(name, (StructureDefinition)resource);
56152    else if (resource instanceof StructureMap)
56153      composeStructureMap(name, (StructureMap)resource);
56154    else if (resource instanceof Subscription)
56155      composeSubscription(name, (Subscription)resource);
56156    else if (resource instanceof Substance)
56157      composeSubstance(name, (Substance)resource);
56158    else if (resource instanceof SubstancePolymer)
56159      composeSubstancePolymer(name, (SubstancePolymer)resource);
56160    else if (resource instanceof SubstanceReferenceInformation)
56161      composeSubstanceReferenceInformation(name, (SubstanceReferenceInformation)resource);
56162    else if (resource instanceof SubstanceSpecification)
56163      composeSubstanceSpecification(name, (SubstanceSpecification)resource);
56164    else if (resource instanceof SupplyDelivery)
56165      composeSupplyDelivery(name, (SupplyDelivery)resource);
56166    else if (resource instanceof SupplyRequest)
56167      composeSupplyRequest(name, (SupplyRequest)resource);
56168    else if (resource instanceof Task)
56169      composeTask(name, (Task)resource);
56170    else if (resource instanceof TerminologyCapabilities)
56171      composeTerminologyCapabilities(name, (TerminologyCapabilities)resource);
56172    else if (resource instanceof TestReport)
56173      composeTestReport(name, (TestReport)resource);
56174    else if (resource instanceof TestScript)
56175      composeTestScript(name, (TestScript)resource);
56176    else if (resource instanceof UserSession)
56177      composeUserSession(name, (UserSession)resource);
56178    else if (resource instanceof ValueSet)
56179      composeValueSet(name, (ValueSet)resource);
56180    else if (resource instanceof VerificationResult)
56181      composeVerificationResult(name, (VerificationResult)resource);
56182    else if (resource instanceof VisionPrescription)
56183      composeVisionPrescription(name, (VisionPrescription)resource);
56184    else if (resource instanceof Binary)
56185      composeBinary(name, (Binary)resource);
56186    else
56187      throw new Error("Unhandled resource type "+resource.getClass().getName());
56188  }
56189
56190  protected void composeType(String prefix, Type type) throws IOException {
56191    if (type == null)
56192      ;
56193    else if (type instanceof Extension)
56194       composeExtension(prefix+"Extension", (Extension) type);
56195    else if (type instanceof Narrative)
56196       composeNarrative(prefix+"Narrative", (Narrative) type);
56197    else if (type instanceof Count)
56198       composeCount(prefix+"Count", (Count) type);
56199    else if (type instanceof Dosage)
56200       composeDosage(prefix+"Dosage", (Dosage) type);
56201    else if (type instanceof Distance)
56202       composeDistance(prefix+"Distance", (Distance) type);
56203    else if (type instanceof Age)
56204       composeAge(prefix+"Age", (Age) type);
56205    else if (type instanceof Duration)
56206       composeDuration(prefix+"Duration", (Duration) type);
56207    else if (type instanceof Timing)
56208       composeTiming(prefix+"Timing", (Timing) type);
56209    else if (type instanceof Meta)
56210       composeMeta(prefix+"Meta", (Meta) type);
56211    else if (type instanceof Address)
56212       composeAddress(prefix+"Address", (Address) type);
56213    else if (type instanceof Contributor)
56214       composeContributor(prefix+"Contributor", (Contributor) type);
56215    else if (type instanceof Attachment)
56216       composeAttachment(prefix+"Attachment", (Attachment) type);
56217    else if (type instanceof DataRequirement)
56218       composeDataRequirement(prefix+"DataRequirement", (DataRequirement) type);
56219    else if (type instanceof Money)
56220       composeMoney(prefix+"Money", (Money) type);
56221    else if (type instanceof HumanName)
56222       composeHumanName(prefix+"HumanName", (HumanName) type);
56223    else if (type instanceof ContactPoint)
56224       composeContactPoint(prefix+"ContactPoint", (ContactPoint) type);
56225    else if (type instanceof Identifier)
56226       composeIdentifier(prefix+"Identifier", (Identifier) type);
56227    else if (type instanceof Coding)
56228       composeCoding(prefix+"Coding", (Coding) type);
56229    else if (type instanceof SampledData)
56230       composeSampledData(prefix+"SampledData", (SampledData) type);
56231    else if (type instanceof Ratio)
56232       composeRatio(prefix+"Ratio", (Ratio) type);
56233    else if (type instanceof Reference)
56234       composeReference(prefix+"Reference", (Reference) type);
56235    else if (type instanceof TriggerDefinition)
56236       composeTriggerDefinition(prefix+"TriggerDefinition", (TriggerDefinition) type);
56237    else if (type instanceof Quantity)
56238       composeQuantity(prefix+"Quantity", (Quantity) type);
56239    else if (type instanceof Period)
56240       composePeriod(prefix+"Period", (Period) type);
56241    else if (type instanceof Range)
56242       composeRange(prefix+"Range", (Range) type);
56243    else if (type instanceof RelatedArtifact)
56244       composeRelatedArtifact(prefix+"RelatedArtifact", (RelatedArtifact) type);
56245    else if (type instanceof Annotation)
56246       composeAnnotation(prefix+"Annotation", (Annotation) type);
56247    else if (type instanceof ContactDetail)
56248       composeContactDetail(prefix+"ContactDetail", (ContactDetail) type);
56249    else if (type instanceof UsageContext)
56250       composeUsageContext(prefix+"UsageContext", (UsageContext) type);
56251    else if (type instanceof Expression)
56252       composeExpression(prefix+"Expression", (Expression) type);
56253    else if (type instanceof Signature)
56254       composeSignature(prefix+"Signature", (Signature) type);
56255    else if (type instanceof CodeableConcept)
56256       composeCodeableConcept(prefix+"CodeableConcept", (CodeableConcept) type);
56257    else if (type instanceof ParameterDefinition)
56258       composeParameterDefinition(prefix+"ParameterDefinition", (ParameterDefinition) type);
56259    else if (type instanceof CodeType) {
56260      composeCodeCore(prefix+"Code", (CodeType) type, false);
56261      composeCodeExtras(prefix+"Code", (CodeType) type, false);
56262    }
56263    else if (type instanceof OidType) {
56264      composeOidCore(prefix+"Oid", (OidType) type, false);
56265      composeOidExtras(prefix+"Oid", (OidType) type, false);
56266    }
56267    else if (type instanceof CanonicalType) {
56268      composeCanonicalCore(prefix+"Canonical", (CanonicalType) type, false);
56269      composeCanonicalExtras(prefix+"Canonical", (CanonicalType) type, false);
56270    }
56271    else if (type instanceof UuidType) {
56272      composeUuidCore(prefix+"Uuid", (UuidType) type, false);
56273      composeUuidExtras(prefix+"Uuid", (UuidType) type, false);
56274    }
56275    else if (type instanceof UrlType) {
56276      composeUrlCore(prefix+"Url", (UrlType) type, false);
56277      composeUrlExtras(prefix+"Url", (UrlType) type, false);
56278    }
56279    else if (type instanceof UnsignedIntType) {
56280      composeUnsignedIntCore(prefix+"UnsignedInt", (UnsignedIntType) type, false);
56281      composeUnsignedIntExtras(prefix+"UnsignedInt", (UnsignedIntType) type, false);
56282    }
56283    else if (type instanceof MarkdownType) {
56284      composeMarkdownCore(prefix+"Markdown", (MarkdownType) type, false);
56285      composeMarkdownExtras(prefix+"Markdown", (MarkdownType) type, false);
56286    }
56287    else if (type instanceof IdType) {
56288      composeIdCore(prefix+"Id", (IdType) type, false);
56289      composeIdExtras(prefix+"Id", (IdType) type, false);
56290    }
56291    else if (type instanceof PositiveIntType) {
56292      composePositiveIntCore(prefix+"PositiveInt", (PositiveIntType) type, false);
56293      composePositiveIntExtras(prefix+"PositiveInt", (PositiveIntType) type, false);
56294    }
56295    else if (type instanceof DateType) {
56296      composeDateCore(prefix+"Date", (DateType) type, false);
56297      composeDateExtras(prefix+"Date", (DateType) type, false);
56298    }
56299    else if (type instanceof DateTimeType) {
56300      composeDateTimeCore(prefix+"DateTime", (DateTimeType) type, false);
56301      composeDateTimeExtras(prefix+"DateTime", (DateTimeType) type, false);
56302    }
56303    else if (type instanceof StringType) {
56304      composeStringCore(prefix+"String", (StringType) type, false);
56305      composeStringExtras(prefix+"String", (StringType) type, false);
56306    }
56307    else if (type instanceof IntegerType) {
56308      composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
56309      composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
56310    }
56311    else if (type instanceof UriType) {
56312      composeUriCore(prefix+"Uri", (UriType) type, false);
56313      composeUriExtras(prefix+"Uri", (UriType) type, false);
56314    }
56315    else if (type instanceof InstantType) {
56316      composeInstantCore(prefix+"Instant", (InstantType) type, false);
56317      composeInstantExtras(prefix+"Instant", (InstantType) type, false);
56318    }
56319    else if (type instanceof BooleanType) {
56320      composeBooleanCore(prefix+"Boolean", (BooleanType) type, false);
56321      composeBooleanExtras(prefix+"Boolean", (BooleanType) type, false);
56322    }
56323    else if (type instanceof Base64BinaryType) {
56324      composeBase64BinaryCore(prefix+"Base64Binary", (Base64BinaryType) type, false);
56325      composeBase64BinaryExtras(prefix+"Base64Binary", (Base64BinaryType) type, false);
56326    }
56327    else if (type instanceof TimeType) {
56328      composeTimeCore(prefix+"Time", (TimeType) type, false);
56329      composeTimeExtras(prefix+"Time", (TimeType) type, false);
56330    }
56331    else if (type instanceof DecimalType) {
56332      composeDecimalCore(prefix+"Decimal", (DecimalType) type, false);
56333      composeDecimalExtras(prefix+"Decimal", (DecimalType) type, false);
56334    }
56335    else
56336      throw new Error("Unhandled type");
56337  }
56338
56339  protected void composeTypeInner(Type type) throws IOException {
56340    if (type == null)
56341      ;
56342    else if (type instanceof Extension)
56343       composeExtensionInner((Extension) type);
56344    else if (type instanceof Narrative)
56345       composeNarrativeInner((Narrative) type);
56346    else if (type instanceof Count)
56347       composeCountInner((Count) type);
56348    else if (type instanceof Dosage)
56349       composeDosageInner((Dosage) type);
56350    else if (type instanceof Distance)
56351       composeDistanceInner((Distance) type);
56352    else if (type instanceof Age)
56353       composeAgeInner((Age) type);
56354    else if (type instanceof Duration)
56355       composeDurationInner((Duration) type);
56356    else if (type instanceof Timing)
56357       composeTimingInner((Timing) type);
56358    else if (type instanceof Meta)
56359       composeMetaInner((Meta) type);
56360    else if (type instanceof Address)
56361       composeAddressInner((Address) type);
56362    else if (type instanceof Contributor)
56363       composeContributorInner((Contributor) type);
56364    else if (type instanceof Attachment)
56365       composeAttachmentInner((Attachment) type);
56366    else if (type instanceof DataRequirement)
56367       composeDataRequirementInner((DataRequirement) type);
56368    else if (type instanceof Money)
56369       composeMoneyInner((Money) type);
56370    else if (type instanceof HumanName)
56371       composeHumanNameInner((HumanName) type);
56372    else if (type instanceof ContactPoint)
56373       composeContactPointInner((ContactPoint) type);
56374    else if (type instanceof Identifier)
56375       composeIdentifierInner((Identifier) type);
56376    else if (type instanceof Coding)
56377       composeCodingInner((Coding) type);
56378    else if (type instanceof SampledData)
56379       composeSampledDataInner((SampledData) type);
56380    else if (type instanceof Ratio)
56381       composeRatioInner((Ratio) type);
56382    else if (type instanceof Reference)
56383       composeReferenceInner((Reference) type);
56384    else if (type instanceof TriggerDefinition)
56385       composeTriggerDefinitionInner((TriggerDefinition) type);
56386    else if (type instanceof Quantity)
56387       composeQuantityInner((Quantity) type);
56388    else if (type instanceof Period)
56389       composePeriodInner((Period) type);
56390    else if (type instanceof Range)
56391       composeRangeInner((Range) type);
56392    else if (type instanceof RelatedArtifact)
56393       composeRelatedArtifactInner((RelatedArtifact) type);
56394    else if (type instanceof Annotation)
56395       composeAnnotationInner((Annotation) type);
56396    else if (type instanceof ContactDetail)
56397       composeContactDetailInner((ContactDetail) type);
56398    else if (type instanceof UsageContext)
56399       composeUsageContextInner((UsageContext) type);
56400    else if (type instanceof Expression)
56401       composeExpressionInner((Expression) type);
56402    else if (type instanceof Signature)
56403       composeSignatureInner((Signature) type);
56404    else if (type instanceof CodeableConcept)
56405       composeCodeableConceptInner((CodeableConcept) type);
56406    else if (type instanceof ParameterDefinition)
56407       composeParameterDefinitionInner((ParameterDefinition) type);
56408    else
56409      throw new Error("Unhandled type");
56410  }
56411
56412}
56413